Browse Source

add help text and print_help function

master
Markus Bergholz 6 years ago
parent
commit
6846a6ecfc
1 changed files with 28 additions and 5 deletions
  1. +28
    -5
      createchroot

+ 28
- 5
createchroot View File

@@ -2,6 +2,23 @@

set -e

print_help(){

echo '
createchroot <folder>
createchroot [TYPE] <folder>

[TYPE]: host (root/non-root), wheezy (root/non-root), sid (root/non-root), precise (root/non-root), raring (root/non-root), arch (root)


~$: createchroot host ~/host-clone
This creates instantly a chroot clone of the Host system using facadefs. 'superchroot ~/host-clone/root' have to be used.
To umount, run 'fusermount -u ~/host-clone/root'.
'

}


function make_debian(){

fakeroot fakechroot debootstrap $linux $folder http://cdn.debian.net/debian/
@@ -57,7 +74,8 @@ if (("$#" == 1)); then
"sid") make_debian $linux $folder ;;
"precise") make_ubuntu $linux $folder ;;
"raring") make_ubuntu $linux $folder ;;
*) printf "Unknown or unsupported linux\n" ;;
"--help") print_help ;;
*) print_help ;;
esac
else
folder=$1
@@ -70,7 +88,8 @@ if (("$#" == 1)); then
"sid") sudo_make_debian $linux $folder ;;
"precise") sudo_make_ubuntu $linux $folder ;;
"raring") sudo_make_ubuntu $linux $folder ;;
*) printf "Unknown or unsupported linux\n" ;;
"--help") print_help ;;
*) print_help ;;
esac

elif which yum >/dev/null; then
@@ -82,7 +101,8 @@ if (("$#" == 1)); then
# yum --installroot=$1/devel install bash yum
# yum --installroot=$1/devel groupinstall "minimal install"
else
printf "ups, error!\n"
printf "Unexpected error!\n\n"
print_help
fi
fi

@@ -97,7 +117,7 @@ elif (("$#" == 2)); then
"precise") make_ubuntu $linux $folder ;;
"raring") make_ubuntu $linux $folder ;;
"host") make_hostclone $folder ;;
*) printf "Unknown or unsupported linux\n" ;;
*) print_help ;;
esac
else

@@ -108,9 +128,12 @@ elif (("$#" == 2)); then
"raring") sudo_make_ubuntu $linux $folder ;;
"arch") sudo_make_arch $folder ;;
"host") make_hostclone $folder ;;
*) printf "Unknown or unsupported linux\n" ;;
*) print_help ;;
esac


fi

else
print_help
fi

Loading…
Cancel
Save