-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added startup file to handle user configuration
- Loading branch information
1 parent
af165cc
commit c76a4e8
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# This script is first to run due to this: https://github.com/phusion/baseimage-docker#running_startup_scripts. | ||
# | ||
# It updates the UIG or GID of the included arm user to whatever value the user | ||
# passes at runtime, if the value set is not the default value of 1000 | ||
# | ||
# If the container is run again without specifying UID and GID, this script | ||
# resets the UID and GID of all files in ARM directories to the defaults | ||
|
||
DEFAULT_UID=1000 | ||
DEFAULT_GID=1000 | ||
|
||
if [[ $ARM_UID -ne $DEFAULT_UID ]]; then | ||
echo -e "Updating arm user id from $DEFAULT_UID to $ARM_UID..." | ||
usermod -u "$ARM_UID" arm | ||
elif [[ $ARM_UID -eq $DEFAULT_UID ]]; then | ||
echo -e "Updating arm group id $ARM_UID to default (1000)..." | ||
usermod -u $DEFAULT_UID arm | ||
fi | ||
|
||
if [[ $ARM_GID -ne $DEFAULT_GID ]]; then | ||
echo -e "Updating arm group id from $DEFAULT_GID to $ARM_GID..." | ||
groupmod -g "$ARM_GID" arm | ||
elif [[ $ARM_UID -eq $DEFAULT_GID ]]; then | ||
echo -e "Updating arm group id $ARM_GID to default (1000)..." | ||
groupmod -g $DEFAULT_GID arm | ||
fi |