Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lots0logs committed Jun 16, 2016
1 parent 47ed59e commit e351174
Show file tree
Hide file tree
Showing 3 changed files with 329 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[antergos.cnchi_updaterpot]
file_filter = po/<lang>.po
source_file = po/CNCHI_UPDATER.pot
source_lang = en
type = PO
243 changes: 243 additions & 0 deletions iso-hotfix-utility
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
#!/bin/bash
#
# iso-hotfix-utility
#
# Copyright © 2013-2016 Antergos
#
# This file is part of iso-hotfix-utility.
#
# iso-hotfix-utility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# iso-hotfix-utility is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# The following additional terms are in effect as per Section 7 of the license:
#
# The preservation of all legal notices and author attributions in
# the material or in the Appropriate Legal Notices displayed
# by works containing it is required.
#
# You should have received a copy of the GNU General Public License
# along with iso-hotfix-utility; if not, see <http://www.gnu.org/licenses/>.

export TEXTDOMAIN="CNCHI_UPDATER"
export GETTEXT='gettext "CNCHI_UPDATER"'

###
##
# Translatable Strings
##
###

NO_CONNECTION=$(${GETTEXT} "INSTALLER NOTICE:")
NO_CONNECTION_SUB_STR='You must be connected to the internet to install Antergos. '
NO_CONNECTION_SUB_STR+='Click the network icon in the top bar to configure your connection.'
NO_CONNECTION_SUB=$(${GETTEXT} "${NO_CONNECTION_SUB_STR}")
INSTALLING_UPDATES=$(${GETTEXT} "Installing Updates")
INSTALLING_UPDATES_SUB=$(${GETTEXT} "Installing available updates.")
UPDATE_COMPLETE=$(${GETTEXT} "Update Complete")
UPDATE_COMPLETE_SUB=$(${GETTEXT} "Updates were installed sucessfully. Starting Cnchi...")
CHECKING_UPDATES=$(${GETTEXT} "Cnchi Automatic Updates")
CHECKING_UPDATES_SUB=$(${GETTEXT} "Checking for available updates for the Antergos Installer.")
NO_UPDATES_CN=$(${GETTEXT} "Check was sucessful.")
NO_UPDATES_CN_SUB=$(${GETTEXT} "You have the latest version. You can proceed with your installation!")


###
##
# Initialize Variables
##
###

NETWORK_ALIVE=1
NOTIFIED='False'
SCRIPT_UPDATED='False'
CNCHI_RESTARTED='False'
LAST_SENT=''
CNCHI_ICON=''
IS_MINIMAL='False'


###
##
# Define Functions
##
###

setup_environment() {
NETWORK_ALIVE=$(ping -c1 8.8.8.8 >/dev/null 2>&1; echo $?)
CNCHI_ICON='/usr/share/cnchi/data/images/antergos/antergos-icon.png'

[[ $0 = 'iso-hotfix-utility' ]] && SCRIPT_UPDATED='True'
[[ -f /tmp/.setup-running ]] && CNCHI_STARTED='True'
[[ -d /home/antergos/.config/openbox ]] && IS_MINIMAL='True'

alias pacSyy='sudo pacman -Syy --noconfirm'
alias pacS='sudo pacman -S --noconfirm'
alias packey_populate='sudo pacman-key --populate archlinux antergos'
alias packey_init='sudo pacman-key --init'

if [[ $(systemd-detect-virt) && 'oracle' = $(systemd-detect-virt -v) ]]; then
VBoxClient-all
fi
}


notify_user() {
if [[ "${LAST_SENT}" != '' ]]; then
LAST_SENT=$(notify-send.sh -a "Cnchi" -i "${CNCHI_ICON}" -u critical -p -r "${LAST_SENT}" "$1" "$2")
else
LAST_SENT=$(notify-send.sh -a "Cnchi" -i "${CNCHI_ICON}" -u critical -p "$1" "$2")
fi

echo "${LAST_SENT}"
}


font_patch() {
local clear_fcache='False'

for file in /usr/share/cnchi/data/fonts/OpenSans**
do
file_name=$(basename "${file}")
if ! [[ -f /usr/share/fonts/TTF/"${file_name}" && -f "${file}" ]]; then
sudo cp "${file}" /usr/share/fonts/TTF
clear_fcache='True'
fi
done

if [[ 'True' = "${clear_fcache}" ]]; then
sudo fc-cache -f -v
fi

}


stop_cnchi() {
sudo killall -w /usr/bin/cnchi cnchi python && sudo rm /tmp/.setup-running
sudo systemctl stop pamac > /dev/null 2>&1
sudo rm /var/lib/pacman/db.lck > /dev/null 2>&1

return 0
}


start_cnchi() {
stop_cnchi && sudo -E cnchi -d -v -s bugsnag &

return 0;
}


notify_no_updates() {
notify_user "${NO_UPDATES_CN}" "${NO_UPDATES_CN_SUB}"
sudo sed -i '1d' /etc/pacman.d/antergos-mirrorlist
}


wait_for_internet_connection() {
if [[ "${NETWORK_ALIVE}" != 0 ]]; then
start_cnchi

while [[ "${NETWORK_ALIVE}" != 0 ]]; do
if [[ "${NOTIFIED}" = 'False' ]]; then
notify_user "${NO_CONNECTION}" "${NO_CONNECTION_SUB}"
NOTIFIED='True'
fi

NETWORK_ALIVE=$(ping -c1 8.8.8.8 >/dev/null 2>&1; echo $?)

sleep 1;
done
fi
}


add_or_remove_antbs_mirrorlist() {
if [[ "$1" = 'add' ]]; then
sudo sed -i '1s%^%Server = http://repo.antergos.info/$repo/$arch\n%' /etc/pacman.d/antergos-mirrorlist
elif [[ "$1" = 'remove' ]]; then
sudo sed -i '1d' /etc/pacman.d/antergos-mirrorlist
fi

sudo rm /var/lib/pacman/db.lck > /dev/null 2>&1
}


populate_pacman_keyring() {
{ packey_populate && return 0; } || \
{ packey_init && packey_populate && return 0; } || \
return 1
}


maybe_update_rerun_and_exit() {
if [[ "${SCRIPT_UPDATED}" = 'True' ]]; then
return
fi

add_or_remove_antbs_mirrorlist 'add'
notify_user "${CHECKING_UPDATES}" "${CHECKING_UPDATES_SUB}"

pacSyy iso-hotfix-utility || populate_pacman_keyring && pacSyy iso-hotfix-utility

if [[ -f /usr/bin/iso-hotfix-utility ]]; then
{ nohup /usr/bin/iso-hotfix-utility & } && exit 0
else
notify_no_updates
fi
}


run_when_connected() {
if [[ "${NETWORK_ALIVE}" != 0 ]]; then
wait_for_internet_connection
fi

if [[ 'True' = "${IS_MINIMAL}" ]]; then
pacS numix-icon-theme-square numix-icon-theme numix-frost-themes adwaita-icon-theme
else
sudo modprobe -a spl zfs
fi

local CHECK_UPDATES
CHECK_UPDATES=$(sudo checkupdates)

[[ "${CHECK_UPDATES}" = *'cnchi'* ]] && INSTALL_CNCHI='True'

if [[ ${INSTALL_CNCHI} = 'True' ]]; then
notify_user "${INSTALLING_UPDATES}" "${INSTALLING_UPDATES_SUB}"
stop_cnchi
pacS --force cnchi && notify_user "${UPDATE_COMPLETE}" "${UPDATE_COMPLETE_SUB}"
start_cnchi && CNCHI_RESTARTED='True'
else
notify_no_updates
fi
}


###
##
# Do Stuff
##
###

if [[ "$1" = cnchi-dev ]]; then
sudo rm -rf /usr/share/cnchi
sudo git clone https://github.com/lots0logs/cnchi-dev.git /usr/share/cnchi
cd /usr/share/cnchi && sudo git checkout playing && start_cnchi
exit 0
fi

{ setup_environment && run_when_connected; } > /tmp/pacman-boot.log 2>&1 \
&& sleep 5 \
&& { [[ -f /tmp/.setup-running ]] && exit 0; } \
|| { start_cnchi && exit 0; }


exit 1;
78 changes: 78 additions & 0 deletions po/CNCHI_UPDATER.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
#
# CNCHI_UPDATER.pot
#
# Copyright © 2013-2015 Antergos
#
# This file is part of Cnchi.
#
# Cnchi is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Cnchi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cnchi; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-05 18:37-0500\n"
"PO-Revision-Date: 2015-05-05 18:38-0600\n"
"Language: bin\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: \n"
"Language-Team: \n"
"X-Generator: Poedit 1.7.5\n"

#: pacman-boot:38
msgid "INSTALLER NOTICE:"
msgstr ""

#: pacman-boot:39
msgid ""
"You must be connected to the internet to install Antergos. Click the network "
"icon in the top bar to configure your connection."
msgstr ""

#: pacman-boot:40
msgid "Installing Updates"
msgstr ""

#: pacman-boot:41
msgid "Installing available updates."
msgstr ""

#: pacman-boot:42
msgid "Update Complete"
msgstr ""

#: pacman-boot:43
msgid "Updates were installed sucessfully. Starting Cnchi..."
msgstr ""

#: pacman-boot:44
msgid "Cnchi Automatic Updates"
msgstr ""

#: pacman-boot:45
msgid "Checking for available updates for the Antergos Installer."
msgstr ""

#: pacman-boot:46
msgid "Check was sucessful."
msgstr ""

#: pacman-boot:47
msgid "You have the latest version. You can proceed with your installation!"
msgstr ""

0 comments on commit e351174

Please sign in to comment.