Browse Source

some code formatting

master
Markus Bergholz 4 years ago
parent
commit
54d4402fc7
1 changed files with 40 additions and 39 deletions
  1. +40
    -39
      superchroot

+ 40
- 39
superchroot View File

@@ -9,16 +9,16 @@ set -e
set_chroot (){

case "$option" in
"exit") chroot_umount $folder ;;
"proot") chroot_proot $folder ;;
"fakechroot") chroot_fakechroot $folder ;;
"systemd") chroot_systemd $folder ;;
"chroot") chroot_chroot $folder ;;
"arch") chroot_arch $folder ;;
"mac") chroot_darwin $folder ;;
"darwin") chroot_darwin $folder ;;
"bsd") chroot_bsd $folder ;;
*) printf "unknown option\n" ;;
"exit") chroot_umount $folder ;;
"proot") chroot_proot $folder ;;
"fakechroot") chroot_fakechroot $folder ;;
"systemd") chroot_systemd $folder ;;
"chroot") chroot_chroot $folder ;;
"arch") chroot_arch $folder ;;
"mac") chroot_darwin $folder ;;
"darwin") chroot_darwin $folder ;;
"bsd") chroot_bsd $folder ;;
*) printf "unknown option\n" ;;
esac

}
@@ -31,38 +31,38 @@ super_chroot(){
if [ $OS == "Darwin" ] || [ $OS == "FreeBSD" ]; then
printf "You need root access.\n"
elif [ $OS == "Linux" ]; then
if which fakechroot >/dev/null; then
printf "fakechroot found...\n"
chroot_fakechroot $folder
if which fakechroot >/dev/null; then
printf "fakechroot found...\n"
chroot_fakechroot $folder

elif which proot >/dev/null; then
printf "proot found ...\n"
chroot_proot $folder
elif which proot >/dev/null; then
printf "proot found ...\n"
chroot_proot $folder

else
printf "I can not find fakechroot nor proot and you aren't root. Sorry, but I can\'t chroot.\n"
fi
else
printf "I can not find fakechroot nor proot and you aren't root. Sorry, but I can\'t chroot.\n"
fi
else
printf "Unknown plattform\n"
fi
else

if [ $OS == "Darwin" ]; then
if [ $OS == "Darwin" ]; then
chroot_darwin $folder
elif [ $OS == "FreeBSD" ]; then
chroot_bsd $folder

elif [ $OS == "Linux" ]; then
if which systemd-nspawn >/dev/null; then
chroot_systemd $folder
if which systemd-nspawn >/dev/null; then
chroot_systemd $folder

elif which arch-chroot >/dev/null; then
chroot_arch $folder
chroot_arch $folder

else
printf "\nRunning classic chroot with mount -t... \n\n"
chroot_chroot $folder
fi
else
printf "\nRunning classic chroot with mount -t... \n\n"
chroot_chroot $folder
fi
else
printf "Unknown plattform\n"
fi
@@ -221,22 +221,23 @@ terminal="/bin/bash"

if (("$#" == 1)); then

if [[ "$1" = "--help" ]]; then
print_help
exit
fi
if [[ "$1" = "--help" ]]; then
print_help
exit
fi

folder=$1
super_chroot "$@"
folder=$1
super_chroot "$@"

elif (("$#" == 2)); then

option=$1
folder=$2
set_chroot "$@"
option=$1
folder=$2
set_chroot "$@"

else
printf "Wrong usage!\n\n"
print_help
exit
printf "Wrong usage!\n\n"
print_help
exit
fi


Loading…
Cancel
Save