Fix generating file tar.gz

This commit is contained in:
Jesús 2021-02-17 19:53:23 -05:00
parent eab7a6db0b
commit ab6a7fcb62
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766
3 changed files with 11 additions and 11 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
myhyper
myhyper/
x86_64/
i686/
*.tar.gz
*.sha512sum

View File

@ -13,6 +13,7 @@
# Example:
#
# # ./hyper-bootstrap.sh -a x86_64 -r "https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing" myhyper
# # ./hyper-bootstrap.sh myhyper
#
# And then you can chroot to the destination directory (user: root, password: root):
#

View File

@ -11,24 +11,22 @@ CHROOT_DELETE='y'
RESULTPATH=${SCRIPT_PWD}/
ARCH="x86_64"
REPO_URL="https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing"
DOWNLOAD_DIR="/tmp/bootstrap-packages"
ROOTFS=$(mktemp -d)
mkdir -p "$ROOTFS"
ROOTFS="$ARCH"
# remove old archives
rm -f "${RESULTPATH}/hyperbola-bootstrap.tar.gz" "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
# bootstrap
"${SCRIPT_PWD}/hyper-bootstrap.sh" -a "${ARCH}" -r "${REPO_URL}" -d "${DOWNLOAD_DIR}" "${ROOTFS}"
"${SCRIPT_PWD}/hyper-bootstrap.sh" -a "${ARCH}" -r "${REPO_URL}" "${ROOTFS}"
cd "${ROOTFS}"
# clean up package cache
rm -rf var/cache/*
# create new archive
tar -czf "${RESULTPATH}/hyperbola-bootstrap.tar.gz" --transform "s|^|root.${ARCH}/|" --owner 0 --group 0 -- \
bin dev home media opt root sbin sys usr lib64 \
boot etc lib mnt proc run srv tmp var
# create new archive
cd ${RESULTPATH}
tar --create --gzip --numeric-owner --xattrs --acls --file="hyperbola-bootstrap.tar.gz" "${ROOTFS}"
# create shasum
sha512sum "${RESULTPATH}/hyperbola-bootstrap.tar.gz" >| "${RESULTPATH}/hyperbola-bootstrap.tar.gz.sha512sum"
# clean chroot temp
@ -40,6 +38,5 @@ esac
# report result
echo "REPO: $REPO_URL"
echo "DOWNLOAD_DIR: $DOWNLOAD_DIR"
echo "ROOTFS: $ROOTFS"
echo "RESULTPATH: $RESULTPATH"