Docker image and scripts for flutter/rust/android development in vscode.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.1 KiB

#!/bin/bash
# Exit on error
set -e
set -a
. $DEV_INIT_DIR/dev.env
set +a
# Check if TARGET_USER is set
if [ -z "$TARGET_USER" ]; then
echo "ERROR: TARGET_USER environment variable is not set"
exit 1
fi
targetHome=$(getent passwd $TARGET_USER | cut -f6 -d:)
targetUid=$(id -u $TARGET_USER)
if [ -z "$TARGET_USER" ]; then
echo "ERROR: Cannot parse home directory for user $TARGET_USER"
exit 1
fi
# Change ownership of the specified directories
chown -R $TARGET_USER: $ANDROID_SDK_ROOT
chown -R $TARGET_USER: $targetHome/.gradle
chown -R $TARGET_USER: $targetHome/.android
chown -R $TARGET_USER: $targetHome/.pub-cache
chown -R $TARGET_USER: $targetHome/.vscode-server
chown -R $TARGET_USER: /opt/flutter
chown -R $TARGET_USER: /opt/rustup
chown -R $TARGET_USER: /opt/cargo
chown -R $TARGET_USER: /projects
# fix
chown -R $TARGET_USER: /run/user/$targetUid
# chmod 777 /dev/kvm
# If command line arguments are provided, run them as TARGET_USER
# Otherwise, run bash as TARGET_USER
if [ $# -eq 0 ]; then
exec gosu $TARGET_USER bash
else
exec gosu $TARGET_USER "$@"
fi