scripts: make shellcheck happy

This commit is contained in:
Simon Fels 2018-07-05 09:21:34 +02:00
commit bfd0619d96
2 changed files with 14 additions and 15 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -x
# We need to put the rootfs somewhere where we can modify some
@ -7,7 +7,6 @@ set -x
# rootfs.
DATA_PATH=$SNAP_COMMON/
ROOTFS_PATH=$DATA_PATH/rootfs
ANDROID_IMG=$SNAP/android.img
if [ "$(id -u)" != 0 ]; then
@ -15,14 +14,14 @@ if [ "$(id -u)" != 0 ]; then
exit 1
fi
if [ ! -e $ANDROID_IMG ]; then
if [ ! -e "$ANDROID_IMG" ]; then
echo "ERROR: android image does not exist"
exit 1
fi
if [ "$SNAP_ARCH" == "amd64" ]; then
if [ "$SNAP_ARCH" = "amd64" ]; then
ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" == "armhf" ]; then
elif [ "$SNAP_ARCH" = "armhf" ]; then
ARCH="arm-linux-gnueabihf"
else
ARCH="$SNAP_ARCH-linux-gnu"
@ -32,11 +31,11 @@ start() {
# Make sure our setup path for the container rootfs
# is present as lxc is statically configured for
# this path.
mkdir -p $SNAP_COMMON/lxc
mkdir -p "$SNAP_COMMON/lxc"
# We start the bridge here as long as a oneshot service unit is not
# possible. See snapcraft.yaml for further details.
$SNAP/bin/anbox-bridge.sh start
"$SNAP"/bin/anbox-bridge.sh start
# Ensure FUSE support for user namespaces is enabled
echo Y | tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
@ -49,16 +48,16 @@ start() {
fi
# liblxc.so.1 is in $SNAP/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/liblxc
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/liblxc"
# For unknown reason we got bug reports that the container manager failed to start
# because it cannot find libboost_log.so.1.58.0 To mitigate this we're adding the
# lib directory as explicit search target here.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SNAP/usr/lib/$ARCH
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/usr/lib/$ARCH"
if [ -d /sys/kernel/security/apparmor ] ; then
# Load the profile for our Android container
$SNAP/sbin/apparmor_parser -r $SNAP/apparmor/anbox-container.aa
"$SNAP"/sbin/apparmor_parser -r "$SNAP"/apparmor/anbox-container.aa
fi
enable_debug="$(snapctl get debug.enable)"
@ -78,15 +77,15 @@ start() {
EXTRA_ARGS="$EXTRA_ARGS --privileged"
fi
exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \
exec "$AA_EXEC" "$SNAP"/bin/anbox-wrapper.sh container-manager \
"$EXTRA_ARGS" \
--data-path=$DATA_PATH \
--android-image=$ANDROID_IMG \
--data-path="$DATA_PATH" \
--android-image="$ANDROID_IMG" \
--daemon
}
stop() {
$SNAP/bin/anbox-bridge.sh stop
"$SNAP"/bin/anbox-bridge.sh stop
}
case "$1" in

View file

@ -38,4 +38,4 @@ if [ "$(snapctl get software-rendering.enable)" = true ]; then
export ANBOX_FORCE_SOFTWARE_RENDERING=true
fi
exec $SNAP/usr/bin/anbox $@
exec "$SNAP"/usr/bin/anbox "$@"