scripts: make shellcheck happy
This commit is contained in:
parent
7b10faf47a
commit
bfd0619d96
2 changed files with 14 additions and 15 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# We need to put the rootfs somewhere where we can modify some
|
# We need to put the rootfs somewhere where we can modify some
|
||||||
|
|
@ -7,7 +7,6 @@ set -x
|
||||||
# rootfs.
|
# rootfs.
|
||||||
|
|
||||||
DATA_PATH=$SNAP_COMMON/
|
DATA_PATH=$SNAP_COMMON/
|
||||||
ROOTFS_PATH=$DATA_PATH/rootfs
|
|
||||||
ANDROID_IMG=$SNAP/android.img
|
ANDROID_IMG=$SNAP/android.img
|
||||||
|
|
||||||
if [ "$(id -u)" != 0 ]; then
|
if [ "$(id -u)" != 0 ]; then
|
||||||
|
|
@ -15,14 +14,14 @@ if [ "$(id -u)" != 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e $ANDROID_IMG ]; then
|
if [ ! -e "$ANDROID_IMG" ]; then
|
||||||
echo "ERROR: android image does not exist"
|
echo "ERROR: android image does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SNAP_ARCH" == "amd64" ]; then
|
if [ "$SNAP_ARCH" = "amd64" ]; then
|
||||||
ARCH="x86_64-linux-gnu"
|
ARCH="x86_64-linux-gnu"
|
||||||
elif [ "$SNAP_ARCH" == "armhf" ]; then
|
elif [ "$SNAP_ARCH" = "armhf" ]; then
|
||||||
ARCH="arm-linux-gnueabihf"
|
ARCH="arm-linux-gnueabihf"
|
||||||
else
|
else
|
||||||
ARCH="$SNAP_ARCH-linux-gnu"
|
ARCH="$SNAP_ARCH-linux-gnu"
|
||||||
|
|
@ -32,11 +31,11 @@ start() {
|
||||||
# Make sure our setup path for the container rootfs
|
# Make sure our setup path for the container rootfs
|
||||||
# is present as lxc is statically configured for
|
# is present as lxc is statically configured for
|
||||||
# this path.
|
# 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
|
# We start the bridge here as long as a oneshot service unit is not
|
||||||
# possible. See snapcraft.yaml for further details.
|
# 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
|
# 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"
|
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
|
fi
|
||||||
|
|
||||||
# liblxc.so.1 is in $SNAP/lib
|
# 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
|
# 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
|
# because it cannot find libboost_log.so.1.58.0 To mitigate this we're adding the
|
||||||
# lib directory as explicit search target here.
|
# 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
|
if [ -d /sys/kernel/security/apparmor ] ; then
|
||||||
# Load the profile for our Android container
|
# 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
|
fi
|
||||||
|
|
||||||
enable_debug="$(snapctl get debug.enable)"
|
enable_debug="$(snapctl get debug.enable)"
|
||||||
|
|
@ -78,15 +77,15 @@ start() {
|
||||||
EXTRA_ARGS="$EXTRA_ARGS --privileged"
|
EXTRA_ARGS="$EXTRA_ARGS --privileged"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \
|
exec "$AA_EXEC" "$SNAP"/bin/anbox-wrapper.sh container-manager \
|
||||||
"$EXTRA_ARGS" \
|
"$EXTRA_ARGS" \
|
||||||
--data-path=$DATA_PATH \
|
--data-path="$DATA_PATH" \
|
||||||
--android-image=$ANDROID_IMG \
|
--android-image="$ANDROID_IMG" \
|
||||||
--daemon
|
--daemon
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
$SNAP/bin/anbox-bridge.sh stop
|
"$SNAP"/bin/anbox-bridge.sh stop
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,4 @@ if [ "$(snapctl get software-rendering.enable)" = true ]; then
|
||||||
export ANBOX_FORCE_SOFTWARE_RENDERING=true
|
export ANBOX_FORCE_SOFTWARE_RENDERING=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $SNAP/usr/bin/anbox $@
|
exec "$SNAP"/usr/bin/anbox "$@"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue