summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaximilian attems <maks@debian.org>2006-09-12 09:29:44 +0200
committermaximilian attems <maks@debian.org>2006-09-12 09:29:44 +0200
commit773f7f37a7a28977409e1369ae284d4ccc03812a (patch)
treec8713f95d04a58a690db65049822c6b9a4f9246d
parentcf4bba337d69510c4551ba84e8c69562873ea93f (diff)
- check for ro /boot
- allow -k all for all modes and more feedback on deleting - small whitespace cleanup
-rw-r--r--HACKING1
-rw-r--r--break.txt4
-rw-r--r--debian/changelog18
-rwxr-xr-xupdate-initramfs69
-rw-r--r--update-initramfs.834
5 files changed, 91 insertions, 35 deletions
diff --git a/HACKING b/HACKING
index 2fd9136..d171c56 100644
--- a/HACKING
+++ b/HACKING
@@ -16,4 +16,3 @@ I hope this helps. I'll paste this text into a HACKING file on the hopes that s
Tks,
Jeff Bailey
-
diff --git a/break.txt b/break.txt
deleted file mode 100644
index 64ecf84..0000000
--- a/break.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ x${break} = xyes ]; then
- panic "Spawning shell within the initramfs"
-fi
-
diff --git a/debian/changelog b/debian/changelog
index 1f00b6d..6c06903 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+initramfs-tools (0.79) unstable; urgency=high
+
+ * update-initramfs: Allow create and delete to work on "all" kernelversions.
+ Fixes bug on update to pass all the specified optional args.
+ Thanks to Osamu Aoki <osamu@debian.org> for the patch. (closes: 360281)
+ Improve it to parse args once and also highlight 'all' on usage.
+
+ * update-initramfs.8: Document usage of "all" + add example section.
+
+ * update-initramfs: On update check if /boot is ro, warn and exit.
+ Thanks to Alexander Wirt <formorer@debian.org> to improve the awk snippet.
+
+ * update-initramfs: run_lilo don't return 1 if no lilo executable is there.
+ Thanks "Peter D. St. Onge" <pete.stonge@utoronto.ca> for the report.
+ (closes: 386999)
+
+ -- maximilian attems <maks@sternwelten.at> Mon, 11 Sep 2006 22:11:54 +0200
+
initramfs-tools (0.78) unstable; urgency=medium
* update-initramfs: Check in call_lilo() if /sbin/lilo is executable,
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
-
-
diff --git a/update-initramfs.8 b/update-initramfs.8
index fa1728a..871e9a5 100644
--- a/update-initramfs.8
+++ b/update-initramfs.8
@@ -1,10 +1,10 @@
-.TH UPDATE-INITRAMFS 8 "$Date: 2006/09/02" $" "" "update-initramfs manual"
+.TH UPDATE-INITRAMFS 8 "$Date: 2006/09/06" $" "" "update\-initramfs manual"
.SH NAME
-update-initramfs \- generate an initramfs image
+update\-initramfs \- generate an initramfs image
.SH SYNOPSIS
-.B update-initramfs
+.B update\-initramfs
.RB [ \-k
.IR version ]
.RB [ \-c ]
@@ -15,7 +15,7 @@ update-initramfs \- generate an initramfs image
.RB [ \-h ]
.SH DESCRIPTION
The
-.B update-initramfs
+.B update\-initramfs
script manages your initramfs images on your local box.
It keeps track of the existing initramfs archives in /boot.
There are three modes of operation create, update or delete.
@@ -29,8 +29,17 @@ happens in this early userspace.
.SH OPTIONS
.TP
\fB \-k \fI version
-Set the kernel version for whom the initramfs will be generated.
+Set the specific kernel version for whom the initramfs will be generated.
For example the output of uname -r for your currently running kernel.
+This argument is optional for update. The default is the latest kernel version.
+
+The use of "all" for the
+.I version
+string specifies
+.B update\-initramfs
+to execute the chosen action for all kernel versions, that are already known
+to
+.B update\-initramfs.
.TP
\fB \-c
@@ -60,7 +69,20 @@ Set an different bootdir for the image creation.
.TP
\fB \-h
Print a short help page describing the available options in
-.B update-initramfs.
+.B update\-initramfs.
+
+.SH EXAMPLES
+
+Update the initramfs of the newest kernel:
+
+.PP
+.B update\-initramfs -u
+
+
+Create the initramfs for a specific kernel:
+
+.PP
+.B update\-initramfs -c -k 2.6.18-1-686
.SH AUTHOR
The initramfs-tools are written by Jeff Bailey <jbailey@ubuntu.com>.