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

Commit

Permalink
code improvements. apply hotfix to install fakeroot (required by chec…
Browse files Browse the repository at this point in the history
…kupdates)
  • Loading branch information
lots0logs committed Jun 18, 2016
1 parent d7934c5 commit 143c863
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 43 deletions.
59 changes: 37 additions & 22 deletions dist/antergos-iso
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
##
###

APP_ICON=''
APP_NAME=''
CNCHI_STARTED='False'
IS_MINIMAL='False'
LOG_PATH='/tmp/pacman-boot'
if [[ -z "${INITIALIZED}" ]]; then
APP_ICON=''
APP_NAME=''
CNCHI_STARTED='False'
IS_MINIMAL='False'
LOG_PATH='/tmp/pacman-boot'
INITIALIZED='True'
fi


###
Expand All @@ -45,6 +48,16 @@ LOG_PATH='/tmp/pacman-boot'
##
###

pac() {
sudo pacman "$1" --noconfirm --force --needed "${@:2}"
}


packey() {
sudo pacman-key "$@"
}


hotfix_setup_environment() {
_2log "[antergos-iso] Setting up environment.."

Expand All @@ -55,13 +68,8 @@ hotfix_setup_environment() {
[[ -f /tmp/.setup-running ]] && CNCHI_STARTED='True'
[[ -d /home/antergos/.config/openbox ]] && IS_MINIMAL='True'

alias pacSyy='sudo pacman -Syy --noconfirm --force'
alias pacS='sudo pacman -S --noconfirm --force'
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
[[ -e /tmp/.VBoxClient-started ]] || VBoxClient-all && touch /tmp/.VBoxClient-started
fi
}

Expand All @@ -86,7 +94,7 @@ font_patch() {


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

Expand Down Expand Up @@ -119,9 +127,9 @@ notify_no_updates() {


populate_pacman_keyring() {
{ ${BASH_ALIASES[packey_populate]} && return 0; } || \
{ ${BASH_ALIASES[packey_init]} && ${BASH_ALIASES[packey_populate]} && return 0; } || \
return 1
{ packey --populate archlinux antergos && return 0; } \
|| { packey --init && packey --populate archlinux antergos && return 0; } \
|| return 1
}


Expand All @@ -132,31 +140,38 @@ hotfix_waiting_for_internet() {

hotfix_maybe_update() {
add_or_remove_antbs_mirrorlist 'add'
${BASH_ALIASES[pacSyy]} iso-hotfix-utility || populate_pacman_keyring && ${BASH_ALIASES[pacSyy]} iso-hotfix-utility
pac -Syy iso-hotfix-utility || populate_pacman_keyring && pac -Syy iso-hotfix-utility
}


_hotfix_checkupdates_requires_fakeroot() {
pac -S fakeroot
}


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

_hotfix_checkupdates_requires_fakeroot

local CHECK_UPDATES
CHECK_UPDATES=$(sudo checkupdates)

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

if [[ ${INSTALL_CNCHI} = 'True' ]]; then
if [[ ${UPDATE_CNCHI} = 'True' ]]; then
notify_user "${INSTALLING_UPDATES}" "${INSTALLING_UPDATES_SUB}"
stop_cnchi
${BASH_ALIASES[pacS]} cnchi && LEVEL='normal'; _notify_user "${UPDATE_COMPLETE}" "${UPDATE_COMPLETE_SUB}"
start_cnchi && CNCHI_RESTARTED='True'
pac -S cnchi && LEVEL='normal'; _notify_user "${UPDATE_COMPLETE}" "${UPDATE_COMPLETE_SUB}"
else
LEVEL='normal'; notify_no_updates
[[ -f /tmp/.setup-running ]] || start_cnchi
fi

[[ -f /tmp/.setup-running ]] || start_cnchi
}


Expand Down
45 changes: 24 additions & 21 deletions iso-hotfix-utility
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,23 @@
# 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/>.

shopt -s expand_aliases


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

NETWORK_ALIVE=1
NOTIFIED='False'
SCRIPT_UPDATED='False'
LAST_SENT=''
APP_ICON=''
APP_NAME=''
LEVEL=''
if [[ -z "${_INITIALIZED}" ]]; then
NETWORK_ALIVE=1
NOTIFIED='False'
SCRIPT_UPDATED='False'
LAST_SENT=''
APP_ICON=''
APP_NAME=''
LEVEL=''
_INITIALIZED='True'
fi


###
Expand Down Expand Up @@ -73,7 +74,7 @@ _notify_user() {
LAST_SENT=$(notify-send.sh -a "${APP_NAME}" -i "${APP_ICON}" -u "${LEVEL}" -p "$1" "$2")
fi

_2log "${LAST_SENT}"
echo "${LAST_SENT}" > /dev/null
}


Expand Down Expand Up @@ -140,36 +141,38 @@ shopt -q extglob; extglob_set=$?
# set extglob if it wasn't originally set.
((extglob_set)) && shopt -s extglob


supplemental_files_i18n=(/etc/iso-hotfix-utility.d/**_i18n)
supplemental_files=(/etc/iso-hotfix-utility.d/**!(_i18n))

# Load translatable strings for supplemental files
for supplemental_file_i18n in "${supplemental_files_i18n[@]}"
do
# shellcheck source=/dev/null
source "${supplemental_file_i18n}"
done

# Load supplemental files
for supplemental_file in "${supplemental_files[@]}"
do
# shellcheck source=/dev/null
source "${supplemental_file}"
done


# unset extglob if it wasn't originally set
((extglob_set)) && shopt -u extglob


hotfix_before_environment_setup "$1"

{ _setup_environment \
&& hotfix_setup_environment \
&& _run_when_connected \
&& sleep 5 \
&& [[ -f /tmp/.setup-running ]] \
&& exit 0
} >> /tmp/pacman-boot.log 2>&1;
{
{ _setup_environment \
&& hotfix_setup_environment \
&& _run_when_connected \
&& sleep 5 \
&& [[ -f /tmp/.setup-running ]] \
&& exit 0; \
} || { hotfix_run_if_failed && exit 1; }


hotfix_run_if_failed

exit 1;
} >> /tmp/pacman-boot.log 2>&1;

0 comments on commit 143c863

Please sign in to comment.