mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Shellcheck suggestions
This commit is contained in:
parent
005dbea6be
commit
4786986790
3
build.sh
3
build.sh
@ -1,5 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
docker build --tag dsm .
|
docker build --tag dsm .
|
||||||
docker images dsm:latest --format "{{.Repository}}:{{.Tag}} -> {{.Size}}"
|
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
|
||||||
|
@ -70,7 +70,7 @@ NUMBLOCKS="622560" # 2550005760 / 4096
|
|||||||
MOUNT="/mnt/tmp"
|
MOUNT="/mnt/tmp"
|
||||||
rm -rf $MOUNT && mkdir -p $MOUNT
|
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/{,.[!.],..?}*
|
rm -rf $MOUNT/{,.[!.],..?}*
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ if [ "$PRIVILEGED" = false ]; then
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
umount $MOUNT
|
umount $MOUNT
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
QEMU_BRIDGE='qemubr0'
|
#QEMU_BRIDGE='qemubr0'
|
||||||
|
|
||||||
ip link set dev $1 nomaster
|
ip link set dev $1 nomaster
|
||||||
ip link set dev $1 down
|
ip link set dev $1 down
|
||||||
|
4
run.sh
4
run.sh
@ -49,7 +49,7 @@ function default_intf() {
|
|||||||
# on our current address/routes. We "steal" the container's IP, and lease
|
# on our current address/routes. We "steal" the container's IP, and lease
|
||||||
# it to the VM once it starts up.
|
# it to the VM once it starts up.
|
||||||
/run/generate-dhcpd-conf $QEMU_BRIDGE > $DHCPD_CONF_FILE
|
/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
|
# 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
|
# 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 'system_powerdown' | nc -q 1 localhost ${QEMU_MONPORT}>/dev/null 2>&1
|
||||||
echo ""
|
echo ""
|
||||||
while echo 'info version'|nc -q 1 localhost ${QEMU_MONPORT:-7100}>/dev/null 2>&1 && [ "${COUNT}" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do
|
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})"
|
echo "QEMU still running. Retrying... (${COUNT}/${QEMU_POWERDOWN_TIMEOUT})"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
permanent="DSM"
|
permanent="DSM"
|
||||||
serialstart="2000"
|
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
|
echo $serialnum
|
||||||
|
Loading…
x
Reference in New Issue
Block a user