[X2Go-Commits] [live-build-x2go] 56/167: /bin/sh instead of /bin/bash requires the use of "echo" instead of "echo -en"
git-admin at x2go.org
git-admin at x2go.org
Sat Nov 18 00:32:41 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/openbox-magic-pixel-workaround
in repository live-build-x2go.
commit 562d6fbf0b21cd7de57705885e2623ad316bdb11
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date: Sun Jul 23 23:38:47 2017 +0200
/bin/sh instead of /bin/bash requires the use of "echo" instead of "echo -en"
---
.../lib/live/config/2400-live-autoupdate | 104 +++++++++++----------
1 file changed, 53 insertions(+), 51 deletions(-)
diff --git a/config/includes.chroot/lib/live/config/2400-live-autoupdate b/config/includes.chroot/lib/live/config/2400-live-autoupdate
index f4c523b..b1960dc 100755
--- a/config/includes.chroot/lib/live/config/2400-live-autoupdate
+++ b/config/includes.chroot/lib/live/config/2400-live-autoupdate
@@ -1,24 +1,26 @@
#!/bin/sh
+# this is not /bin/bash, so "echo -en" is not supported, but the default when calling "echo"
+
cleanup ()
{ # discard contents of tmpfs, umount if necessary
if [ -n "$NTFSROOT" ]; then
- echo -en "\n$(date +'%F | %T | ')'$0': Removing '$TEMPDIR/*'."
+ echo "\n$(date +'%F | %T | ')'$0': Removing '$TEMPDIR/*'."
rm -rf $TEMPDIR/*
else
- echo -en "\n$(date +'%F | %T | ')'$0': Unmounting '$TEMPDIR'."
+ echo "\n$(date +'%F | %T | ')'$0': Unmounting '$TEMPDIR'."
umount $TEMPDIR
fi
if rmdir $TEMPDIR; then
- echo -en "\n$(date +'%F | %T | ')'$0': Removed empty directory '$TEMPDIR'."
+ echo "\n$(date +'%F | %T | ')'$0': Removed empty directory '$TEMPDIR'."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Could not remove directory '$TEMPDIR'."
+ echo "\n$(date +'%F | %T | ')'$0': Could not remove directory '$TEMPDIR'."
fi
if [ -n "$NTFSROOT" ]; then
if umount $MOUNTPOINT; then
- echo -en "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
+ echo "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Could not unmount '$MOUNTPOINT'."
+ echo "\n$(date +'%F | %T | ')'$0': Could not unmount '$MOUNTPOINT'."
fi
fi
}
@@ -35,7 +37,7 @@ echo -n " live-autoupdater (backgrounding update task)"
(
while ! [ -c /dev/tty8 ] ; do
- echo -en "\n\$(date +'%F | %T | ')'$0' is waiting for tty8 to become available."
+ echo "\n$(date +'%F | %T | ')'$0' is waiting for tty8 to become available."
sleep 2
done
@@ -56,7 +58,7 @@ echo -n " live-autoupdater (backgrounding update task)"
awk -F'=' ' /^updateurl=/ { print $2 }')
if [ -z "$DOWNLOADURL" ]; then
- echo -en "\n$(date +'%F | %T | ')'$0': No update URL. Exiting."
+ echo "\n$(date +'%F | %T | ')'$0': No update URL. Exiting."
return 0
fi
@@ -68,7 +70,7 @@ echo -n " live-autoupdater (backgrounding update task)"
awk -F'=' ' /^bwlimit=/ { print $2 }')
if [ -z "$BWLIMITPERCENT" ]; then
BWLIMITPERCENT=20
- echo -en "\n$(date +'%F | %T | ')'$0': Bandwidth limit not set. Defaulting to 20%."
+ echo "\n$(date +'%F | %T | ')'$0': Bandwidth limit not set. Defaulting to 20%."
fi
@@ -82,7 +84,7 @@ echo -n " live-autoupdater (backgrounding update task)"
MAXSLEEPTIME=900
fi
SLEEPTIME=0
- echo -en "\n$(date +'%F | %T | ')'$0': Calculating random update delay (120-$MAXSLEEPTIME seconds)..."
+ echo "\n$(date +'%F | %T | ')'$0': Calculating random update delay (120-$MAXSLEEPTIME seconds)..."
# During startup, script is run with /bin/sh,
# even when #!/bin/bash is set,
# so we need to improvise.
@@ -91,7 +93,7 @@ echo -n " live-autoupdater (backgrounding update task)"
if [ $SLEEPTIME -lt 120 ]; then
SLEEPTIME=$((SLEEPTIME+120))
fi
- echo -en "\n$(date +'%F | %T | ')'$0': Sleeping for $SLEEPTIME seconds ..."
+ echo "\n$(date +'%F | %T | ')'$0': Sleeping for $SLEEPTIME seconds ..."
sleep $SLEEPTIME
@@ -110,9 +112,9 @@ echo -n " live-autoupdater (backgrounding update task)"
fi
if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot ; then
- echo -en "\n$(date +'%F | %T | ')'$0': Mounted '/dev/disk/by-uuid/$NTFSROOT'."
+ echo "\n$(date +'%F | %T | ')'$0': Mounted '/dev/disk/by-uuid/$NTFSROOT'."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Unable to mount '/dev/disk/by-uuid/$NTFSROOT'."
+ echo "\n$(date +'%F | %T | ')'$0': Unable to mount '/dev/disk/by-uuid/$NTFSROOT'."
fi
# TODO: Further error handling
MOUNTPOINT="/lib/live/mount/ntfsroot/"
@@ -144,7 +146,7 @@ echo -n " live-autoupdater (backgrounding update task)"
) \
); then
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': No directories suitable for update."
+ echo "\n$(date +'%F | %T | ')'$0': No directories suitable for update."
return 0 # directories missing, most likely not a writeable medium
fi
@@ -163,7 +165,7 @@ echo -n " live-autoupdater (backgrounding update task)"
GRUBPATH="$MOUNTPOINT/boot/grub/"
else
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': No suitable bootloader found."
+ echo "\n$(date +'%F | %T | ')'$0': No suitable bootloader found."
return 1
fi
@@ -179,7 +181,7 @@ echo -n " live-autoupdater (backgrounding update task)"
OTHERSYSTEMNAME="X2Go-live1"
else
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': Unable to determine path/name of running system."
+ echo "\n$(date +'%F | %T | ')'$0': Unable to determine path/name of running system."
return 1
fi
OTHERSYSTEMFULLPATH=$(readlink -m "$ALLSYSTEMSROOT/$OTHERSYSTEMNAME")
@@ -193,9 +195,9 @@ echo -n " live-autoupdater (backgrounding update task)"
# like CF cards)
#
while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $TEMPDIR; do
- echo -en "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
+ echo "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
sleep 30
- echo -en "\n$(date +'%F | %T | ')'$0': Retrying ..."
+ echo "\n$(date +'%F | %T | ')'$0': Retrying ..."
done
@@ -215,7 +217,7 @@ echo -n " live-autoupdater (backgrounding update task)"
)
case $SIZEFACTORSTRING in
"" | \
- [0-9]) echo -en "\n$(date +'%F | %T | ')'$0': Not enough Bandwidth for update task - "
+ [0-9]) echo "\n$(date +'%F | %T | ')'$0': Not enough Bandwidth for update task - "
echo -n "aborting."
cleanup
return 0
@@ -233,7 +235,7 @@ echo -n " live-autoupdater (backgrounding update task)"
awk ' { print $1*$2*$3/100 }' | \
awk -F'.' '{ print $1 }' \
) # outputs integer kilobytes, not rounded
- echo -en "\n$(date +'%F | %T | ')'$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
+ echo "\n$(date +'%F | %T | ')'$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
DOWNLOADCOMMAND="wget -Nr -l 1 -nd -P "$TEMPDIR" \
--progress=bar:force \
--limit-rate=${BWLIMIT}k $DOWNLOADURL"
@@ -249,7 +251,7 @@ echo -n " live-autoupdater (backgrounding update task)"
)
case $SIZEFACTORSTRING in
"" | \
- [0-9]) echo -en "\n$(date +'%F | %T | ')'$0': Not enough Bandwidth for update task - "
+ [0-9]) echo "\n$(date +'%F | %T | ')'$0': Not enough Bandwidth for update task - "
echo -n "aborting."
cleanup
return 0
@@ -266,12 +268,12 @@ echo -n " live-autoupdater (backgrounding update task)"
awk ' { print $1*$2*$3/100 }' | \
awk -F'.' '{ print $1 }' \
) # outputs integer kilobytes, not rounded
- echo -en "\n$(date +'%F | %T | ')'$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
+ echo "\n$(date +'%F | %T | ')'$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
DOWNLOADCOMMAND="rsync -aPv --inplace --bwlimit=$BWLIMIT $DOWNLOADURL/ \
$TEMPDIR"
else
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': Unsupported download mechanism - aborting."
+ echo "\n$(date +'%F | %T | ')'$0': Unsupported download mechanism - aborting."
return 1
fi
rm /tmp/dl.log
@@ -280,25 +282,25 @@ echo -n " live-autoupdater (backgrounding update task)"
# Proceed to download from update location
#
while ! $DOWNLOADCOMMAND; do
- echo -en "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
+ echo "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
sleep 30
- echo -en "\n$(date +'%F | %T | ')'$0': Retrying ..."
+ echo "\n$(date +'%F | %T | ')'$0': Retrying ..."
done
# Now check if these files are different from what we already have in our
# download directory on the boot medium
#
- echo -en "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$TEMPDIR' ..."
+ echo "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$TEMPDIR' ..."
if diff -q $DOWNLOADPATH $TEMPDIR \
>/dev/null
then
cleanup
- echo -en "\n$(date +'%F | %T | ')'$0': Nothing to do. - Files on server not newer than '$DOWNLOADPATH'."
+ echo "\n$(date +'%F | %T | ')'$0': Nothing to do. - Files on server not newer than '$DOWNLOADPATH'."
return 0 # current is newest, nothing to do, we want to avoid
# unneccessary writes to the medium
else
- echo -en "\n$(date +'%F | %T | ')'$0': Differences detected. Continuing ..."
+ echo "\n$(date +'%F | %T | ')'$0': Differences detected. Continuing ..."
fi
@@ -306,9 +308,9 @@ echo -n " live-autoupdater (backgrounding update task)"
# remount it rw and async for speed
#
if mount -oremount,rw,async $MOUNTPOINT; then
- echo -en "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' as rw and async."
+ echo "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' as rw and async."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Could not remount '$MOUNTPOINT' as rw and async."
+ echo "\n$(date +'%F | %T | ')'$0': Could not remount '$MOUNTPOINT' as rw and async."
fi
@@ -319,26 +321,26 @@ echo -n " live-autoupdater (backgrounding update task)"
# move everything over to the boot medium
#
- echo -en "\n$(date +'%F | %T | ')'$0': Moving $TEMPDIR/* => $DOWNLOADPATH"
+ echo "\n$(date +'%F | %T | ')'$0': Moving $TEMPDIR/* => $DOWNLOADPATH"
mv $TEMPDIR/* $DOWNLOADPATH
cleanup # FIXME ist dieses Cleanup gerechtfertigt oder macht es dummfoog?
if [ -n "$NTFSROOT" ]; then
- echo -en "\n$(date +'%F | %T | ')'$0': NTFSROOT detected. Attempting to mount '/dev/disk/by-uuid/$NTFSROOT'."
+ echo "\n$(date +'%F | %T | ')'$0': NTFSROOT detected. Attempting to mount '/dev/disk/by-uuid/$NTFSROOT'."
if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot; then
- echo -en "\n$(date +'%F | %T | ')'$0': Mount successful."
+ echo "\n$(date +'%F | %T | ')'$0': Mount successful."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Failed to mount NTFSROOT."
+ echo "\n$(date +'%F | %T | ')'$0': Failed to mount NTFSROOT."
fi
fi
# let's check if we just downloaded a copy of our running system
#
- echo -en "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$RUNNINGSYSTEMFULLPATH'"
+ echo "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$RUNNINGSYSTEMFULLPATH'"
if diff -q $DOWNLOADPATH $RUNNINGSYSTEMFULLPATH >/dev/null && \
[ -d "$OTHERSYSTEMFULLPATH" ] ; then
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': Nothing to do. Content of $DOWNLOADPATH equals" \
+ echo "\n$(date +'%F | %T | ')'$0': Nothing to do. Content of $DOWNLOADPATH equals" \
"$RUNNINGSYSTEMNAME."
return 0 # current is newest, nothing to do,
# we want to keep the old system in OTHERSYSTEMFULLPATH
@@ -353,20 +355,20 @@ echo -n " live-autoupdater (backgrounding update task)"
# let's check if our destination is already up to date or needs updating
#
- echo -en "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$OTHERSYSTEMFULLPATH'"
+ echo "\n$(date +'%F | %T | ')'$0': Diff'ing '$DOWNLOADPATH' '$OTHERSYSTEMFULLPATH'"
if diff -q $DOWNLOADPATH $OTHERSYSTEMFULLPATH >/dev/null; then
[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
- echo -en "\n$(date +'%F | %T | ')'$0': Nothing to do - content of '$DOWNLOADPATH' equals"\
+ echo "\n$(date +'%F | %T | ')'$0': Nothing to do - content of '$DOWNLOADPATH' equals"\
"'$OTHERSYSTEMNAME'."
return 0 # OTHERSYSTEMFULLPATH is already up to date
else
# keep rsyncing until the update is complete
- echo -en "\n$(date +'%F | %T | ')'$0': Copying $DOWNLOADPATH/ => $OTHERSYSTEMFULLPATH"
+ echo "\n$(date +'%F | %T | ')'$0': Copying $DOWNLOADPATH/ => $OTHERSYSTEMFULLPATH"
while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $OTHERSYSTEMFULLPATH
do
- echo -en "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
+ echo "\n$(date +'%F | %T | ')'$0': Sleeping 30 seconds ..."
sleep 30
- echo -en "\n$(date +'%F | %T | ')'$0': Retrying ..."
+ echo "\n$(date +'%F | %T | ')'$0': Retrying ..."
done
fi
@@ -374,7 +376,7 @@ echo -n " live-autoupdater (backgrounding update task)"
# change default boot to the image we just downloaded and installed
#
if [ -n "$SYSLINUXPATH" ]; then
- echo -en "\n$(date +'%F | %T | ')'$0': Changing syslinux default to $OTHERSYSTEMNAME."
+ echo "\n$(date +'%F | %T | ')'$0': Changing syslinux default to $OTHERSYSTEMNAME."
sed -i -e"/^default/cdefault $OTHERSYSTEMNAME" \
$SYSLINUXPATH/syslinux.cfg
@@ -390,16 +392,16 @@ echo -n " live-autoupdater (backgrounding update task)"
awk -F':' '$2 ~ /'"${OTHERSYSTEMNAME}"'/ { print $1 }')
OTHERTITLEPOSITION=$((OTHERTITLEPOSITION-1))
if [ "$CURRENTTITLEPOSITION" = "$CURRENTDEFAULT" ]; then
- echo -en "\n$(date +'%F | %T | ')'$0': Changing GRUB-legacy default to $OTHERTITLEPOSITION ..."
+ echo "\n$(date +'%F | %T | ')'$0': Changing GRUB-legacy default to $OTHERTITLEPOSITION ..."
sed -i -e"/^default/cdefault $OTHERTITLEPOSITION" \
$MENULST
else
- echo -en "\n$(date +'%F | %T | ')'$0': Not changing GRUB-legacy default."
- echo -en "\n$(date +'%F | %T | ')'$0': Reason: We're at boot position '$CURRENTTITLEPOSITION',"
- echo -en "\n$(date +'%F | %T | ')'$0': while default is set to position '$CURRENTDEFAULT'."
+ echo "\n$(date +'%F | %T | ')'$0': Not changing GRUB-legacy default."
+ echo "\n$(date +'%F | %T | ')'$0': Reason: We're at boot position '$CURRENTTITLEPOSITION',"
+ echo "\n$(date +'%F | %T | ')'$0': while default is set to position '$CURRENTDEFAULT'."
fi
else
- echo -en "\n$(date +'%F | %T | ')'$0': Unsupported bootloader."
+ echo "\n$(date +'%F | %T | ')'$0': Unsupported bootloader."
fi
# we're on an async mount point, so let's sync to be safe
@@ -418,15 +420,15 @@ echo -n " live-autoupdater (backgrounding update task)"
#
if [ -n "$NTFSROOT" ]; then
if umount $MOUNTPOINT; then
- echo -en "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
+ echo "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Unable to unmount '$MOUNTPOINT'."
+ echo "\n$(date +'%F | %T | ')'$0': Unable to unmount '$MOUNTPOINT'."
fi
else
if mount -oremount,ro,sync $MOUNTPOINT; then
- echo -en "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' ro and sync."
+ echo "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' ro and sync."
else
- echo -en "\n$(date +'%F | %T | ')'$0': Unable to remount '$MOUNTPOINT' ro and sync."
+ echo "\n$(date +'%F | %T | ')'$0': Unable to remount '$MOUNTPOINT' ro and sync."
fi
fi
--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git
More information about the x2go-commits
mailing list