tools/stx/toCOPY/builder/finishSetup.sh
hbai 173329e968 stx tools: Add scripts to setup builder
This commit adds finishSetup.sh, userenv for builder setup
and stx-builder.Dockerfile and buildrc are also updated

Story: 2008846
Task: 43484

Signed-off-by: hbai <haiqing.bai@windriver.com>
Change-Id: I9a70a8d7b18ba7cb8d689e513dba67231582bb42
2021-09-29 22:18:02 -04:00

30 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
. $HOME/buildrc
REPOMGR=aptly
if [ "$REPOMGR" == "aptly" ]; then
REPO_BIN="deb [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-binary bullseye main"
REPO_SRC="deb-src [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-source bullseye main"
ret=`grep 'deb-local-binary' /etc/apt/sources.list`
if [ "x$ret" == "x" ]; then
sed -i "1i\\${REPO_BIN}" /etc/apt/sources.list
fi
ret=`grep 'deb-local-source' /etc/apt/sources.list`
if [ "x$ret" == "x" ]; then
sed -i "1i\\${REPO_SRC}" /etc/apt/sources.list
fi
fi
addgroup -gid 751 cgts > /dev/null 2>&1
adduser --uid $MYUID --ingroup cgts --home /home/$MYUNAME --shell /bin/bash --disabled-password --gecos "" $MYUNAME > /dev/null 2>&1
ret=`cat /etc/sudoers | grep "${MYUNAME}"`
if [ "x$ret" == "x" ]; then
echo "${MYUNAME} ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
fi
chown -R ${MYUNAME}:cgts /localdisk
cp -f /root/buildrc /home/$MYUNAME/
cp -f /root/localrc /home/$MYUNAME/
cp -f /root/userenv /home/$MYUNAME/
chown -R ${MYUNAME}:cgts /home/$MYUNAME