summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorSimon Rettberg2013-12-02 14:33:10 +0100
committerSimon Rettberg2013-12-02 14:33:10 +0100
commit02b2d374548aa26a591ed5ae1467c892203c760d (patch)
treeae0e666875c4620f665ee12b2c4a9b47981644e1 /remote
parentDoc + comments ... (diff)
downloadtm-scripts-02b2d374548aa26a591ed5ae1467c892203c760d.tar.gz
tm-scripts-02b2d374548aa26a591ed5ae1467c892203c760d.tar.xz
tm-scripts-02b2d374548aa26a591ed5ae1467c892203c760d.zip
Checked and changed the shebang of some more scripts. As we want to use ash in out own scripts whenever possible, only use bash where the scripts require a certain bash feature. Also add a comment right below the bash shebang that says we're not accidentally using bash here, but for a reason.
Diffstat (limited to 'remote')
-rwxr-xr-xremote/modules/german/data/opt/openslx/scripts/systemd-load_german_keymaps10
-rwxr-xr-xremote/modules/redsocks/data/opt/openslx/scripts/systemd-setup_proxy3
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/bin/clc.bash3
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-clc2
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt1
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter63
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export1
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions8
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons1
9 files changed, 49 insertions, 43 deletions
diff --git a/remote/modules/german/data/opt/openslx/scripts/systemd-load_german_keymaps b/remote/modules/german/data/opt/openslx/scripts/systemd-load_german_keymaps
index 72c58f5f..ee05e692 100755
--- a/remote/modules/german/data/opt/openslx/scripts/systemd-load_german_keymaps
+++ b/remote/modules/german/data/opt/openslx/scripts/systemd-load_german_keymaps
@@ -9,14 +9,14 @@ loadkeys /opt/openslx/keymaps/german_qwertz_compose_keyboard_translation.map
ERR=$?
# ... if this fails we enter a keymap without compose-lines:
-if [[ "$ERR" -eq 0 ]]; then
+if [ "$ERR" -eq 0 ]; then
exit 0 # in that case everything went smooth - exit.
-else
- loadkeys /opt/openslx/keymaps/german_qwertz_keyboard_translation.map # insert a keymap without compose lines
- ERR=$?
fi
+loadkeys /opt/openslx/keymaps/german_qwertz_keyboard_translation.map # insert a keymap without compose lines
+ERR=$?
+
# if at this point the second keymap insertion failed we pass the errorlevel to
# systemd - we cannot do more at this point.
-
exit $ERR
+
diff --git a/remote/modules/redsocks/data/opt/openslx/scripts/systemd-setup_proxy b/remote/modules/redsocks/data/opt/openslx/scripts/systemd-setup_proxy
index 675f12cd..4f802f53 100755
--- a/remote/modules/redsocks/data/opt/openslx/scripts/systemd-setup_proxy
+++ b/remote/modules/redsocks/data/opt/openslx/scripts/systemd-setup_proxy
@@ -1,4 +1,5 @@
-#!/bin/ash
+#!/bin/bash
+# Needs full bash
for wait in 1 1 2 3 4 6 8 10 end; do
grep '^#_RCONFIG_TAG$' /opt/openslx/config > /dev/null && echo "Config found!" && break
diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash b/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash
index 7437c8d2..ee198c51 100755
--- a/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash
+++ b/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash
@@ -1,4 +1,5 @@
-#!/bin/ash
+#!/bin/bash
+# Needs full bash
# region header
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-clc b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-clc
index 455d3707..337dee44 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-clc
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-clc
@@ -1,4 +1,4 @@
-#!/usr/bin/env busybox
+#!/bin/bash
# region header
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
index 5e997647..7e2eb5c5 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
@@ -1,4 +1,5 @@
#!/bin/bash
+# Full bash required
# -----------------------------------------------------------------------------
# Copyright (c) 2007..2010 - RZ Uni FR
# Copyright (c) 2007..2011 - OpenSLX GmbH
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter
index 15e4b8d7..5fd8acc5 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-xml_filter
@@ -1,4 +1,5 @@
-#!/bin/ash
+#!/bin/bash
+# Probably needs bash somewhere
# -----------------------------------------------------------------------------
# Copyright (c) 2007..2009 - RZ Uni FR
# Copyright (c) 2007..2011 - OpenSLX GmbH
@@ -29,45 +30,45 @@
# include default directories
. /opt/openslx/config
-if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf ]; then
- . ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf
+if [ -f "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf" ]; then
+ . "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf"
fi
function handlePersistentVM() {
- if [[ "$(grep --extended-regexp \
- "<persistent param=\"(|.+:)$USER(|:.+)\"" "$1")" ]]; then
+ if grep --extended-regexp -q "<persistent param=\"(|.+:)$USER(|:.+)\"" "$1"; then
# If this virtual machine is useable as persistent version for current
# user we provide an additional persistent version.
- local imageName=$(basename "$(grep -io '<image_name param=.*"' "$1" | \
- sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')") && \
- eval export SLX_VM_PERSISTENT_PATH="${SLX_VM_PERSISTENT_PATH}" && \
+ # TODO: This evil black magic needs to be rewritten some day (by someone who understands it)
+ local originalImagePath=$(grep -io '<image_name param=.*"' "$1" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+ local imageName=$(basename "$originalImagePath")
+ eval export SLX_VM_PERSISTENT_PATH="${SLX_VM_PERSISTENT_PATH}" && \
local imagePath="${SLX_VM_PERSISTENT_PATH}${imageName}"
- local persistentConfigVersionFilePath="$(mktemp --directory)/$(basename \
- "$1")" && \
- local vmchooserFilePath="$(dirname "$0")/vmchooser-clc" && \
- if [ ! -f "$vmchooserFilePath" ]; then
- vmchooserFilePath='/opt/openslx/plugin-repo/vmchooser/vmchooser-clc'
- fi
- bash "$vmchooserFilePath" "$1" "$persistentConfigVersionFilePath" \
+ local persistentConfigVersionFilePath="$(mktemp --directory)/$(basename "$1")"
+ local vmchooserFilePath="$(dirname "$0")/vmchooser-clc"
+ if [ ! -f "$vmchooserFilePath" ]; then
+ vmchooserFilePath='/opt/openslx/scripts/vmchooser-clc'
+ fi
+ "$vmchooserFilePath" "$1" "$persistentConfigVersionFilePath" \
--create-persistent-config "$imagePath" && \
echo "$persistentConfigVersionFilePath"
- fi
- }
+ fi
+}
- for FILE in $(find -L "$1" -iname "*.xml"); do
- # filter all xmls which aren't set active
- grep -i -q "<active param=.*true.*" "$FILE" || continue
- # HACK: filter all virtualbox images, as vbox is not ready yet
- grep -i -q "<virtualmachine param=.*virtualbox.*" "$FILE" && continue
- if [ -n "${SLX_VM_POOL_FILTER}" ]; then
- # filter all xmls with pool-param not equal to vmchooser::env
- if [ $(grep "<pools param=\"${SLX_VM_POOL_FILTER}\"" "$FILE" | wc -l) -eq 1 ]; then
- handlePersistentVM "$FILE"
- echo "$FILE"
- fi
- else
+for FILE in $(find -L "$1" -iname "*.xml"); do
+ # filter all xmls which aren't set active
+ grep -i -q "<active param=.*true.*" "$FILE" || continue
+ # HACK: filter all virtualbox images, as vbox is not ready yet
+ grep -i -q "<virtualmachine param=.*virtualbox.*" "$FILE" && continue
+ if [ -n "${SLX_VM_POOL_FILTER}" ]; then
+ # filter all xmls with pool-param not equal to vmchooser::env
+ if [ $(grep "<pools param=\"${SLX_VM_POOL_FILTER}\"" "$FILE" | wc -l) -eq 1 ]; then
handlePersistentVM "$FILE"
- # if there is no pool set, just take all available xmls
echo "$FILE"
fi
- done
+ else
+ handlePersistentVM "$FILE"
+ # if there is no pool set, just take all available xmls
+ echo "$FILE"
+ fi
+done
+
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
index 506d8f0e..4c8597a9 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
@@ -1,4 +1,5 @@
#!/bin/bash
+# Needs full bash
. /opt/openslx/config
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
index 07bd628e..cf285fac 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ash
# Copyright (c) 2013 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
@@ -177,15 +177,15 @@ else
echo "ERROR: Could not load zram module"
else
TOTAL=$(grep ^MemTotal /proc/meminfo | awk '{print $2}')
- USE=$[ $TOTAL / ( 2 * $CPUS ) ]
+ USE=$(( $TOTAL / ( 2 * $CPUS ) ))
echo "Have $CPUS cores, $TOTAL kb mem, use $USE kb zram swap per core"
- USE=$[ $USE * 1024 ]
+ USE=$(( $USE * 1024 ))
DEV=0
while [ "$DEV" -lt "$CPUS" ]; do
echo "$USE" > "/sys/block/zram${DEV}/disksize"
mkswap "/dev/zram${DEV}"
swapon "/dev/zram${DEV}" -p 1000
- DEV=$[ $DEV + 1 ]
+ DEV=$(( $DEV + 1 ))
done
fi
fi
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
index e587235e..b6f25b65 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
@@ -1,4 +1,5 @@
#!/bin/bash
+# Needs full bash
#
# Script to be called by systemd
#