diff options
author | Jesus <heckyel@riseup.net> | 2023-09-25 01:20:21 +0800 |
---|---|---|
committer | Jesus <heckyel@riseup.net> | 2023-09-25 01:20:21 +0800 |
commit | 138734cd00be2e966931691f62f0831cff7bf724 (patch) | |
tree | 28337e5b1fb19773bc6a065b7960b19f76d39c95 | |
parent | e60cdcef9f4d9ee7bdbc2038b8606e94dc74361c (diff) | |
download | hyperbola-bootstrap-138734cd00be2e966931691f62f0831cff7bf724.tar.lz hyperbola-bootstrap-138734cd00be2e966931691f62f0831cff7bf724.tar.xz hyperbola-bootstrap-138734cd00be2e966931691f62f0831cff7bf724.zip |
Remove x86_64/ and i686/ directory to make tarball file
Details:
- Add paramaters features --arch, --release, --url
-rw-r--r-- | make-bootstrap-file.sh | 88 |
1 files changed, 62 insertions, 26 deletions
diff --git a/make-bootstrap-file.sh b/make-bootstrap-file.sh index 6419f47..16cf769 100644 --- a/make-bootstrap-file.sh +++ b/make-bootstrap-file.sh @@ -1,48 +1,84 @@ #!/bin/bash -# build: Bootstrap a base Hyperbola GNU+Linux-libre system. +# Build: Bootstrap a base Hyperbola GNU plus Linux-libre system set -e -u -o pipefail +usage() { + cat <<EOF + Usage: + bash $0 make-bootstrap-file.sh + or + bash $0 make-bootstrap-file.sh --arch i686 --release v0.4.3 --url https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable + or + bash $0 make-bootstrap-file.sh -a i686 -r v0.4.3 -u https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable +EOF + exit 1 +} + SCRIPT=$(readlink -f "$0") SCRIPT_PWD=$(dirname "$SCRIPT") CHROOT_DELETE='y' -RESULTPATH=${SCRIPT_PWD}/ +RESULTPATH="${SCRIPT_PWD}" ARCH="x86_64" -# Hyperbola Testing -# REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing" -# Hyperbola v0.4.3 +RELEASE="v0.4.3" REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable" + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + key="${1}" + case $key in + -a|--arch) + ARCH="${2}" + shift 2 + ;; + -r|--release) + RELEASE="${2}" + shift 2 + ;; + -u|--url) + REPO_URL="${2}" + shift 2 + ;; + *) + echo "Unrecognized option: $key" + usage + ;; + esac +done + +# Set ROOTFS ROOTFS="$ARCH" -# remove old archives -rm -f "${RESULTPATH}/hyperbola-bootstrap.tar.gz" "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum" -# bootstrap for v0.4 -bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.3.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}" +# Remove old archives +rm -fv "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz" "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz.sha512sum" + +# Make bootstrap for Hyperbola +bash "${SCRIPT_PWD}/hyper-bootstrap_${RELEASE}.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}" -# bootstrap for v0.3 -# bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.2.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}" +# Clean up package cache +(cd "${ROOTFS}" && rm -rf var/cache/*) -cd "${ROOTFS}" -# clean up package cache -rm -rf var/cache/* +# Rename pacnew files +printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Rename files ending in .pacnew...' '\e[m' +find "${ROOTFS}" -type f -name "*.pacnew" -exec sh -c 'mv -f "$1" "${1%.pacnew}"' _ {} \; -# create new archive -cd "${RESULTPATH}" -tar --create --gzip --numeric-owner --xattrs --acls --file="hyperbola-bootstrap.tar.gz" "${ROOTFS}" +# Make new tarball +printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' "Make hyperbola-bootstrap-${ARCH}.tar.gz..." '\e[m' +(cd "${RESULTPATH}/${ROOTFS}" && tar --create --gzip --numeric-owner --xattrs --acls --file="${SCRIPT_PWD}/hyperbola-bootstrap-${ARCH}.tar.gz" *) -# create shasum -sha512sum "${RESULTPATH}/hyperbola-bootstrap.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum" +# Make sha512sum +sha512sum "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz.sha512sum" -# clean chroot temp +# Clean chroot temp case $CHROOT_DELETE in y) rm -rf "${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;; - n) echo 'temporal chroot available' ;; - *) echo 'invalid_option "$@"' ;; + n) echo 'Temporal chroot available' ;; + *) echo 'Invalid option "$@"' ;; esac -# report result -echo "REPO: $REPO_URL" -echo "ROOTFS: $ROOTFS" -echo "RESULTPATH: $RESULTPATH" +# Report result +echo "REPO: ${REPO_URL}" +echo "ROOTFS: ${ROOTFS}" +echo "RESULTPATH: ${RESULTPATH}" |