Preserve Linux capabilities when running tar, and misc fixes for mkrootfs. (#92)
* Preserve Linux capabilities in various tar invocations. Otherwise, ping as non-root will not work when using a Void image. Don't try to umount pseudofilesystems when $rootfs is undefined. On mktemp failure, die in the script itself, not the $( ... ) subshell. And remove the second FATAL: from the error message.
This commit is contained in:
parent
9800862806
commit
4317c1a4f6
@ -1116,15 +1116,14 @@ log_and_count() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_rootfs() {
|
copy_rootfs() {
|
||||||
local tar_in="--create --one-file-system"
|
local tar_in="--create --one-file-system --xattrs"
|
||||||
local tar_out="--extract --preserve-permissions"
|
|
||||||
TITLE="Check $LOG for details ..."
|
TITLE="Check $LOG for details ..."
|
||||||
INFOBOX "Counting files, please be patient ..." 4 60
|
INFOBOX "Counting files, please be patient ..." 4 60
|
||||||
copy_total=$(tar ${tar_in} -v -f /dev/null / 2>/dev/null | wc -l)
|
copy_total=$(tar ${tar_in} -v -f /dev/null / 2>/dev/null | wc -l)
|
||||||
export copy_total copy_count=0 copy_progress=
|
export copy_total copy_count=0 copy_progress=
|
||||||
clear
|
clear
|
||||||
tar ${tar_in} -f - / 2>/dev/null | \
|
tar ${tar_in} -f - / 2>/dev/null | \
|
||||||
tar ${tar_out} -v -f - -C $TARGETDIR | \
|
tar --extract --xattrs --xattrs-include='*' --preserve-permissions -v -f - -C $TARGETDIR | \
|
||||||
log_and_count | \
|
log_and_count | \
|
||||||
DIALOG --title "${TITLE}" \
|
DIALOG --title "${TITLE}" \
|
||||||
--progressbox "Copying live image to target rootfs." 5 60
|
--progressbox "Copying live image to target rootfs." 5 60
|
||||||
|
@ -179,7 +179,7 @@ if [ "$PLATFORM" = "beaglebone" ]; then
|
|||||||
touch $ROOTFSDIR/boot/uEnv.txt
|
touch $ROOTFSDIR/boot/uEnv.txt
|
||||||
umount $ROOTFSDIR/boot
|
umount $ROOTFSDIR/boot
|
||||||
fi
|
fi
|
||||||
tar xfp $ROOTFS_TARBALL -C $ROOTFSDIR
|
tar xfp $ROOTFS_TARBALL --xattrs --xattrs-include='*' -C $ROOTFSDIR
|
||||||
|
|
||||||
fspassno="1"
|
fspassno="1"
|
||||||
if [ "$ROOT_FSTYPE" = "f2fs" ]; then
|
if [ "$ROOT_FSTYPE" = "f2fs" ]; then
|
||||||
|
@ -69,9 +69,11 @@ mount_pseudofs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
umount_pseudofs() {
|
umount_pseudofs() {
|
||||||
for f in dev proc sys; do
|
if [ -d "${rootfs}" ]; then
|
||||||
umount -f $rootfs/$f >/dev/null 2>&1
|
for f in dev proc sys; do
|
||||||
done
|
umount -f $rootfs/$f >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_cmd_target() {
|
run_cmd_target() {
|
||||||
@ -192,7 +194,7 @@ fi
|
|||||||
#
|
#
|
||||||
# Check if package base-system is available.
|
# Check if package base-system is available.
|
||||||
#
|
#
|
||||||
rootfs=$(mktemp -d || die "FATAL: failed to create tempdir, exiting...")
|
rootfs=$(mktemp -d) || die "failed to create tempdir, exiting..."
|
||||||
mkdir -p $rootfs/var/db/xbps/keys
|
mkdir -p $rootfs/var/db/xbps/keys
|
||||||
cp keys/*.plist $rootfs/var/db/xbps/keys
|
cp keys/*.plist $rootfs/var/db/xbps/keys
|
||||||
|
|
||||||
@ -264,7 +266,7 @@ if [ -n "${_ARCH}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tarball=void-${PLATFORM}-rootfs-$(date '+%Y%m%d').tar.xz
|
tarball=void-${PLATFORM}-rootfs-$(date '+%Y%m%d').tar.xz
|
||||||
run_cmd "tar -cp --posix -C $rootfs . | xz -T0 -9 > $tarball "
|
run_cmd "tar -cp --posix --xattrs -C $rootfs . | xz -T0 -9 > $tarball "
|
||||||
|
|
||||||
rm -rf $rootfs
|
rm -rf $rootfs
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user