uci-docker-build/core/core.sh

39 lines
1.3 KiB
Bash

#!/bin/bash
echo "------------- CORE INSTALLATION ------------"
source /opt/core_run.env
if [[ -f ./build.env ]]; then
echo sourcing a custom core build enviornment
cat ./build.env
echo "--------"
source ./build.env
fi
source $LIB_DIR/verbose.lib
echo appending pkg commands to core_run.env
echo appending sourcing of $ENV_DIR/run.env if it exists
cat <<ENV >> /opt/core_run.env
export INSTALL_PKGS="$INSTALL_PKGS"
export UPDATE_PKGS="$UPDATE_PKGS"
[ -f "\$ENV_DIR/run.env" ] && [ -z "\$BUILDING" ] && source \$ENV_DIR/run.env
ENV
quiet cat /opt/core_run.env
mkdir -p /etc/profile.d
echo creating login sourcing file for core_run.env in /etc/profile.d
echo "source /opt/core_run.env" > /etc/profile.d/01-core-run-env.sh
quiet ls -la /etc/profile.d
echo "--------- creating user and group 'host' with ids 1000 -----"
echo "done --------- creating user and group 'host' with ids 1000 -----"
cat <<DOC >> /etc/login.defs
SYS_UID_MAX 1001"
SYS_GID_MAX 1001"
DOC
groupadd -g 1000 host
echo "SYS_UID_MAX 1001" >> /etc/login.defs
useradd -r -g host -u 1000 host
[[ $USER_PW ]] && export USER=${USER:-sysadmin}
[[ $USER ]] && /bin/bash user.sh
[[ $UCI_SHELL ]] && /bin/bash uci-shell.sh
$BIN_DIR/map-host-id /opt
ls -la /opt
echo "done ------------- CORE INSTALLATION ------------"