21-assist-in-env-setup #23
37
setup.sh
37
setup.sh
@ -36,6 +36,38 @@ trap '[ "$?" -ne 77 ] || exit 77' ERR
|
||||
|
||||
declare zpool_drive efi_drive boot_drive part_schema
|
||||
|
||||
function arg_parse () {
|
||||
[[ "${1}" ]] && while :; do
|
||||
case "${1}" in
|
||||
-[[:alnum:]]*)
|
||||
>&3 printf -- '%s\n' \
|
||||
'Short options '"'${1}'"' detected. Only known option is' \
|
||||
'literal string '"'"'setup'"'"'. No idea what '"'${1}'"' is.' \
|
||||
'Exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
--*)
|
||||
>&3 printf -- '%s\n' \
|
||||
'Long-form option '"'${1}'"' detected. Only known option is' \
|
||||
'literal string '"'"'setup'"'"'. No idea what '"'${1}'"' is.' \
|
||||
'Exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
setup)
|
||||
setup_env_vars
|
||||
return
|
||||
;;
|
||||
*)
|
||||
>&3 printf -- '%s\n' \
|
||||
'Argument '"'${1}'"' detected. Only known option is literal' \
|
||||
'string '"'"'setup'"'"'. No idea what '"'${1}'"' is.' \
|
||||
'Exiting ...'
|
||||
exit 77
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function we_are_changerooted () {
|
||||
if [ "$(stat -c '%d:%i' '/')" != "$(stat -c '%d:%i' '/proc/1/root/.')" ]; then
|
||||
return 0
|
||||
@ -1137,6 +1169,9 @@ function finalize_os_setup () {
|
||||
}
|
||||
|
||||
function main () {
|
||||
if [[ "${#@}" -gt '0' ]]; then
|
||||
arg_parse "${@}"
|
||||
fi
|
||||
if we_are_changerooted; then
|
||||
install_os_in_chroot #2.2
|
||||
else
|
||||
@ -1164,4 +1199,4 @@ function main () {
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
main "${@}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user