From 98f2519febeed8cc9cfa9e9d11867c862b96335c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 8 Sep 2011 21:09:48 +0200 Subject: [PATCH] Adding upstream version 3.0~a21. --- Makefile | 32 +++++------ VERSION | 2 +- hooks/live | 7 +++ manpages/de/live-boot.de.7 | 7 ++- manpages/de/live-snapshot.de.1 | 2 +- manpages/en/live-boot.7 | 4 +- manpages/en/live-snapshot.1 | 2 +- manpages/po/de/live-boot.7.po | 113 +++++++++++++++++++++---------------- manpages/po/de/live-snapshot.1.po | 48 ++++++++-------- manpages/pot/live-boot.7.pot | 107 ++++++++++++++++++++--------------- manpages/pot/live-snapshot.1.pot | 42 +++++++------- scripts/live | 81 +++++++++++++------------- scripts/live-bottom/10validateroot | 29 ++++++++++ scripts/live-helpers | 97 ++++++++++++++++++++++++++++++- 14 files changed, 371 insertions(+), 202 deletions(-) create mode 100755 scripts/live-bottom/10validateroot diff --git a/Makefile b/Makefile index a2ab1b9..ec67501 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ install: uninstall: # Uninstalling executables rm -f $(DESTDIR)/sbin/live-snapshot $(DESTDIR)/sbin/live-swapfile - rmdir --ignore-fail-on-non-empty $(DESTDIR)/sbin || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/sbin > /dev/null 2>&1 || true rm -rf $(DESTDIR)/usr/share/live-boot @@ -86,18 +86,18 @@ uninstall: rm -rf $(DESTDIR)/usr/share/initramfs-tools/scripts/live* rm -f $(DESTDIR)/usr/share/initramfs-tools/scripts/local-top/live - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/hooks || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/scripts/local-top || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/scripts || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/hooks > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/scripts/local-top > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/scripts > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true # Uninstalling docs rm -rf $(DESTDIR)/usr/share/doc/live-boot - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/doc || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/doc > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true # Uninstalling manpages for MANPAGE in manpages/en/*; \ @@ -117,15 +117,15 @@ uninstall: for SECTION in $(ls manpages/en/* | awk -F. '{ print $2 }'); \ do \ - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/man$${SECTION} || true; \ - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/*/man$${SECTION} || true; \ + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/man$${SECTION} > /dev/null 2>&1 || true; \ + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/*/man$${SECTION} > /dev/null 2>&1 || true; \ done - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share || true - rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty $(DESTDIR) || true + rmdir --ignore-fail-on-non-empty $(DESTDIR) > /dev/null 2>&1 || true clean: @echo "Nothing to clean." diff --git a/VERSION b/VERSION index 75df682..bfac0ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0~a20 +3.0~a21 diff --git a/hooks/live b/hooks/live index 309c26f..c916381 100755 --- a/hooks/live +++ b/hooks/live @@ -42,6 +42,13 @@ fi # Handling live-boot +if [ ! -e /usr/share/live-boot ] +then + echo "W: live-boot-initramfs-tools (backend) installed without live-boot," + echo "W: this initramfs will *NOT* have live support." + exit 0 +fi + [ "${QUIET}" ] || echo -n " "core # Configuration if [ -e /usr/share/live-boot/languagelist ] diff --git a/manpages/de/live-boot.de.7 b/manpages/de/live-boot.de.7 index 8aa635a..6f75c47 100644 --- a/manpages/de/live-boot.de.7 +++ b/manpages/de/live-boot.de.7 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT 7 04.08.2011 3.0~a20 "Debian Live Projekt" +.TH LIVE\-BOOT 7 08.09.2011 3.0~a21 "Debian Live Projekt" .SH NAME \fBlive\-boot\fP \- System Boot Skripte @@ -187,6 +187,11 @@ files. This results in shorter boot times. If "cryptsetup" is specified, filesystems stored on Luks\-encrypted devices will be considered as well as others when searching for a persistence filesystem; the user will be prompted for any needed decryption passphrase. +.IP \fBpersistent\-media\fP={\fIremovable\fP|\fIremovable\-usb\fP} 4 +If you specify the keyword 'removable', live\-boot will try to find +persistent and snapshot partitions on removable media only. Note that if you +want to further restrict the media to usb mass storage only, you can use the +\&'removable\-usb' keyword. .IP \fBpersistent\-path\fP=\fIPATH\fP 4 live\-boot will look for persistency files in the root directory of a partition, with this parameter, the path can be configured so that you can diff --git a/manpages/de/live-snapshot.de.1 b/manpages/de/live-snapshot.de.1 index 2cecc1a..c43576b 100644 --- a/manpages/de/live-snapshot.de.1 +++ b/manpages/de/live-snapshot.de.1 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT 1 04.08.2011 3.0~a20 "Debian Live Projekt" +.TH LIVE\-BOOT 1 08.09.2011 3.0~a21 "Debian Live Projekt" .SH NAME \fBlive\-snapshot\fP \- simple script to ease persistence usage diff --git a/manpages/en/live-boot.7 b/manpages/en/live-boot.7 index 0a88d51..ee1d41d 100644 --- a/manpages/en/live-boot.7 +++ b/manpages/en/live-boot.7 @@ -1,4 +1,4 @@ -.TH LIVE\-BOOT 7 2011\-08\-04 3.0~a20 "Debian Live Project" +.TH LIVE\-BOOT 7 2011\-09\-08 3.0~a21 "Debian Live Project" .SH NAME \fBlive\-boot\fR \- System Boot Scripts @@ -112,6 +112,8 @@ live\-boot will look for persistent and snapshot partitions or files labeled "li If "nofiles" is specified, only filesystems with matching labels will be searched; no filesystems will be traversed looking for archives or image files. This results in shorter boot times. .br If "cryptsetup" is specified, filesystems stored on Luks\-encrypted devices will be considered as well as others when searching for a persistence filesystem; the user will be prompted for any needed decryption passphrase. +.IP "\fBpersistent\-media\fR={\fIremovable\fR|\fIremovable\-usb\fR}" 4 +If you specify the keyword 'removable', live\-boot will try to find persistent and snapshot partitions on removable media only. Note that if you want to further restrict the media to usb mass storage only, you can use the 'removable\-usb' keyword. .IP "\fBpersistent\-path\fR=\fIPATH\fR" 4 live\-boot will look for persistency files in the root directory of a partition, with this parameter, the path can be configured so that you can have multiple directories on the same partition to store persistency files. .IP "\fBpersistent\-subtext\fR=\fISUFFIX\fR" 4 diff --git a/manpages/en/live-snapshot.1 b/manpages/en/live-snapshot.1 index e3f666e..df98f8b 100644 --- a/manpages/en/live-snapshot.1 +++ b/manpages/en/live-snapshot.1 @@ -1,4 +1,4 @@ -.TH LIVE\-BOOT 1 2011\-08\-04 3.0~a20 "Debian Live Project" +.TH LIVE\-BOOT 1 2011\-09\-08 3.0~a21 "Debian Live Project" .SH NAME \fBlive\-snapshot\fR \- simple script to ease persistence usage diff --git a/manpages/po/de/live-boot.7.po b/manpages/po/de/live-boot.7.po index 8385acd..c851311 100644 --- a/manpages/po/de/live-boot.7.po +++ b/manpages/po/de/live-boot.7.po @@ -4,8 +4,8 @@ # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a20\n" -"POT-Creation-Date: 2011-08-04 21:20+0300\n" +"Project-Id-Version: live-boot 3.0~a21\n" +"POT-Creation-Date: 2011-09-08 21:05+0300\n" "PO-Revision-Date: 2010-05-24 12:34+0300\n" "Last-Translator: Daniel Baumann \n" "Language-Team: none\n" @@ -24,14 +24,14 @@ msgstr "LIVE-BOOT" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "2011-08-04" -msgstr "04.08.2011" +msgid "2011-09-08" +msgstr "08.09.2011" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "3.0~a20" -msgstr "3.0~a20" +msgid "3.0~a21" +msgstr "3.0~a21" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 @@ -590,11 +590,26 @@ msgstr "" #. type: IP #: en/live-boot.7:115 #, no-wrap +msgid "B={I|I}" +msgstr "" + +#. type: Plain text +#: en/live-boot.7:117 +msgid "" +"If you specify the keyword 'removable', live-boot will try to find " +"persistent and snapshot partitions on removable media only. Note that if you " +"want to further restrict the media to usb mass storage only, you can use the " +"'removable-usb' keyword." +msgstr "" + +#. type: IP +#: en/live-boot.7:117 +#, no-wrap msgid "B=I" msgstr "B=I" #. type: Plain text -#: en/live-boot.7:117 +#: en/live-boot.7:119 msgid "" "live-boot will look for persistency files in the root directory of a " "partition, with this parameter, the path can be configured so that you can " @@ -602,13 +617,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:117 +#: en/live-boot.7:119 #, no-wrap msgid "B=I" msgstr "B=I" #. type: Plain text -#: en/live-boot.7:119 +#: en/live-boot.7:121 msgid "" "Add a suffix when searching for the image filenames or partition labels to " "use for the above mentioned persistent feature, the SUFFIX will be added " @@ -618,26 +633,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:119 +#: en/live-boot.7:121 #, no-wrap msgid "{B|B}=I" msgstr "{B|B}=I" #. type: Plain text -#: en/live-boot.7:121 +#: en/live-boot.7:123 msgid "" "A path to a file present on the rootfs could be used to preseed debconf " "database." msgstr "" #. type: IP -#: en/live-boot.7:121 +#: en/live-boot.7:123 #, no-wrap msgid "B=I" msgstr "B=I" #. type: Plain text -#: en/live-boot.7:123 +#: en/live-boot.7:125 msgid "" "All debian installed packages could be preseeded from command-line that way, " "beware of blanks spaces, they will interfere with parsing, use a preseed " @@ -645,26 +660,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:123 +#: en/live-boot.7:125 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:125 +#: en/live-boot.7:127 msgid "" "This option causes live-boot to reboot without attempting to eject the media " "and without asking the user to remove the boot media." msgstr "" #. type: IP -#: en/live-boot.7:125 +#: en/live-boot.7:127 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:127 +#: en/live-boot.7:129 msgid "" "This parameter will make live-boot to show on \"/\" the ro filesystems " "(mostly compressed) on \"/live\". This is not enabled by default because " @@ -673,26 +688,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:127 +#: en/live-boot.7:129 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:129 +#: en/live-boot.7:131 msgid "" "If you boot with the normal quiet parameter, live-boot hides most messages " "of its own. When adding silent, it hides all." msgstr "" #. type: IP -#: en/live-boot.7:129 +#: en/live-boot.7:131 #, no-wrap msgid "B=I" msgstr "B=I" #. type: Plain text -#: en/live-boot.7:131 +#: en/live-boot.7:133 msgid "" "Adding this parameter, live-boot will try to copy the entire read-only media " "to the specified device before mounting the root filesystem. It probably " @@ -702,13 +717,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:131 +#: en/live-boot.7:133 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:133 +#: en/live-boot.7:135 msgid "" "Adding this parameter, live-boot will try to copy the whole read-only media " "to the computer's RAM before mounting the root filesystem. This could need a " @@ -716,14 +731,14 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:133 +#: en/live-boot.7:135 #, no-wrap msgid "B=aufs|unionfs" msgstr "B=aufs|unionfs" #. FIXME #. type: Plain text -#: en/live-boot.7:136 +#: en/live-boot.7:138 msgid "" "By default, live-boot uses aufs. With this parameter, you can switch to " "unionfs." @@ -731,32 +746,32 @@ msgstr "" #. FIXME #. type: SH -#: en/live-boot.7:138 +#: en/live-boot.7:140 #, no-wrap msgid "FILES (old)" msgstr "" #. type: IP -#: en/live-boot.7:139 en/live-snapshot.1:43 +#: en/live-boot.7:141 en/live-snapshot.1:43 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 msgid "" "Some variables can be configured via this config file (inside the live " "system)." msgstr "" #. type: IP -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 msgid "" "This optional file (inside the live media) contains a list of white-space or " "carriage-return-separated file names corresponding to disk images in the \"/" @@ -769,13 +784,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:145 en/live-snapshot.1:49 +#: en/live-boot.7:147 en/live-snapshot.1:49 msgid "" "This optional file (which resides in the rootfs system, not in the live " "media) is used as a list of directories which not need be persistent: ie. " @@ -784,7 +799,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/live-boot.7:148 en/live-snapshot.1:51 +#: en/live-boot.7:150 en/live-snapshot.1:51 msgid "" "This saves expensive writes and speeds up operations on volatile data such " "as web caches and temporary files (like e.g. /tmp and .mozilla) which are " @@ -793,69 +808,69 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:149 en/live-snapshot.1:42 +#: en/live-boot.7:151 en/live-snapshot.1:42 #, no-wrap msgid "FILES" msgstr "DATEIEN" #. type: IP -#: en/live-boot.7:150 +#: en/live-boot.7:152 #, no-wrap msgid "B" msgstr "B" #. type: IP -#: en/live-boot.7:151 +#: en/live-boot.7:153 #, no-wrap msgid "B" msgstr "B" #. type: IP -#: en/live-boot.7:152 +#: en/live-boot.7:154 #, no-wrap msgid "B" msgstr "B" #. type: IP -#: en/live-boot.7:153 +#: en/live-boot.7:155 #, no-wrap msgid "B" msgstr "B" #. type: SH -#: en/live-boot.7:155 en/live-snapshot.1:54 +#: en/live-boot.7:157 en/live-snapshot.1:54 #, no-wrap msgid "SEE ALSO" msgstr "SIEHE AUCH" #. type: Plain text -#: en/live-boot.7:157 +#: en/live-boot.7:159 msgid "I(1)" msgstr "I(1)" #. type: Plain text -#: en/live-boot.7:159 en/live-snapshot.1:58 +#: en/live-boot.7:161 en/live-snapshot.1:58 msgid "I(7)" msgstr "I(7)" #. type: Plain text -#: en/live-boot.7:161 en/live-snapshot.1:60 +#: en/live-boot.7:163 en/live-snapshot.1:60 msgid "I(7)" msgstr "I(7)" #. type: Plain text -#: en/live-boot.7:163 en/live-snapshot.1:62 +#: en/live-boot.7:165 en/live-snapshot.1:62 msgid "I(7)" msgstr "I(7)" #. type: SH -#: en/live-boot.7:164 en/live-snapshot.1:63 +#: en/live-boot.7:166 en/live-snapshot.1:63 #, no-wrap msgid "HOMEPAGE" msgstr "HOMEPAGE" #. type: Plain text -#: en/live-boot.7:166 en/live-snapshot.1:65 +#: en/live-boot.7:168 en/live-snapshot.1:65 msgid "" "More information about live-boot and the Debian Live project can be found on " "the homepage at EIE and in the manual at " @@ -866,13 +881,13 @@ msgstr "" "unter EIE gefunden werden." #. type: SH -#: en/live-boot.7:167 en/live-snapshot.1:66 +#: en/live-boot.7:169 en/live-snapshot.1:66 #, no-wrap msgid "BUGS" msgstr "FEHLER" #. type: Plain text -#: en/live-boot.7:169 en/live-snapshot.1:68 +#: en/live-boot.7:171 en/live-snapshot.1:68 msgid "" "Bugs can be reported by submitting a bugreport for the live-boot package in " "the Debian Bug Tracking System at EIE or by " @@ -886,13 +901,13 @@ msgstr "" "werden." #. type: SH -#: en/live-boot.7:170 en/live-snapshot.1:69 +#: en/live-boot.7:172 en/live-snapshot.1:69 #, no-wrap msgid "AUTHOR" msgstr "AUTOR" #. type: Plain text -#: en/live-boot.7:171 en/live-snapshot.1:70 +#: en/live-boot.7:173 en/live-snapshot.1:70 msgid "" "live-boot was written by Daniel Baumann EIE for " "the Debian project." diff --git a/manpages/po/de/live-snapshot.1.po b/manpages/po/de/live-snapshot.1.po index ba42ad3..bff78ca 100644 --- a/manpages/po/de/live-snapshot.1.po +++ b/manpages/po/de/live-snapshot.1.po @@ -4,8 +4,8 @@ # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a20\n" -"POT-Creation-Date: 2011-08-04 21:20+0300\n" +"Project-Id-Version: live-boot 3.0~a21\n" +"POT-Creation-Date: 2011-09-08 21:05+0300\n" "PO-Revision-Date: 2010-05-24 12:34+0300\n" "Last-Translator: Daniel Baumann \n" "Language-Team: none\n" @@ -24,14 +24,14 @@ msgstr "LIVE-BOOT" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "2011-08-04" -msgstr "04.08.2011" +msgid "2011-09-08" +msgstr "08.09.2011" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "3.0~a20" -msgstr "3.0~a20" +msgid "3.0~a21" +msgstr "3.0~a21" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 @@ -58,26 +58,26 @@ msgid "OPTIONS" msgstr "OPTIONEN" #. type: IP -#: en/live-boot.7:139 en/live-snapshot.1:43 +#: en/live-boot.7:141 en/live-snapshot.1:43 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 msgid "" "Some variables can be configured via this config file (inside the live " "system)." msgstr "" #. type: IP -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 msgid "" "This optional file (inside the live media) contains a list of white-space or " "carriage-return-separated file names corresponding to disk images in the \"/" @@ -90,13 +90,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 #, no-wrap msgid "B" msgstr "B" #. type: Plain text -#: en/live-boot.7:145 en/live-snapshot.1:49 +#: en/live-boot.7:147 en/live-snapshot.1:49 msgid "" "This optional file (which resides in the rootfs system, not in the live " "media) is used as a list of directories which not need be persistent: ie. " @@ -105,7 +105,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/live-boot.7:148 en/live-snapshot.1:51 +#: en/live-boot.7:150 en/live-snapshot.1:51 msgid "" "This saves expensive writes and speeds up operations on volatile data such " "as web caches and temporary files (like e.g. /tmp and .mozilla) which are " @@ -114,40 +114,40 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:149 en/live-snapshot.1:42 +#: en/live-boot.7:151 en/live-snapshot.1:42 #, no-wrap msgid "FILES" msgstr "DATEIEN" #. type: SH -#: en/live-boot.7:155 en/live-snapshot.1:54 +#: en/live-boot.7:157 en/live-snapshot.1:54 #, no-wrap msgid "SEE ALSO" msgstr "SIEHE AUCH" #. type: Plain text -#: en/live-boot.7:159 en/live-snapshot.1:58 +#: en/live-boot.7:161 en/live-snapshot.1:58 msgid "I(7)" msgstr "I(7)" #. type: Plain text -#: en/live-boot.7:161 en/live-snapshot.1:60 +#: en/live-boot.7:163 en/live-snapshot.1:60 msgid "I(7)" msgstr "I(7)" #. type: Plain text -#: en/live-boot.7:163 en/live-snapshot.1:62 +#: en/live-boot.7:165 en/live-snapshot.1:62 msgid "I(7)" msgstr "I(7)" #. type: SH -#: en/live-boot.7:164 en/live-snapshot.1:63 +#: en/live-boot.7:166 en/live-snapshot.1:63 #, no-wrap msgid "HOMEPAGE" msgstr "HOMEPAGE" #. type: Plain text -#: en/live-boot.7:166 en/live-snapshot.1:65 +#: en/live-boot.7:168 en/live-snapshot.1:65 msgid "" "More information about live-boot and the Debian Live project can be found on " "the homepage at EIE and in the manual at " @@ -158,13 +158,13 @@ msgstr "" "unter EIE gefunden werden." #. type: SH -#: en/live-boot.7:167 en/live-snapshot.1:66 +#: en/live-boot.7:169 en/live-snapshot.1:66 #, no-wrap msgid "BUGS" msgstr "FEHLER" #. type: Plain text -#: en/live-boot.7:169 en/live-snapshot.1:68 +#: en/live-boot.7:171 en/live-snapshot.1:68 msgid "" "Bugs can be reported by submitting a bugreport for the live-boot package in " "the Debian Bug Tracking System at EIE or by " @@ -178,13 +178,13 @@ msgstr "" "werden." #. type: SH -#: en/live-boot.7:170 en/live-snapshot.1:69 +#: en/live-boot.7:172 en/live-snapshot.1:69 #, no-wrap msgid "AUTHOR" msgstr "AUTOR" #. type: Plain text -#: en/live-boot.7:171 en/live-snapshot.1:70 +#: en/live-boot.7:173 en/live-snapshot.1:70 msgid "" "live-boot was written by Daniel Baumann EIE for " "the Debian project." diff --git a/manpages/pot/live-boot.7.pot b/manpages/pot/live-boot.7.pot index bb1395e..97d3f15 100644 --- a/manpages/pot/live-boot.7.pot +++ b/manpages/pot/live-boot.7.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: live-boot VERSION\n" -"POT-Creation-Date: 2011-08-04 21:20+0300\n" +"POT-Creation-Date: 2011-09-08 21:05+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "2011-08-04" +msgid "2011-09-08" msgstr "" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "3.0~a20" +msgid "3.0~a21" msgstr "" #. type: TH @@ -585,25 +585,40 @@ msgstr "" #. type: IP #: en/live-boot.7:115 #, no-wrap -msgid "B=I" +msgid "B={I|I}" msgstr "" #. type: Plain text #: en/live-boot.7:117 msgid "" +"If you specify the keyword 'removable', live-boot will try to find " +"persistent and snapshot partitions on removable media only. Note that if you " +"want to further restrict the media to usb mass storage only, you can use the " +"'removable-usb' keyword." +msgstr "" + +#. type: IP +#: en/live-boot.7:117 +#, no-wrap +msgid "B=I" +msgstr "" + +#. type: Plain text +#: en/live-boot.7:119 +msgid "" "live-boot will look for persistency files in the root directory of a " "partition, with this parameter, the path can be configured so that you can " "have multiple directories on the same partition to store persistency files." msgstr "" #. type: IP -#: en/live-boot.7:117 +#: en/live-boot.7:119 #, no-wrap msgid "B=I" msgstr "" #. type: Plain text -#: en/live-boot.7:119 +#: en/live-boot.7:121 msgid "" "Add a suffix when searching for the image filenames or partition labels to " "use for the above mentioned persistent feature, the SUFFIX will be added " @@ -613,26 +628,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:119 +#: en/live-boot.7:121 #, no-wrap msgid "{B|B}=I" msgstr "" #. type: Plain text -#: en/live-boot.7:121 +#: en/live-boot.7:123 msgid "" "A path to a file present on the rootfs could be used to preseed debconf " "database." msgstr "" #. type: IP -#: en/live-boot.7:121 +#: en/live-boot.7:123 #, no-wrap msgid "B=I" msgstr "" #. type: Plain text -#: en/live-boot.7:123 +#: en/live-boot.7:125 msgid "" "All debian installed packages could be preseeded from command-line that way, " "beware of blanks spaces, they will interfere with parsing, use a preseed " @@ -640,26 +655,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:123 +#: en/live-boot.7:125 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:125 +#: en/live-boot.7:127 msgid "" "This option causes live-boot to reboot without attempting to eject the media " "and without asking the user to remove the boot media." msgstr "" #. type: IP -#: en/live-boot.7:125 +#: en/live-boot.7:127 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:127 +#: en/live-boot.7:129 msgid "" "This parameter will make live-boot to show on \"/\" the ro filesystems " "(mostly compressed) on \"/live\". This is not enabled by default because " @@ -668,26 +683,26 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:127 +#: en/live-boot.7:129 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:129 +#: en/live-boot.7:131 msgid "" "If you boot with the normal quiet parameter, live-boot hides most messages " "of its own. When adding silent, it hides all." msgstr "" #. type: IP -#: en/live-boot.7:129 +#: en/live-boot.7:131 #, no-wrap msgid "B=I" msgstr "" #. type: Plain text -#: en/live-boot.7:131 +#: en/live-boot.7:133 msgid "" "Adding this parameter, live-boot will try to copy the entire read-only media " "to the specified device before mounting the root filesystem. It probably " @@ -697,13 +712,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:131 +#: en/live-boot.7:133 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:133 +#: en/live-boot.7:135 msgid "" "Adding this parameter, live-boot will try to copy the whole read-only media " "to the computer's RAM before mounting the root filesystem. This could need a " @@ -711,14 +726,14 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:133 +#: en/live-boot.7:135 #, no-wrap msgid "B=aufs|unionfs" msgstr "" #. FIXME #. type: Plain text -#: en/live-boot.7:136 +#: en/live-boot.7:138 msgid "" "By default, live-boot uses aufs. With this parameter, you can switch to " "unionfs." @@ -726,32 +741,32 @@ msgstr "" #. FIXME #. type: SH -#: en/live-boot.7:138 +#: en/live-boot.7:140 #, no-wrap msgid "FILES (old)" msgstr "" #. type: IP -#: en/live-boot.7:139 en/live-snapshot.1:43 +#: en/live-boot.7:141 en/live-snapshot.1:43 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 msgid "" "Some variables can be configured via this config file (inside the live " "system)." msgstr "" #. type: IP -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 msgid "" "This optional file (inside the live media) contains a list of white-space or " "carriage-return-separated file names corresponding to disk images in the \"/" @@ -764,13 +779,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:145 en/live-snapshot.1:49 +#: en/live-boot.7:147 en/live-snapshot.1:49 msgid "" "This optional file (which resides in the rootfs system, not in the live " "media) is used as a list of directories which not need be persistent: ie. " @@ -779,7 +794,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/live-boot.7:148 en/live-snapshot.1:51 +#: en/live-boot.7:150 en/live-snapshot.1:51 msgid "" "This saves expensive writes and speeds up operations on volatile data such " "as web caches and temporary files (like e.g. /tmp and .mozilla) which are " @@ -788,69 +803,69 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:149 en/live-snapshot.1:42 +#: en/live-boot.7:151 en/live-snapshot.1:42 #, no-wrap msgid "FILES" msgstr "" #. type: IP -#: en/live-boot.7:150 +#: en/live-boot.7:152 #, no-wrap msgid "B" msgstr "" #. type: IP -#: en/live-boot.7:151 +#: en/live-boot.7:153 #, no-wrap msgid "B" msgstr "" #. type: IP -#: en/live-boot.7:152 +#: en/live-boot.7:154 #, no-wrap msgid "B" msgstr "" #. type: IP -#: en/live-boot.7:153 +#: en/live-boot.7:155 #, no-wrap msgid "B" msgstr "" #. type: SH -#: en/live-boot.7:155 en/live-snapshot.1:54 +#: en/live-boot.7:157 en/live-snapshot.1:54 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text -#: en/live-boot.7:157 +#: en/live-boot.7:159 msgid "I(1)" msgstr "" #. type: Plain text -#: en/live-boot.7:159 en/live-snapshot.1:58 +#: en/live-boot.7:161 en/live-snapshot.1:58 msgid "I(7)" msgstr "" #. type: Plain text -#: en/live-boot.7:161 en/live-snapshot.1:60 +#: en/live-boot.7:163 en/live-snapshot.1:60 msgid "I(7)" msgstr "" #. type: Plain text -#: en/live-boot.7:163 en/live-snapshot.1:62 +#: en/live-boot.7:165 en/live-snapshot.1:62 msgid "I(7)" msgstr "" #. type: SH -#: en/live-boot.7:164 en/live-snapshot.1:63 +#: en/live-boot.7:166 en/live-snapshot.1:63 #, no-wrap msgid "HOMEPAGE" msgstr "" #. type: Plain text -#: en/live-boot.7:166 en/live-snapshot.1:65 +#: en/live-boot.7:168 en/live-snapshot.1:65 msgid "" "More information about live-boot and the Debian Live project can be found on " "the homepage at EIE and in the manual at " @@ -858,13 +873,13 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:167 en/live-snapshot.1:66 +#: en/live-boot.7:169 en/live-snapshot.1:66 #, no-wrap msgid "BUGS" msgstr "" #. type: Plain text -#: en/live-boot.7:169 en/live-snapshot.1:68 +#: en/live-boot.7:171 en/live-snapshot.1:68 msgid "" "Bugs can be reported by submitting a bugreport for the live-boot package in " "the Debian Bug Tracking System at EIE or by " @@ -873,13 +888,13 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:170 en/live-snapshot.1:69 +#: en/live-boot.7:172 en/live-snapshot.1:69 #, no-wrap msgid "AUTHOR" msgstr "" #. type: Plain text -#: en/live-boot.7:171 en/live-snapshot.1:70 +#: en/live-boot.7:173 en/live-snapshot.1:70 msgid "" "live-boot was written by Daniel Baumann EIE for " "the Debian project." diff --git a/manpages/pot/live-snapshot.1.pot b/manpages/pot/live-snapshot.1.pot index 2c70d27..cf17e29 100644 --- a/manpages/pot/live-snapshot.1.pot +++ b/manpages/pot/live-snapshot.1.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: live-boot VERSION\n" -"POT-Creation-Date: 2011-08-04 21:20+0300\n" +"POT-Creation-Date: 2011-09-08 21:05+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "2011-08-04" +msgid "2011-09-08" msgstr "" #. type: TH #: en/live-boot.7:1 en/live-snapshot.1:1 #, no-wrap -msgid "3.0~a20" +msgid "3.0~a21" msgstr "" #. type: TH @@ -59,26 +59,26 @@ msgid "OPTIONS" msgstr "" #. type: IP -#: en/live-boot.7:139 en/live-snapshot.1:43 +#: en/live-boot.7:141 en/live-snapshot.1:43 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 msgid "" "Some variables can be configured via this config file (inside the live " "system)." msgstr "" #. type: IP -#: en/live-boot.7:141 en/live-snapshot.1:45 +#: en/live-boot.7:143 en/live-snapshot.1:45 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 msgid "" "This optional file (inside the live media) contains a list of white-space or " "carriage-return-separated file names corresponding to disk images in the \"/" @@ -91,13 +91,13 @@ msgid "" msgstr "" #. type: IP -#: en/live-boot.7:143 en/live-snapshot.1:47 +#: en/live-boot.7:145 en/live-snapshot.1:47 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: en/live-boot.7:145 en/live-snapshot.1:49 +#: en/live-boot.7:147 en/live-snapshot.1:49 msgid "" "This optional file (which resides in the rootfs system, not in the live " "media) is used as a list of directories which not need be persistent: ie. " @@ -106,7 +106,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/live-boot.7:148 en/live-snapshot.1:51 +#: en/live-boot.7:150 en/live-snapshot.1:51 msgid "" "This saves expensive writes and speeds up operations on volatile data such " "as web caches and temporary files (like e.g. /tmp and .mozilla) which are " @@ -115,40 +115,40 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:149 en/live-snapshot.1:42 +#: en/live-boot.7:151 en/live-snapshot.1:42 #, no-wrap msgid "FILES" msgstr "" #. type: SH -#: en/live-boot.7:155 en/live-snapshot.1:54 +#: en/live-boot.7:157 en/live-snapshot.1:54 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text -#: en/live-boot.7:159 en/live-snapshot.1:58 +#: en/live-boot.7:161 en/live-snapshot.1:58 msgid "I(7)" msgstr "" #. type: Plain text -#: en/live-boot.7:161 en/live-snapshot.1:60 +#: en/live-boot.7:163 en/live-snapshot.1:60 msgid "I(7)" msgstr "" #. type: Plain text -#: en/live-boot.7:163 en/live-snapshot.1:62 +#: en/live-boot.7:165 en/live-snapshot.1:62 msgid "I(7)" msgstr "" #. type: SH -#: en/live-boot.7:164 en/live-snapshot.1:63 +#: en/live-boot.7:166 en/live-snapshot.1:63 #, no-wrap msgid "HOMEPAGE" msgstr "" #. type: Plain text -#: en/live-boot.7:166 en/live-snapshot.1:65 +#: en/live-boot.7:168 en/live-snapshot.1:65 msgid "" "More information about live-boot and the Debian Live project can be found on " "the homepage at EIE and in the manual at " @@ -156,13 +156,13 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:167 en/live-snapshot.1:66 +#: en/live-boot.7:169 en/live-snapshot.1:66 #, no-wrap msgid "BUGS" msgstr "" #. type: Plain text -#: en/live-boot.7:169 en/live-snapshot.1:68 +#: en/live-boot.7:171 en/live-snapshot.1:68 msgid "" "Bugs can be reported by submitting a bugreport for the live-boot package in " "the Debian Bug Tracking System at EIE or by " @@ -171,13 +171,13 @@ msgid "" msgstr "" #. type: SH -#: en/live-boot.7:170 en/live-snapshot.1:69 +#: en/live-boot.7:172 en/live-snapshot.1:69 #, no-wrap msgid "AUTHOR" msgstr "" #. type: Plain text -#: en/live-boot.7:171 en/live-snapshot.1:70 +#: en/live-boot.7:173 en/live-snapshot.1:70 msgid "" "live-boot was written by Daniel Baumann EIE for " "the Debian project." diff --git a/scripts/live b/scripts/live index 82f5413..5fb8a26 100755 --- a/scripts/live +++ b/scripts/live @@ -253,6 +253,11 @@ Arguments () export PERSISTENT ;; + persistent-media=*) + PERSISTENT_MEDIA="${ARGUMENT#*=}" + export PERSISTENT_MEDIA + ;; + persistent-path=*) PERSISTENT_PATH="${ARGUMENT#persistent-path=}" export PERSISTENT_PATH @@ -1033,16 +1038,17 @@ find_snap () # Look for ${snap_label}.* in block devices snap_label="${1}" black_listed_devices="${2}" + white_listed_devices="${3}" if [ "${PERSISTENT}" != "nofiles" ] then # search for image files - snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2" "${black_listed_devices}") + snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2" "${black_listed_devices}" "${white_listed_devices}") fi if [ -z "${snapdata}" ] then - snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}") + snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}" "${white_listed_devices}") fi echo "${snapdata}" } @@ -1323,6 +1329,7 @@ setup_unionfs () # Looking for "${root_persistence}" device or file if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ] then + if [ -z "${QUICKUSBMODULES}" ] then # Load USB modules @@ -1350,8 +1357,20 @@ setup_unionfs () done fi + case "${PERSISTENT_MEDIA}" in + removable) + whitelistdev="$(removable_dev)" + ;; + removable-usb) + whitelistdev="$(removable_usb_dev)" + ;; + *) + whitelistdev="" + ;; + esac + # search for label and files (this could be hugely optimized) - cowprobe=$(find_cow_device "${root_persistence}") + cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}") if [ -b "${cowprobe}" ] then # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots @@ -1363,17 +1382,17 @@ setup_unionfs () export PERSISTENCE_IS_ON fi # homecow just mount something on /home, this should be generalized some way - homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}") + homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}" "${whitelistdev}") if [ -b "${homecow}" ] then PERSISTENCE_IS_ON="1" export PERSISTENCE_IS_ON fi - root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}") + root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}" "${whitelistdev}") # This second type should be removed when snapshot will get smarter, # hence when "/etc/live-snapshot*list" will be supported also by # ext2|ext3|ext4|jffs2 snapshot types. - home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}") + home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}" "${whitelistdev}") if [ -b "${cowprobe}" ] then @@ -1664,7 +1683,7 @@ check_dev () echo ${mountpoint} return 0 else - umount ${mountpoint} + umount ${mountpoint} 2>/dev/null fi fi @@ -1692,38 +1711,29 @@ find_livefs () # first look at the one specified in the command line case "${LIVE_MEDIA}" in removable-usb) - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)") + for sysblock in $(removable_usb_dev "sys") do - if [ "$(cat ${sysblock}/removable)" = "1" ] - then - if readlink ${sysblock} | grep -q usb + for dev in $(subdevices "${sysblock}") + do + if check_dev "${dev}" then - for dev in $(subdevices "${sysblock}") - do - if check_dev "${dev}" - then - return 0 - fi - done + return 0 fi - fi + done done return 1 ;; removable) - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)") + for sysblock in $(removable_dev "sys") do - if [ "$(cat ${sysblock}/removable)" = "1" ] - then - for dev in $(subdevices "${sysblock}") - do - if check_dev "${dev}" - then - return 0 - fi - done - fi + for dev in $(subdevices "${sysblock}") + do + if check_dev "${dev}" + then + return 0 + fi + done done return 1 ;; @@ -1741,16 +1751,7 @@ find_livefs () # or do the scan of block devices # prefer removable devices over non-removable devices, so scan them first - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | egrep -v "/(loop|ram|dm-|fd)") - do - if [ "$(cat ${sysblock}/removable)" = "1" ] - then - removable_devices_to_scan="$removable_devices_to_scan $sysblock" - else - nonremovable_devices_to_scan="$nonremovable_devices_to_scan $sysblock" - fi - done - devices_to_scan="$removable_devices_to_scan $nonremovable_devices_to_scan" + devices_to_scan="$(removable_dev 'sys') $(non_removable_dev 'sys')" for sysblock in $devices_to_scan do diff --git a/scripts/live-bottom/10validateroot b/scripts/live-bottom/10validateroot new file mode 100755 index 0000000..d4d1620 --- /dev/null +++ b/scripts/live-bottom/10validateroot @@ -0,0 +1,29 @@ +#!/bin/sh + +# Error out in case a "wrong" file system was chosen. + +#set -e + +# initramfs-tools header + +PREREQ="" + +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + prereqs + exit 0 + ;; +esac + +. /scripts/live-functions +. /scripts/live-helpers + +if ! [ -d "/root/usr/share/live-boot" ] +then + panic "A wrong rootfs was mounted." +fi diff --git a/scripts/live-helpers b/scripts/live-helpers index 06bd186..73d9f9d 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -283,10 +283,13 @@ find_cow_device () { # Returns a device containing a partition labeled "${pers_label}" or containing a file named the same way # in the latter case the partition containing the file is left mounted - # if is not in black_listed_devices + # if is not in black_listed_devices. + # Additionally, if the white_listed_devices list is non-empty, the + # parent block device of the returned device must be part of this list. pers_label="${1}" cow_backing="/${pers_label}-backing" black_listed_devices="${2}" + white_listed_devices="${3}" if [ -z "${PERSISTENT_PATH}" ] then @@ -305,6 +308,15 @@ find_cow_device () break fi + if [ -n "${white_listed_devices}" ] + then + if echo "${white_listed_devices}" | grep -v -q -w "${fulldevname}" + then + # skip this device entirely + break + fi + fi + for dev in $(subdevices "${sysblock}") do devname=$(sys2dev "${dev}") @@ -383,11 +395,15 @@ find_cow_device () find_files () { # return the a string composed by device name, mountpoint an the first of ${filenames} found on a supported partition + # if is not in black_listed_devices. + # Additionally, if the white_listed_devices list is non-empty, the + # parent block device of the returned device must be part of this list. # FIXME: merge with above function filenames="${1}" snap_backing="/snap-backing" black_listed_devices="${2}" + white_listed_devices="${3}" for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd) do @@ -399,6 +415,15 @@ find_files () break fi + if [ -n "${white_listed_devices}" ] + then + if echo "${white_listed_devices}" | grep -v -q -w "${fulldevname}" + then + # skip this device entirely + break + fi + fi + for dev in $(subdevices "${sysblock}") do devname=$(sys2dev "${dev}") @@ -463,3 +488,73 @@ is_luks() fi } + +removable_dev () +{ + output_format="${1}" + want_usb="${2}" + ret= + + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)") + do + dev_ok= + if [ "$(cat ${sysblock}/removable)" = "1" ] + then + if [ -z "${want_usb}" ] + then + dev_ok="yes" + else + if readlink ${sysblock} | grep -q usb + then + dev_ok="yes" + fi + fi + fi + + if [ "${dev_ok}" = "yes" ] + then + case "${output_format}" in + sys) + ret="${ret} ${sysblock}" + ;; + *) + devname=$(sys2dev "${sysblock}") + ret="${ret} ${devname}" + ;; + esac + fi + done + + echo "${ret}" +} + +removable_usb_dev () +{ + output_format="${1}" + + removable_dev "${output_format}" "want_usb" +} + +non_removable_dev () +{ + output_format="${1}" + ret= + + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)") + do + if [ "$(cat ${sysblock}/removable)" = "0" ] + then + case "${output_format}" in + sys) + ret="${ret} ${sysblock}" + ;; + *) + devname=$(sys2dev "${sysblock}") + ret="${ret} ${devname}" + ;; + esac + fi + done + + echo "${ret}" +} -- 2.1.4