Fix indetation problems.

This commit is contained in:
lemniskett 2020-12-31 23:16:31 +07:00
parent adb2fcbe46
commit 722d9cf2fc
4 changed files with 95 additions and 84 deletions

View File

@ -38,31 +38,36 @@ EOF
case $1 in case $1 in
-i|--install) -i|--install)
checkdep update-desktop-database checkdep update-desktop-database
install_desktop ${@:2} install_desktop ${@:2}
update-desktop-database update-desktop-database
;; exit $?
;;
-r|--remove) -r|--remove)
checkdep update-desktop-database checkdep update-desktop-database
selected_entry=${@:2} selected_entry=${@:2}
for i in $selected_entry; do for i in $selected_entry; do
rm ~/.local/share/applications/archbox/$i rm ~/.local/share/applications/archbox/$i
done done
update-desktop-database update-desktop-database
;; exit $?
;;
-h|--help) -h|--help)
help_text help_text
;; exit 0
;;
-l|--list) -l|--list)
archbox ls -1 --color=none /usr/share/applications archbox ls -1 --color=none /usr/share/applications
;; exit $?
;;
-s|--list-installed) -s|--list-installed)
ls -1 --color=none ~/.local/share/applications/archbox ls -1 --color=none ~/.local/share/applications/archbox
;; exit $?
;;
*) *)
checkdep zenity checkdep zenity
checkdep sed checkdep sed
checkdep update-desktop-database checkdep update-desktop-database
action="$(zenity --list --radiolist --title 'Archbox Desktop Manager' \ action="$(zenity --list --radiolist --title 'Archbox Desktop Manager' \
--height=200 --width=450 --column 'Select' --column 'Action' \ --height=200 --width=450 --column 'Select' --column 'Action' \
--text 'What do you want to do?' \ --text 'What do you want to do?' \
@ -72,16 +77,15 @@ case $1 in
list_desktop="$(archbox ls --color=none -1 /usr/share/applications)" list_desktop="$(archbox ls --color=none -1 /usr/share/applications)"
zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')" zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')"
selected_entry=$(zenity --list --checklist --height=500 --width=450 \ selected_entry=$(zenity --list --checklist --height=500 --width=450 \
--title="Archbox Desktop Manager" \ --title="Archbox Desktop Manager" \
--text "Select .desktop entries those you want to install" \ --text "Select .desktop entries those you want to install" \
--column "Select" --column "Applications" \ --column "Select" --column "Applications" \
FALSE $zenity_entry | sed 's/|/\ /g') FALSE $zenity_entry | sed 's/|/\ /g')
echo $selected_entry
[[ -z $selected_entry ]] && exit 1 [[ -z $selected_entry ]] && exit 1
install_desktop $selected_entry install_desktop $selected_entry
update-desktop-database update-desktop-database
exit 0 exit 0
;; ;;
'Remove desktop entries') 'Remove desktop entries')
list_desktop="$(ls --color=none -1 ~/.local/share/applications/archbox)" list_desktop="$(ls --color=none -1 ~/.local/share/applications/archbox)"
[[ -z $list_desktop ]] && zenity --info --title "Archbox Desktop Manager" \ [[ -z $list_desktop ]] && zenity --info --title "Archbox Desktop Manager" \
@ -93,12 +97,12 @@ case $1 in
--column "Select" --column "Applications" \ --column "Select" --column "Applications" \
FALSE $zenity_entry | sed 's/|/\ /g') FALSE $zenity_entry | sed 's/|/\ /g')
[[ -z $selected_entry ]] && exit 1 [[ -z $selected_entry ]] && exit 1
for i in $selected_entry; do for i in $selected_entry; do
rm ~/.local/share/applications/archbox/$i rm ~/.local/share/applications/archbox/$i
done done
update-desktop-database update-desktop-database
exit $? exit $?
;; ;;
esac esac
exit 1 exit 1
;; ;;

View File

@ -53,7 +53,7 @@ case $1 in
checkdep wget checkdep wget
while true; do wget -O archlinux.tar.gz $2 && break; done while true; do wget -O archlinux.tar.gz $2 && break; done
msg "Extracting the tarball..." msg "Extracting the tarball..."
checkdep tar checkdep tar
tar xzf archlinux.tar.gz tar xzf archlinux.tar.gz
msg "Enabling internet connection in chroot enviroment..." msg "Enabling internet connection in chroot enviroment..."
cp /etc/resolv.conf $CHROOT/etc/resolv.conf cp /etc/resolv.conf $CHROOT/etc/resolv.conf
@ -78,33 +78,40 @@ case $1 in
mkdir -p $CHROOT/lib/modules mkdir -p $CHROOT/lib/modules
mount -R /lib/modules $CHROOT/lib/modules mount -R /lib/modules $CHROOT/lib/modules
mount -R /boot $CHROOT/boot mount -R /boot $CHROOT/boot
cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
echo $USER > /tmp/archbox_user echo $USER > /tmp/archbox_user
chroot $CHROOT /bin/bash -c "/chroot_setup" chroot $CHROOT /bin/bash -c "/chroot_setup"
exit $?
;; ;;
-e|--enter) -e|--enter)
storeenv storeenv
copyresolv copyresolv
$PRIV /usr/local/share/archbox/bin/archbox enter $PRIV /usr/local/share/archbox/bin/archbox enter
;; exit $?
;;
--remount-run) --remount-run)
$PRIV /usr/local/share/archbox/bin/remount_run $PRIV /usr/local/share/archbox/bin/remount_run
;; exit $?
;;
--mount-runtime-only) --mount-runtime-only)
$PRIV /usr/local/share/archbox/bin/remount_run runtimeonly $PRIV /usr/local/share/archbox/bin/remount_run runtimeonly
;; exit $?
;;
-h|--help) -h|--help)
help_text help_text
exit 0
;; ;;
"") "")
help_text help_text
exit 1
;; ;;
-*) -*)
err "Unknown option: $1" err "Unknown option: $1"
;; ;;
*) *)
storeenv storeenv
copyresolv copyresolv
$PRIV /usr/local/share/archbox/bin/archbox $@ $PRIV /usr/local/share/archbox/bin/archbox $@
exit $?
;; ;;
esac esac

View File

@ -3,33 +3,33 @@
source /etc/archbox.conf source /etc/archbox.conf
case $1 in case $1 in
start) start)
mount -R /home $CHROOT/home mount -R /home $CHROOT/home
mount -t proc /proc $CHROOT/proc mount -t proc /proc $CHROOT/proc
mount -R /tmp $CHROOT/tmp mount -R /tmp $CHROOT/tmp
mount -R /sys $CHROOT/sys mount -R /sys $CHROOT/sys
mount --make-rslave $CHROOT/sys mount --make-rslave $CHROOT/sys
mount -R /dev $CHROOT/dev mount -R /dev $CHROOT/dev
mount --make-rslave $CHROOT/dev mount --make-rslave $CHROOT/dev
[[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run [[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run
mount -R /lib/modules $CHROOT/lib/modules mount -R /lib/modules $CHROOT/lib/modules
mount -R /boot $CHROOT/boot mount -R /boot $CHROOT/boot
mount -R /var/lib/dbus $CHROOT/var/lib/dbus mount -R /var/lib/dbus $CHROOT/var/lib/dbus
mount -R / $CHROOT/var/host mount -R / $CHROOT/var/host
chroot $CHROOT /usr/local/bin/serviced >/dev/null 2>&1 chroot $CHROOT /usr/local/bin/serviced >/dev/null 2>&1
exit 0 exit 0
;; ;;
stop) stop)
umount -R $CHROOT/home umount -R $CHROOT/home
umount -R $CHROOT/proc umount -R $CHROOT/proc
umount -R $CHROOT/tmp umount -R $CHROOT/tmp
umount -R $CHROOT/sys umount -R $CHROOT/sys
umount -R $CHROOT/dev umount -R $CHROOT/dev
[[ $MOUNT_RUN = "yes" ]] && umount -R $CHROOT/run [[ $MOUNT_RUN = "yes" ]] && umount -R $CHROOT/run
umount -R $CHROOT/lib/modules umount -R $CHROOT/lib/modules
umount -R $CHROOT/boot umount -R $CHROOT/boot
umount -R $CHROOT/var/lib/dbus umount -R $CHROOT/var/lib/dbus
umount -R $CHROOT/var/host umount -R $CHROOT/var/host
exit 0 exit 0
;; ;;
esac esac

View File

@ -3,20 +3,20 @@
source /etc/archbox.conf source /etc/archbox.conf
case $1 in case $1 in
killxdg) 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 $?
;;
*)
umount -l $CHROOT/run umount -l $CHROOT/run
mount --rbind /run $CHROOT/run fuser -km $(cat /tmp/archbox_xdg_runtime_dir)
exit $? 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 esac