diff --git a/installer.zsh b/installer.zsh index c4be734..c275218 100755 --- a/installer.zsh +++ b/installer.zsh @@ -75,7 +75,7 @@ function rootfs/unmount { function installer/parse-opts { local failure=false - zparseopts -D -E -- -root:=root r:=root -help=help h=help + zparseopts -D -E -- -root:=root r:=root -help=help h=help m=mount -mount=mount u=unmount -unmount=unmount root=${root[-1]} [[ ! $root ]] && failure=true @@ -86,6 +86,8 @@ function installer/parse-opts { echo "usage: $0 [options]" echo echo " -r DIR, --root DIR Specifies where to bootstrap the rootfs." + echo " -m, --mount Use with -r to only mount a rootfs without bootstrapping it." + echo " -u, --unmount Use with -r to only unmount a rootfs without bootstrapping it." echo " -h, --help Prints this message and exits." if $help; then @@ -104,10 +106,22 @@ function installer/parse-opts { if [[ -z "$WEIRDOS_SOURCE" ]]; then installer/parse-opts "$@" + if [[ -n "$mount" ]]; then + rootfs/mount "$root" + exit 0 + fi + + if [[ -n "$unmount" ]]; then + rootfs/unmount "$root" + exit 0 + fi + # INITIAL SYSTEM BOOTSTRAP ##fs/setup ##fs/mount + rootfs/setup "$root" + rootfs/mount "$root" ##syslinux/setup