Skip to content

Commit addcaaa

Browse files
committed
Fix shellcheck issues in live-image scripts.
1 parent 14f5bfa commit addcaaa

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

live-image/install.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ if [ -z "$ON_TARGET_HOST" ]; then
5151
fi
5252
TARGET="$1"
5353
shift
54-
make -C `dirname $0` `basename $EXTRA`
55-
scp "$0" `dirname $0`/`basename $EXTRA` "root@$TARGET:`dirname $EXTRA`"
56-
ssh "root@$TARGET" "/tmp/`basename $0` ON_TARGET $ARGS"
54+
make -C "$(dirname "$0")" "$(basename $EXTRA)"
55+
scp "$0" "$(dirname "$0")/$(basename $EXTRA)" "root@$TARGET:$(dirname $EXTRA)"
56+
# shellcheck disable=SC2029
57+
ssh "root@$TARGET" "/tmp/$(basename "$0") ON_TARGET $ARGS"
5758
exit 0
5859
fi
5960

@@ -119,8 +120,8 @@ if [ -f /tmp/domjudge-domserver_*.deb ]; then
119120
else
120121
USEVERSION="${DJDEBVERSION:+=$DJDEBVERSION}"
121122
apt-get install -q -y \
122-
domjudge-domserver${USEVERSION} domjudge-doc${USEVERSION} \
123-
domjudge-judgehost${USEVERSION}
123+
domjudge-domserver"${USEVERSION}" domjudge-doc"${USEVERSION}" \
124+
domjudge-judgehost"${USEVERSION}"
124125
fi
125126

126127
# Overwrite init script to fix start/restart:
@@ -176,10 +177,10 @@ rm -f /etc/ssh/ssh_host_*
176177
# Replace /etc/issue with live image specifics:
177178
mv /etc/issue /etc/issue.orig
178179
cat > /etc/issue.djlive <<EOF
179-
DOMjudge-live running on `cat /etc/issue.orig`
180+
DOMjudge-live running on $(cat /etc/issue.orig)
180181
181-
DOMjudge-live image generated on `date`
182-
DOMjudge Debian package version `dpkg -s domjudge-common | sed -n 's/^Version: //p'`
182+
DOMjudge-live image generated on $(date)
183+
DOMjudge Debian package version $(dpkg -s domjudge-common | sed -n 's/^Version: //p')
183184
184185
EOF
185186
cp /etc/issue.djlive /etc/issue.djlive-default-passwords

live-image/prepare-for-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ set -e
99

1010
IMG=$1
1111

12-
if [ "`id -un`" != 'root' -o -z "$IMG" -o ! -e "$IMG" ]; then
12+
if [ "$(id -un)" != 'root' ] || [ -z "$IMG" ] || [ ! -e "$IMG" ]; then
1313
echo "Error: this script must be run as root with argument a disk image."
1414
exit 1
1515
fi
1616

17-
ROOTPART=`kpartx -asv "$IMG" | tail -n1 | sed -r 's/^(add map *)?([^ ]*).*/\2/'`
17+
ROOTPART=$(kpartx -asv "$IMG" | tail -n1 | sed -r 's/^(add map *)?([^ ]*).*/\2/')
1818
ROOTPART="/dev/mapper/$ROOTPART"
1919

2020
e2fsck -f "$ROOTPART"

0 commit comments

Comments
 (0)