Remove x86_64/ and i686/ directory to make tarball file
Details: - Add paramaters features --arch, --release, --url
This commit is contained in:
parent
e60cdcef9f
commit
138734cd00
@ -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"
|
||||
|
||||
# bootstrap for v0.3
|
||||
# bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.2.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
|
||||
# Make bootstrap for Hyperbola
|
||||
bash "${SCRIPT_PWD}/hyper-bootstrap_${RELEASE}.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
|
||||
|
||||
cd "${ROOTFS}"
|
||||
# clean up package cache
|
||||
rm -rf var/cache/*
|
||||
# Clean up package cache
|
||||
(cd "${ROOTFS}" && rm -rf var/cache/*)
|
||||
|
||||
# create new archive
|
||||
cd "${RESULTPATH}"
|
||||
tar --create --gzip --numeric-owner --xattrs --acls --file="hyperbola-bootstrap.tar.gz" "${ROOTFS}"
|
||||
# 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 shasum
|
||||
sha512sum "${RESULTPATH}/hyperbola-bootstrap.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
|
||||
# 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" *)
|
||||
|
||||
# clean chroot temp
|
||||
# Make sha512sum
|
||||
sha512sum "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz.sha512sum"
|
||||
|
||||
# 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}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user