projects
/
live-boot-grml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removing pre-wheezy dpkg trigger for update-initramfs.
[live-boot-grml.git]
/
scripts
/
boot
/
misc-helpers.sh
diff --git
a/scripts/boot/misc-helpers.sh
b/scripts/boot/misc-helpers.sh
index
8970327
..
cc39fcb
100755
(executable)
--- a/
scripts/boot/misc-helpers.sh
+++ b/
scripts/boot/misc-helpers.sh
@@
-81,7
+81,6
@@
mount_images_in_directory ()
rootmnt="${2}"
mac="${3}"
rootmnt="${2}"
mac="${3}"
-
if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
@@
-377,7
+376,8
@@
really_export ()
eval export "${STRING}"="${VALUE}"
}
eval export "${STRING}"="${VALUE}"
}
-is_in_list_separator_helper () {
+is_in_list_separator_helper ()
+{
local sep=${1}
shift
local element=${1}
local sep=${1}
shift
local element=${1}
@@
-386,13
+386,15
@@
is_in_list_separator_helper () {
echo ${list} | grep -qe "^\(.*${sep}\)\?${element}\(${sep}.*\)\?$"
}
echo ${list} | grep -qe "^\(.*${sep}\)\?${element}\(${sep}.*\)\?$"
}
-is_in_space_sep_list () {
+is_in_space_sep_list ()
+{
local element=${1}
shift
is_in_list_separator_helper "[[:space:]]" "${element}" "${*}"
}
local element=${1}
shift
is_in_list_separator_helper "[[:space:]]" "${element}" "${*}"
}
-is_in_comma_sep_list () {
+is_in_comma_sep_list ()
+{
local element=${1}
shift
is_in_list_separator_helper "," "${element}" "${*}"
local element=${1}
shift
is_in_list_separator_helper "," "${element}" "${*}"
@@
-501,10
+503,11
@@
where_is_mounted ()
grep -m1 "^${device} " /proc/mounts | cut -f2 -d ' '
}
grep -m1 "^${device} " /proc/mounts | cut -f2 -d ' '
}
-trim_path () {
- # remove all unnecessary /:s in the path, including last one (except
- # if path is just "/")
- echo ${1} | sed 's|//\+|/|g' | sed 's|^\(.*[^/]\)/$|\1|'
+trim_path ()
+{
+ # remove all unnecessary /:s in the path, including last one (except
+ # if path is just "/")
+ echo ${1} | sed 's|//\+|/|g' | sed 's|^\(.*[^/]\)/$|\1|'
}
what_is_mounted_on ()
}
what_is_mounted_on ()
@@
-761,7
+764,8
@@
mount_persistence_media ()
return 0
}
return 0
}
-close_persistence_media () {
+close_persistence_media ()
+{
local device=${1}
local backing="$(where_is_mounted ${device})"
local device=${1}
local backing="$(where_is_mounted ${device})"
@@
-842,8
+846,7
@@
is_gpt_device ()
probe_for_gpt_name ()
{
local overlays="${1}"
probe_for_gpt_name ()
{
local overlays="${1}"
- local snapshots="${2}"
- local dev="${3}"
+ local dev="${2}"
local gpt_dev="${dev}"
if is_active_luks_mapping ${dev}
local gpt_dev="${dev}"
if is_active_luks_mapping ${dev}
@@
-859,7
+862,7
@@
probe_for_gpt_name ()
fi
local gpt_name=$(get_gpt_name ${gpt_dev})
fi
local gpt_name=$(get_gpt_name ${gpt_dev})
- for label in ${overlays}
${snapshots}
+ for label in ${overlays}
do
if [ "${gpt_name}" = "${label}" ]
then
do
if [ "${gpt_name}" = "${label}" ]
then
@@
-871,10
+874,9
@@
probe_for_gpt_name ()
probe_for_fs_label ()
{
local overlays="${1}"
probe_for_fs_label ()
{
local overlays="${1}"
- local snapshots="${2}"
- local dev="${3}"
+ local dev="${2}"
- for label in ${overlays}
${snapshots}
+ for label in ${overlays}
do
if [ "$(/sbin/blkid -s LABEL -o value $dev 2>/dev/null)" = "${label}" ]
then
do
if [ "$(/sbin/blkid -s LABEL -o value $dev 2>/dev/null)" = "${label}" ]
then
@@
-886,8
+888,7
@@
probe_for_fs_label ()
probe_for_file_name ()
{
local overlays="${1}"
probe_for_file_name ()
{
local overlays="${1}"
- local snapshots="${2}"
- local dev="${3}"
+ local dev="${2}"
local ret=""
local backing="$(mount_persistence_media ${dev} probe)"
local ret=""
local backing="$(mount_persistence_media ${dev} probe)"
@@
-905,17
+906,6
@@
probe_for_file_name ()
ret="${ret} ${label}=${loopdev}"
fi
done
ret="${ret} ${label}=${loopdev}"
fi
done
- for label in ${snapshots}
- do
- for ext in squashfs cpio.gz ext2 ext3 ext4 jffs2
- do
- path="${PERSISTENCE_PATH}${label}.${ext}"
- if [ -f "${backing}/${path}" ]
- then
- ret="${ret} ${label}=${dev}:${backing}:${path}"
- fi
- done
- done
if [ -n "${ret}" ]
then
if [ -n "${ret}" ]
then
@@
-927,19
+917,15
@@
probe_for_file_name ()
find_persistence_media ()
{
find_persistence_media ()
{
- # Scans devices for overlays
and snapshots
, and returns a whitespace
+ # Scans devices for overlays, and returns a whitespace
# separated list of how to use them. Only overlays with a partition
# separated list of how to use them. Only overlays with a partition
- # label or file name in ${overlays} are returned, and ditto for
- # snapshots with labels in ${snapshots}.
+ # label or file name in ${overlays} are returned.
#
# When scanning a LUKS device, the user will be asked to enter the
# passphrase; on failure to enter it, or if no persistence partitions
# or files were found, the LUKS device is closed.
#
#
# When scanning a LUKS device, the user will be asked to enter the
# passphrase; on failure to enter it, or if no persistence partitions
# or files were found, the LUKS device is closed.
#
- # For a snapshot file the return value is ${label}=${snapdata}", where
- # ${snapdata} is the parameter used for try_snap().
- #
- # For all other cases (overlay/snapshot partition and overlay file) the
+ # For all other cases (overlay partition and overlay file) the
# return value is "${label}=${device}", where ${device} a device that
# can mount the content. In the case of an overlay file, the device
# containing the file will remain mounted as a side-effect.
# return value is "${label}=${device}", where ${device} a device that
# can mount the content. In the case of an overlay file, the device
# containing the file will remain mounted as a side-effect.
@@
-949,8
+935,7
@@
find_persistence_media ()
# scanned.
local overlays="${1}"
# scanned.
local overlays="${1}"
- local snapshots="${2}"
- local white_listed_devices="${3}"
+ local white_listed_devices="${2}"
local ret=""
local black_listed_devices="$(what_is_mounted_on /live/image)"
local ret=""
local black_listed_devices="$(what_is_mounted_on /live/image)"
@@
-964,8
+949,7
@@
find_persistence_media ()
# in order to probe any filesystem it contains, like we do
# below. activate_custom_mounts() also depends on that any luks
# device already has been opened.
# in order to probe any filesystem it contains, like we do
# below. activate_custom_mounts() also depends on that any luks
# device already has been opened.
- if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && \
- is_luks_partition ${dev}
+ if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && is_luks_partition ${dev}
then
if luks_device=$(open_luks_device "${dev}")
then
then
if luks_device=$(open_luks_device "${dev}")
then
@@
-983,14
+967,14
@@
find_persistence_media ()
# Probe for matching GPT partition names or filesystem labels
if is_in_comma_sep_list filesystem ${PERSISTENCE_STORAGE}
then
# Probe for matching GPT partition names or filesystem labels
if is_in_comma_sep_list filesystem ${PERSISTENCE_STORAGE}
then
- result=$(probe_for_gpt_name "${overlays}"
"${snapshots}"
${dev})
+ result=$(probe_for_gpt_name "${overlays}" ${dev})
if [ -n "${result}" ]
then
ret="${ret} ${result}"
continue
fi
if [ -n "${result}" ]
then
ret="${ret} ${result}"
continue
fi
- result=$(probe_for_fs_label "${overlays}"
"${snapshots}"
${dev})
+ result=$(probe_for_fs_label "${overlays}" ${dev})
if [ -n "${result}" ]
then
ret="${ret} ${result}"
if [ -n "${result}" ]
then
ret="${ret} ${result}"
@@
-1001,7
+985,7
@@
find_persistence_media ()
# Probe for files with matching name on mounted partition
if is_in_comma_sep_list file ${PERSISTENCE_STORAGE}
then
# Probe for files with matching name on mounted partition
if is_in_comma_sep_list file ${PERSISTENCE_STORAGE}
then
- result=$(probe_for_file_name "${overlays}"
"${snapshots}"
${dev})
+ result=$(probe_for_file_name "${overlays}" ${dev})
if [ -n "${result}" ]
then
ret="${ret} ${result}"
if [ -n "${result}" ]
then
ret="${ret} ${result}"
@@
-1010,8
+994,7
@@
find_persistence_media ()
fi
# Close luks device if it isn't used
fi
# Close luks device if it isn't used
- if [ -z "${result}" ] && [ -n "${luks_device}" ] && \
- is_active_luks_mapping "${luks_device}"
+ if [ -z "${result}" ] && [ -n "${luks_device}" ] && is_active_luks_mapping "${luks_device}"
then
/sbin/cryptsetup luksClose "${luks_device}"
fi
then
/sbin/cryptsetup luksClose "${luks_device}"
fi
@@
-1053,7
+1036,8
@@
is_active_luks_mapping ()
/sbin/cryptsetup status "${device}" 1>/dev/null 2>&1
}
/sbin/cryptsetup status "${device}" 1>/dev/null 2>&1
}
-get_luks_backing_device () {
+get_luks_backing_device ()
+{
device=${1}
cryptsetup status ${device} 2> /dev/null | \
awk '{if ($1 == "device:") print $2}'
device=${1}
cryptsetup status ${device} 2> /dev/null | \
awk '{if ($1 == "device:") print $2}'
@@
-1150,7
+1134,9
@@
link_files ()
return
fi
return
fi
- find "${src_dir}" -mindepth 1 -maxdepth 1 | while read src; do
+ find "${src_dir}" -mindepth 1 -maxdepth 1 | \
+ while read src
+ do
local dest="${dest_dir}$(basename "${src}")"
if [ -d "${src}" ]
then
local dest="${dest_dir}$(basename "${src}")"
if [ -d "${src}" ]
then
@@
-1185,19
+1171,23
@@
do_union ()
local unionro1="${3}" # first underlying read-only branch (optional)
local unionro2="${4}" # second underlying read-only branch (optional)
local unionro1="${3}" # first underlying read-only branch (optional)
local unionro2="${4}" # second underlying read-only branch (optional)
- if [ "${UNIONTYPE}" = "aufs" ]
- then
- rw_opt="rw"
- ro_opt="rr+wh"
- noxino_opt="noxino"
- elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
- then
- rw_opt="RW"
- ro_opt="RO"
- else
- rw_opt="rw"
- ro_opt="ro"
- fi
+ case "${UNIONTYPE}" in
+ aufs)
+ rw_opt="rw"
+ ro_opt="rr+wh"
+ noxino_opt="noxino"
+ ;;
+
+ unionfs-fuse)
+ rw_opt="RW"
+ ro_opt="RO"
+ ;;
+
+ *)
+ rw_opt="rw"
+ ro_opt="ro"
+ ;;
+ esac
case "${UNIONTYPE}" in
unionfs-fuse)
case "${UNIONTYPE}" in
unionfs-fuse)