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
|
#!/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
|
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=$(readlink -f "$0")
|
||||||
SCRIPT_PWD=$(dirname "$SCRIPT")
|
SCRIPT_PWD=$(dirname "$SCRIPT")
|
||||||
CHROOT_DELETE='y'
|
CHROOT_DELETE='y'
|
||||||
|
|
||||||
RESULTPATH=${SCRIPT_PWD}/
|
RESULTPATH="${SCRIPT_PWD}"
|
||||||
ARCH="x86_64"
|
ARCH="x86_64"
|
||||||
# Hyperbola Testing
|
RELEASE="v0.4.3"
|
||||||
# REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing"
|
|
||||||
# Hyperbola v0.4.3
|
|
||||||
REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable"
|
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"
|
ROOTFS="$ARCH"
|
||||||
# remove old archives
|
|
||||||
rm -f "${RESULTPATH}/hyperbola-bootstrap.tar.gz" "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
|
|
||||||
|
|
||||||
# bootstrap for v0.4
|
# Remove old archives
|
||||||
bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.3.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
|
rm -fv "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz" "${RESULTPATH}/hyperbola-bootstrap-${ARCH}.tar.gz.sha512sum"
|
||||||
|
|
||||||
# bootstrap for v0.3
|
# Make bootstrap for Hyperbola
|
||||||
# bash "${SCRIPT_PWD}/hyper-bootstrap_v0.4.2.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
|
bash "${SCRIPT_PWD}/hyper-bootstrap_${RELEASE}.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
|
||||||
|
|
||||||
cd "${ROOTFS}"
|
# Clean up package cache
|
||||||
# clean up package cache
|
(cd "${ROOTFS}" && rm -rf var/cache/*)
|
||||||
rm -rf var/cache/*
|
|
||||||
|
|
||||||
# create new archive
|
# Rename pacnew files
|
||||||
cd "${RESULTPATH}"
|
printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Rename files ending in .pacnew...' '\e[m'
|
||||||
tar --create --gzip --numeric-owner --xattrs --acls --file="hyperbola-bootstrap.tar.gz" "${ROOTFS}"
|
find "${ROOTFS}" -type f -name "*.pacnew" -exec sh -c 'mv -f "$1" "${1%.pacnew}"' _ {} \;
|
||||||
|
|
||||||
# create shasum
|
# Make new tarball
|
||||||
sha512sum "${RESULTPATH}/hyperbola-bootstrap.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
|
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
|
case $CHROOT_DELETE in
|
||||||
y) rm -rf "${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;;
|
y) rm -rf "${ROOTFS}" || true && echo -e "\e[1;32m==>\e[0m\033[1m Temporal chroot deleted! \e[m" ;;
|
||||||
n) echo 'temporal chroot available' ;;
|
n) echo 'Temporal chroot available' ;;
|
||||||
*) echo 'invalid_option "$@"' ;;
|
*) echo 'Invalid option "$@"' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# report result
|
# Report result
|
||||||
echo "REPO: $REPO_URL"
|
echo "REPO: ${REPO_URL}"
|
||||||
echo "ROOTFS: $ROOTFS"
|
echo "ROOTFS: ${ROOTFS}"
|
||||||
echo "RESULTPATH: $RESULTPATH"
|
echo "RESULTPATH: ${RESULTPATH}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user