Shellcheck suggestions

This commit is contained in:
Kroese 2023-03-30 19:53:48 +02:00
parent 005dbea6be
commit 4786986790
5 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -e
docker build --tag dsm .
docker images dsm:latest --format "{{.Repository}}:{{.Tag}} -> {{.Size}}"
docker run --rm -it --name dsm --device=/dev/kvm:/dev/kvm --device=/dev/net/tun:/dev/net/tun --cap-add NET_ADMIN -p 80:5000 -p 443:5001 -p 5000:5000 -p 5001:5001 -v ${PWD}/img:/storage docker.io/library/dsm
docker run --rm -it --name dsm --device="/dev/kvm:/dev/kvm" --device="/dev/net/tun:/dev/net/tun" --cap-add NET_ADMIN -p 80:5000 -p 443:5001 -p 5000:5000 -p 5001:5001 -v "${PWD}/img:/storage" docker.io/library/dsm

View File

@ -70,7 +70,7 @@ NUMBLOCKS="622560" # 2550005760 / 4096
MOUNT="/mnt/tmp"
rm -rf $MOUNT && mkdir -p $MOUNT
[ mount -t ext4 -o loop,offset=$OFFSET $SYSTEM $MOUNT 2>/dev/null ] && PRIVILEGED=true
mount -t ext4 -o loop,offset=$OFFSET $SYSTEM $MOUNT 2>/dev/null && PRIVILEGED=true
rm -rf $MOUNT/{,.[!.],..?}*

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
QEMU_BRIDGE='qemubr0'
#QEMU_BRIDGE='qemubr0'
ip link set dev $1 nomaster
ip link set dev $1 down

4
run.sh
View File

@ -49,7 +49,7 @@ function default_intf() {
# on our current address/routes. We "steal" the container's IP, and lease
# it to the VM once it starts up.
/run/generate-dhcpd-conf $QEMU_BRIDGE > $DHCPD_CONF_FILE
default_dev=`default_intf`
default_dev=$(default_intf)
# Now we start modifying the networking configuration. First we clear out
# the IP address of the default device (will also have the side-effect of
@ -113,7 +113,7 @@ _graceful_shutdown() {
echo 'system_powerdown' | nc -q 1 localhost ${QEMU_MONPORT}>/dev/null 2>&1
echo ""
while echo 'info version'|nc -q 1 localhost ${QEMU_MONPORT:-7100}>/dev/null 2>&1 && [ "${COUNT}" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do
let COUNT++
(( COUNT++ )) || true
echo "QEMU still running. Retrying... (${COUNT}/${QEMU_POWERDOWN_TIMEOUT})"
sleep 1
done

View File

@ -2,6 +2,6 @@
permanent="DSM"
serialstart="2000"
serialnum="$(echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1)$permanent"$(printf "%06d" $(($RANDOM % 30000 + 1)))
serialnum="$(echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1)$permanent"$(printf "%06d" $((RANDOM % 30000 + 1)))
echo $serialnum