Add flexible chroot delete

This commit is contained in:
Jesus 2023-09-25 02:59:44 +08:00
parent fe6c9aa2b4
commit 19b520487d
No known key found for this signature in database
GPG Key ID: E607CE7149F4D71C

View File

@ -17,6 +17,7 @@ Usage: bash $0 [options]
Options: Options:
-a, --arch ARCH Specify architecture (default: x86_64) -a, --arch ARCH Specify architecture (default: x86_64)
-d, --delete-chroot Delete the chroot environment after processing (default: yes)
-r, --release VERSION Specify version (default: v0.4.3) -r, --release VERSION Specify version (default: v0.4.3)
-u, --url URL Specify repository URL (default: https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable) -u, --url URL Specify repository URL (default: https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable)
-owu, --owner-user-id ID Owner user ID for the tar file (default: 1000) -owu, --owner-user-id ID Owner user ID for the tar file (default: 1000)
@ -44,6 +45,10 @@ while [[ $# -gt 0 ]]; do
ARCH="${2}" ARCH="${2}"
shift 2 shift 2
;; ;;
-d|--delete-chroot)
CHROOT_DELETE="${2}"
shift 2
;;
-r|--release) -r|--release)
RELEASE="${2}" RELEASE="${2}"
shift 2 shift 2
@ -98,8 +103,8 @@ printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' "Make hyperbola-bootstrap
# Clean chroot temp # Clean chroot temp
case $CHROOT_DELETE in case $CHROOT_DELETE in
y) rm -rf "${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;; y|yes) rm -rf "${RESULTPATH}/${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;;
n) echo 'Temporal chroot available' ;; n|not) echo 'Temporal chroot available' ;;
*) echo 'Invalid option "$@"' ;; *) echo 'Invalid option "$@"' ;;
esac esac