summaryrefslogtreecommitdiffstats
path: root/server/bin/oglivecli
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-09-03 12:29:04 +0200
committerRamón M. Gómez <ramongomez@us.es>2020-09-03 12:29:04 +0200
commit0e3e1674ae6d35ab6af29af96a6f24bfb9179078 (patch)
treeff80289ce51928db489abf74fef3251fb10a8230 /server/bin/oglivecli
parent64e2155d0620c0fbbaa2827fe2edbf1c6cea135c (diff)
#997: Support for Initrd compressed in several formats.
Adding compatibility with Ubuntu 20.04 Initrd, which is compressed in LZ4 format.
Diffstat (limited to 'server/bin/oglivecli')
-rwxr-xr-xserver/bin/oglivecli10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/bin/oglivecli b/server/bin/oglivecli
index a6e3148a..65dd2e0f 100755
--- a/server/bin/oglivecli
+++ b/server/bin/oglivecli
@@ -260,7 +260,7 @@ function download() {
# Install an ogLive client from a previously downloaded ISO image.
function install() {
local OGLIVEFILE OGLIVEDIST OGLIVEREV OGLIVEKRNL OGLIVEDIR OGINITRD OGSQFS OGCLIENT=ogclient
- local SAMBAPASS TMPDIR RSYNCSERV RSYNCCLNT
+ local COMPRESS SAMBAPASS TMPDIR RSYNCSERV RSYNCCLNT
[ $# -ne 1 ] && raiseError usage
OGLIVEFILE=$(realpath $DOWNLOADDIR/$1)
# Only 1 file in pathname expansion.
@@ -289,10 +289,10 @@ function install() {
OGINITRD=$OGLIVEDIR/oginitrd.img
[ ! -r $OGINITRD ] && OGINITRD=$TFTPDIR/$DEFOGLIVE/oginitrd.img
if [ -r $OGINITRD ]; then
- SAMBAPASS=$(gzip -dc $OGINITRD | \
- cpio -i --to-stdout scripts/ogfunctions 2>&1 | \
- grep "^[ ].*OPTIONS=" | \
- sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
+ COMPRESS=$(file -b "$OGINITRD " | awk '{print tolower($1);}')
+ SAMBAPASS=$($COMPRESS -dc $OGINITRD | \
+ cpio -i --to-stdout scripts/ogfunctions 2>&1 | \
+ sed -n '/^[ ].*OPTIONS=/s/.*pass=\(\w*\).*/\1/p')
fi
# Make ogLive backup.
rm -fr ${OGLIVEDIR}.old