diff options
author | Michael Prokop <mika@debian.org> | 2010-06-08 12:38:33 +0200 |
---|---|---|
committer | Michael Prokop <mika@debian.org> | 2010-06-08 12:38:33 +0200 |
commit | 87c674055316c2938d37e92789a6041824844c0d (patch) | |
tree | 11c7e9f6de630d3bc72d1c5e7d9168f2ef2dd50e /mkinitramfs | |
parent | 66522c9547575495d2d36ee0f3d030ef502aeba6 (diff) | |
download | initramfs-tools-87c674055316c2938d37e92789a6041824844c0d.tar.gz initramfs-tools-87c674055316c2938d37e92789a6041824844c0d.zip |
mkinitramfs: warn if TMPDIR is mounted noexec + fall back to not cache run scripts then
If the TMPDIR (/tmp by default) is mounted with noexec
the user will notify several lines like:
/usr/sbin/mkinitramfs: 276: /tmp/mkinitramfs_Ck5cpl/scripts/init-top/all_generic_ide: Permission denied
To get rid of that the user can either point $TMPDIR to
a filesystem that's mounted with exec permission or
otherwise the cache_run_scripts() feature won't be
used. Notify user accordingly with a warning message.
[Closes: #576678]
Signed-off-by: Michael Prokop <mika@debian.org>
Diffstat (limited to 'mkinitramfs')
-rwxr-xr-x | mkinitramfs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/mkinitramfs b/mkinitramfs index 04eae42..baf69dd 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -164,6 +164,14 @@ fi DESTDIR="$(mktemp -d ${TMPDIR:-/tmp}/mkinitramfs_XXXXXX)" || exit 1 chmod 755 "${DESTDIR}" + +# do not execute cache_run_scripts() if mounted with noexec +NOEXEC="" +fs=$(df $DESTDIR | tail -1 | awk '{print $6}') +if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then + NOEXEC=1 +fi + __TMPCPIOGZ="$(mktemp ${TMPDIR:-/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1 DPKG_ARCH=`dpkg --print-architecture` @@ -277,9 +285,13 @@ run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks # cache boot run order -for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do - cache_run_scripts "${DESTDIR}" "/scripts/${b#./}" -done +if [ -n "$NOEXEC" ]; then + echo "Warning: TMPDIR is mounted noexec, will not cache run scripts." +else + for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do + cache_run_scripts "${DESTDIR}" "/scripts/${b#./}" + done +fi # generate module deps depmod -a -b "${DESTDIR}" ${version} |