diff options
author | maximilian attems <maks@debian.org> | 2006-09-12 09:29:44 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2006-09-12 09:29:44 +0200 |
commit | 773f7f37a7a28977409e1369ae284d4ccc03812a (patch) | |
tree | c8713f95d04a58a690db65049822c6b9a4f9246d /update-initramfs | |
parent | cf4bba337d69510c4551ba84e8c69562873ea93f (diff) | |
download | initramfs-tools-773f7f37a7a28977409e1369ae284d4ccc03812a.tar.gz initramfs-tools-773f7f37a7a28977409e1369ae284d4ccc03812a.zip |
- check for ro /boot
- allow -k all for all modes and more feedback on deleting
- small whitespace cleanup
Diffstat (limited to 'update-initramfs')
-rwxr-xr-x | update-initramfs | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/update-initramfs b/update-initramfs index 5cd1e2e..fa6c837 100755 --- a/update-initramfs +++ b/update-initramfs @@ -15,7 +15,7 @@ usage() Usage: ${0} [OPTION]... Options: - -k [version] Specify kernel version or all + -k [version] Specify kernel version or 'all' -c Create a new initramfs -u Update an existing initramfs -d Remove an existing initramfs @@ -86,7 +86,7 @@ generate_initramfs() run_lilo() { if [ ! -x /sbin/lilo ]; then - return 1 + return 0 fi lilo -t > /dev/null if [ $? -eq 0 ]; then @@ -138,6 +138,17 @@ delete_sha1() rm -f "${STATEDIR}/${version}" } +# ro /boot is not modified +ro_boot_check() +{ + boot_opts=$(awk '/boot/{if (match($4, /ro/)) print "ro"}' /proc/mounts) + if [ -n "${boot_opts}" ]; then + echo "WARNING: /boot is ro mounted." + echo "update-initramfs: Not updating ${initramfs}" + exit 0 + fi +} + get_sorted_versions() { version_list="" @@ -236,27 +247,10 @@ update() exit 0 fi - if [ "${version}" = "all" ]; then - : FIXME check for --yes, and if not ask are you sure - get_sorted_versions - if [ -z "${version_list}" ]; then - verbose "Nothing to do, exiting." - exit 0 - fi - for u_version in ${version_list}; do - if [ "${verbose}" = "1" ]; then - vflag="-v" - fi - # Don't stop if one version doesn't work. - set +e - "${0}" -u -k "${u_version}" ${vflag} - set -e - done - exit 0 - fi - set_initramfs + ro_boot_check + altered_check generate_initramfs @@ -283,6 +277,8 @@ delete() altered_check + echo "update-initramfs: Deleting ${initramfs}" + delete_sha1 rm -f "${initramfs}" @@ -344,11 +340,38 @@ while getopts "k:cudyvtb:h?" flag; do done # Validate arguments - if [ -z "${mode}" ]; then usage "You must specify at least one of -c, -u, or -d." fi +if [ "${version}" = "all" ]; then + : FIXME check for --yes, and if not ask are you sure + get_sorted_versions + if [ -z "${version_list}" ]; then + verbose "Nothing to do, exiting." + exit 0 + fi + + OPTS="-b ${BOOTDIR}" + if [ "${verbose}" = "1" ]; then + OPTS="${OPTS} -v" + fi + if [ "${takeover}" = "1" ]; then + OPTS="${OPTS} -t" + fi + if [ "${yes}" = "1" ]; then + OPTS="${OPTS} -y" + fi + for u_version in ${version_list}; do + # Don't stop if one version doesn't work. + set +e + verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}" + "${0}" -${mode} -k "${u_version}" ${OPTS} + set -e + done + exit 0 +fi + case "${mode}" in c) create @@ -360,5 +383,3 @@ case "${mode}" in update ;; esac - - |