#!/bin/sh
# Add all Android groups with their predefined IDs
echo "Adding android groups to system"
/usr/sbin/add_android_groups.sh

# Add user to all needed Android groups
username=$(getent passwd 10000 | cut -d ":" -f 1)
if [ x$username == "x" ]; then
	echo "Warning: no user with ID 10000 found!"
else
	echo "Adding $username to android groups"
	usermod -a -G aid_system,aid_graphics,aid_input,aid_audio,aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin $username
fi


rc-update add cgroups default
rc-update add lxc-android default

# postmarketOS firmware loader conflicts with ueventd one
if [ -f "/etc/udev/rules.d/50-firmware.rules" ]; then
	rm /etc/udev/rules.d/50-firmware.rules
fi
