diff --git a/archbox-desktop.bash b/archbox-desktop.bash index da085dd..7127de1 100755 --- a/archbox-desktop.bash +++ b/archbox-desktop.bash @@ -38,31 +38,36 @@ EOF case $1 in -i|--install) - checkdep update-desktop-database + checkdep update-desktop-database install_desktop ${@:2} - update-desktop-database - ;; + update-desktop-database + exit $? + ;; -r|--remove) - checkdep update-desktop-database - selected_entry=${@:2} - for i in $selected_entry; do - rm ~/.local/share/applications/archbox/$i - done - update-desktop-database - ;; + checkdep update-desktop-database + selected_entry=${@:2} + for i in $selected_entry; do + rm ~/.local/share/applications/archbox/$i + done + update-desktop-database + exit $? + ;; -h|--help) help_text - ;; + exit 0 + ;; -l|--list) archbox ls -1 --color=none /usr/share/applications - ;; + exit $? + ;; -s|--list-installed) ls -1 --color=none ~/.local/share/applications/archbox - ;; + exit $? + ;; *) checkdep zenity checkdep sed - checkdep update-desktop-database + checkdep update-desktop-database action="$(zenity --list --radiolist --title 'Archbox Desktop Manager' \ --height=200 --width=450 --column 'Select' --column 'Action' \ --text 'What do you want to do?' \ @@ -72,16 +77,15 @@ case $1 in list_desktop="$(archbox ls --color=none -1 /usr/share/applications)" zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')" selected_entry=$(zenity --list --checklist --height=500 --width=450 \ - --title="Archbox Desktop Manager" \ - --text "Select .desktop entries those you want to install" \ - --column "Select" --column "Applications" \ - FALSE $zenity_entry | sed 's/|/\ /g') - echo $selected_entry + --title="Archbox Desktop Manager" \ + --text "Select .desktop entries those you want to install" \ + --column "Select" --column "Applications" \ + FALSE $zenity_entry | sed 's/|/\ /g') [[ -z $selected_entry ]] && exit 1 install_desktop $selected_entry - update-desktop-database + update-desktop-database exit 0 - ;; + ;; 'Remove desktop entries') list_desktop="$(ls --color=none -1 ~/.local/share/applications/archbox)" [[ -z $list_desktop ]] && zenity --info --title "Archbox Desktop Manager" \ @@ -93,12 +97,12 @@ case $1 in --column "Select" --column "Applications" \ FALSE $zenity_entry | sed 's/|/\ /g') [[ -z $selected_entry ]] && exit 1 - for i in $selected_entry; do - rm ~/.local/share/applications/archbox/$i - done - update-desktop-database + for i in $selected_entry; do + rm ~/.local/share/applications/archbox/$i + done + update-desktop-database exit $? - ;; + ;; esac exit 1 ;; diff --git a/archbox.bash b/archbox.bash index e585ae5..098d47b 100755 --- a/archbox.bash +++ b/archbox.bash @@ -53,7 +53,7 @@ case $1 in checkdep wget while true; do wget -O archlinux.tar.gz $2 && break; done msg "Extracting the tarball..." - checkdep tar + checkdep tar tar xzf archlinux.tar.gz msg "Enabling internet connection in chroot enviroment..." cp /etc/resolv.conf $CHROOT/etc/resolv.conf @@ -78,33 +78,40 @@ case $1 in mkdir -p $CHROOT/lib/modules mount -R /lib/modules $CHROOT/lib/modules mount -R /boot $CHROOT/boot - cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup - echo $USER > /tmp/archbox_user - chroot $CHROOT /bin/bash -c "/chroot_setup" + cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup + echo $USER > /tmp/archbox_user + chroot $CHROOT /bin/bash -c "/chroot_setup" + exit $? ;; -e|--enter) - storeenv - copyresolv + storeenv + copyresolv $PRIV /usr/local/share/archbox/bin/archbox enter - ;; + exit $? + ;; --remount-run) - $PRIV /usr/local/share/archbox/bin/remount_run - ;; + $PRIV /usr/local/share/archbox/bin/remount_run + exit $? + ;; --mount-runtime-only) - $PRIV /usr/local/share/archbox/bin/remount_run runtimeonly - ;; + $PRIV /usr/local/share/archbox/bin/remount_run runtimeonly + exit $? + ;; -h|--help) help_text + exit 0 ;; "") help_text + exit 1 ;; -*) err "Unknown option: $1" ;; *) - storeenv - copyresolv - $PRIV /usr/local/share/archbox/bin/archbox $@ + storeenv + copyresolv + $PRIV /usr/local/share/archbox/bin/archbox $@ + exit $? ;; esac diff --git a/archboxinit.bash b/archboxinit.bash index 5385e9d..05a3260 100755 --- a/archboxinit.bash +++ b/archboxinit.bash @@ -3,33 +3,33 @@ source /etc/archbox.conf case $1 in - start) - mount -R /home $CHROOT/home - mount -t proc /proc $CHROOT/proc - mount -R /tmp $CHROOT/tmp - mount -R /sys $CHROOT/sys - mount --make-rslave $CHROOT/sys - mount -R /dev $CHROOT/dev - mount --make-rslave $CHROOT/dev - [[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run - mount -R /lib/modules $CHROOT/lib/modules - mount -R /boot $CHROOT/boot - mount -R /var/lib/dbus $CHROOT/var/lib/dbus - mount -R / $CHROOT/var/host - chroot $CHROOT /usr/local/bin/serviced >/dev/null 2>&1 - exit 0 - ;; - stop) - umount -R $CHROOT/home - umount -R $CHROOT/proc - umount -R $CHROOT/tmp - umount -R $CHROOT/sys - umount -R $CHROOT/dev - [[ $MOUNT_RUN = "yes" ]] && umount -R $CHROOT/run - umount -R $CHROOT/lib/modules - umount -R $CHROOT/boot - umount -R $CHROOT/var/lib/dbus - umount -R $CHROOT/var/host - exit 0 - ;; + start) + mount -R /home $CHROOT/home + mount -t proc /proc $CHROOT/proc + mount -R /tmp $CHROOT/tmp + mount -R /sys $CHROOT/sys + mount --make-rslave $CHROOT/sys + mount -R /dev $CHROOT/dev + mount --make-rslave $CHROOT/dev + [[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run + mount -R /lib/modules $CHROOT/lib/modules + mount -R /boot $CHROOT/boot + mount -R /var/lib/dbus $CHROOT/var/lib/dbus + mount -R / $CHROOT/var/host + chroot $CHROOT /usr/local/bin/serviced >/dev/null 2>&1 + exit 0 + ;; + stop) + umount -R $CHROOT/home + umount -R $CHROOT/proc + umount -R $CHROOT/tmp + umount -R $CHROOT/sys + umount -R $CHROOT/dev + [[ $MOUNT_RUN = "yes" ]] && umount -R $CHROOT/run + umount -R $CHROOT/lib/modules + umount -R $CHROOT/boot + umount -R $CHROOT/var/lib/dbus + umount -R $CHROOT/var/host + exit 0 + ;; esac diff --git a/remount_run.bash b/remount_run.bash index 3c74170..3ecca47 100755 --- a/remount_run.bash +++ b/remount_run.bash @@ -3,20 +3,20 @@ source /etc/archbox.conf case $1 in - killxdg) - umount -l $CHROOT/run - fuser -km $(cat /tmp/archbox_xdg_runtime_dir) - exit $? - ;; - runtimeonly) - mkdir -p $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) - umount -Rl $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) - mount --rbind $(cat /tmp/archbox_xdg_runtime_dir) $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) - exit $? - ;; - *) + killxdg) umount -l $CHROOT/run - mount --rbind /run $CHROOT/run - exit $? - ;; + fuser -km $(cat /tmp/archbox_xdg_runtime_dir) + exit $? + ;; + runtimeonly) + mkdir -p $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) + umount -Rl $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) + mount --rbind $(cat /tmp/archbox_xdg_runtime_dir) $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir) + exit $? + ;; + *) + umount -l $CHROOT/run + mount --rbind /run $CHROOT/run + exit $? + ;; esac