projects
/
live-boot-grml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding upstream version 1.110.4.
[live-boot-grml.git]
/
scripts
/
live-helpers
diff --git
a/scripts/live-helpers
b/scripts/live-helpers
index
9cf3b99
..
f49eaf7
100644
(file)
--- a/
scripts/live-helpers
+++ b/
scripts/live-helpers
@@
-1,16
+1,6
@@
#!/bin/sh
# live-initramfs helper functions, used by live-initramfs on boot and by live-snapshot
#!/bin/sh
# live-initramfs helper functions, used by live-initramfs on boot and by live-snapshot
-if [ "${BUILD_SYSTEM}" = "Ubuntu" ]
-then
- MP_QUIET="-Q"
-elif [ "${BUILD_SYSTEM}" = "Debian" ]
-then
- MP_QUIET="-q"
-else
- MP_QUIET=""
-fi
-
if [ ! -x "/bin/fstype" ]
then
# klibc not in path -> not in initramfs
if [ ! -x "/bin/fstype" ]
then
# klibc not in path -> not in initramfs
@@
-25,7
+15,7
@@
sys2dev ()
subdevices ()
{
subdevices ()
{
- sysblock=$
1
+ sysblock=$
{1}
r=""
for dev in "${sysblock}" "${sysblock}"/*
r=""
for dev in "${sysblock}" "${sysblock}"/*
@@
-44,25
+34,25
@@
get_fstype ()
local FSTYPE
local FSSIZE
local FSTYPE
local FSSIZE
- eval $(fstype < $
1
)
+ eval $(fstype < $
{1}
)
- if [ "$
FSTYPE
" != "unknown" ]
+ if [ "$
{FSTYPE}
" != "unknown" ]
then
then
- echo $
FSTYPE
+ echo $
{FSTYPE}
return 0
fi
return 0
fi
- /lib/udev/vol_id -t $
1
2>/dev/null
+ /lib/udev/vol_id -t $
{1}
2>/dev/null
}
where_is_mounted ()
{
}
where_is_mounted ()
{
- device=$
1
+ device=$
{1}
- if grep -q "^$
device
" /proc/mounts
+ if grep -q "^$
{device}
" /proc/mounts
then
then
- grep "^$
device
" /proc/mounts | read d mountpoint rest
- echo $
mountpoint
+ grep "^$
{device}
" /proc/mounts | read d mountpoint rest
+ echo $
{mountpoint}
return 0
fi
return 0
fi
@@
-89,11
+79,11
@@
base_path ()
do
if echo "${mounts}" | grep -qs "^${testpath}"
then
do
if echo "${mounts}" | grep -qs "^${testpath}"
then
- set --
`echo "${mounts}" | grep "^${testpath}" | lastline`
+ set --
$(echo "${mounts}" | grep "^${testpath}" | lastline)
echo ${1}
break
else
echo ${1}
break
else
- testpath=
`dirname $testpath`
+ testpath=
$(dirname $testpath)
fi
done
}
fi
done
}
@@
-101,7
+91,7
@@
base_path ()
fs_size ()
{
# Returns used/free fs kbytes + 5% more
fs_size ()
{
# Returns used/free fs kbytes + 5% more
- # You could pass a block device as $
1 or the mount point as $2
+ # You could pass a block device as $
{1} or the mount point as ${2}
dev="${1}"
mountp="${2}"
dev="${1}"
mountp="${2}"
@@
-111,7
+101,7
@@
fs_size ()
then
mountp=$(where_is_mounted "${dev}")
then
mountp=$(where_is_mounted "${dev}")
- if [ "$
?
" -gt 0 ]
+ if [ "$
{?}
" -gt 0 ]
then
mountp="/mnt/tmp_fs_size"
then
mountp="/mnt/tmp_fs_size"
@@
-151,18
+141,18
@@
load_keymap ()
setup_loop ()
{
setup_loop ()
{
- local fspath=$
1
- local module=$
2
- local pattern=$
3
- local offset=$
4
- local encryption=$
5
+ local fspath=$
{1}
+ local module=$
{2}
+ local pattern=$
{3}
+ local offset=$
{4}
+ local encryption=$
{5}
- modprobe
${MP_QUIET} -b "$module
"
+ modprobe
-q -b "${module}
"
udevsettle
udevsettle
- for loopdev in $
pattern
+ for loopdev in $
{pattern}
do
do
- if [ "$(cat $
loopdev
/size)" -eq 0 ]
+ if [ "$(cat $
{loopdev}
/size)" -eq 0 ]
then
dev=$(sys2dev "${loopdev}")
options=''
then
dev=$(sys2dev "${loopdev}")
options=''
@@
-186,7
+176,7
@@
setup_loop ()
echo "${passphrase}" > /tmp/passphrase
exec 9</tmp/passphrase
/sbin/losetup ${options} -e "${encryption}" -p 9 "${dev}" "${fspath}"
echo "${passphrase}" > /tmp/passphrase
exec 9</tmp/passphrase
/sbin/losetup ${options} -e "${encryption}" -p 9 "${dev}" "${fspath}"
- error=$
?
+ error=$
{?}
exec 9<&-
rm -f /tmp/passphrase
exec 9<&-
rm -f /tmp/passphrase
@@
-207,7
+197,7
@@
setup_loop ()
done
fi
done
fi
- echo "$
dev
"
+ echo "$
{dev}
"
return 0
fi
done
return 0
fi
done
@@
-241,9
+231,9
@@
find_cow_device ()
do
devname=$(sys2dev "${dev}")
do
devname=$(sys2dev "${dev}")
- if [ "$(/lib/udev/vol_id -l $
devname
2>/dev/null)" = "${pers_label}" ]
+ if [ "$(/lib/udev/vol_id -l $
{devname}
2>/dev/null)" = "${pers_label}" ]
then
then
- echo "$
devname
"
+ echo "$
{devname}
"
return
elif [ "$(get_fstype ${devname})" = "vfat" ]
then
return
elif [ "$(get_fstype ${devname})" = "vfat" ]
then
@@
-265,7
+255,7
@@
find_cow_device ()
find_files ()
{
find_files ()
{
- # return the first of $
filenames
found on vfat and ext2/ext3 devices
+ # return the first of $
{filenames}
found on vfat and ext2/ext3 devices
# FIXME: merge with above function
filenames="${1}"
# FIXME: merge with above function
filenames="${1}"
@@
-298,3
+288,17
@@
find_files ()
done
done
}
done
done
}
+
+get_mac ()
+{
+ mac=""
+ for adaptor in /sys/class/net/*;do
+ status=$(cat ${adaptor}/iflink)
+ if [ ${status} -eq 2 ];
+ then
+ mac=$(cat ${adaptor}/address)
+ mac=$(echo ${mac}|sed 's/:/-/g'|tr '[a-z]' '[A-Z]')
+ fi
+ done
+ echo $mac
+}