[arch-projects] [mkinitcpio] [PATCH 1/4] init: avoid passing empty RD_TIMESTAMP variable
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- init | 1 - 1 file changed, 1 deletion(-) diff --git a/init b/init index 5c2d751..0f46475 100644 --- a/init +++ b/init @@ -81,7 +81,6 @@ rdlogger_stop exec env -i \ "TERM=$TERM" \ - "RD_TIMESTAMP=$RD_TIMESTAMP" \ /usr/bin/switch_root /new_root $init "$@" # vim: set ft=sh ts=4 sw=4 et: -- 1.8.4
Doing this oddly results in findmnt never stat(2)'ing the target directory, which might be problematic with stale NFS mounts and maybe autofs. Fixes FS#36629, I suppose. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/autodetect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/autodetect b/install/autodetect index d6e9e29..3710e68 100644 --- a/install/autodetect +++ b/install/autodetect @@ -37,7 +37,7 @@ build() { fi # detect filesystem for separate /usr - if usrfstype=$(findmnt -snero fstype --tab-file '/etc/fstab' /usr); then + if usrfstype=$(findmnt -snero fstype --tab-file '/etc/fstab' -T '/usr'); then add_if_avail "$usrfstype" fi -- 1.8.4
Using --tab-file for findmnt calls is redundant if we can rely on the defaults. Sanitize the environment from any LIBMOUNT_* variables so that we can be sure of what file we're reading. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/autodetect | 2 +- mkinitcpio | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/install/autodetect b/install/autodetect index 3710e68..b3db536 100644 --- a/install/autodetect +++ b/install/autodetect @@ -37,7 +37,7 @@ build() { fi # detect filesystem for separate /usr - if usrfstype=$(findmnt -snero fstype --tab-file '/etc/fstab' -T '/usr'); then + if usrfstype=$(findmnt -snero fstype -T '/usr'); then add_if_avail "$usrfstype" fi diff --git a/mkinitcpio b/mkinitcpio index 0ae6913..2d8c579 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -31,7 +31,8 @@ export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' # Sanitize environment further # GREP_OPTIONS="--color=always" will break everything # CDPATH can affect cd and pushd -unset GREP_OPTIONS CDPATH +# LIBMOUNT_* options can affect findmnt and other tools +unset GREP_OPTIONS CDPATH "${!LIBMOUNT_@}" usage() { cat <<EOF -- 1.8.4
Running as non-root is usually for my own dev purposes, but someone might do this and be surprised when a directory/file that needs permissions other than root isn't preserved. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkinitcpio b/mkinitcpio index 2d8c579..8139ee0 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -203,8 +203,12 @@ build_image() { ;; esac - cpio_opts=('-R' '0:0' '-0' '-o' '-H' 'newc') + cpio_opts=('-0' '-o' '-H' 'newc') (( _optquiet )) && cpio_opts+=('--quiet') + if (( EUID != 0 )); then + warning 'Not building as root, ownership cannot be preserved' + cpio_opts+=('-R' '0:0') + fi # write version stamp printf '%s' "$version" > "$BUILDROOT/VERSION" -- 1.8.4
participants (1)
-
Dave Reisner