Jay Faulkner f831b3d0b6 [gentoo] Fix+Update CI for 23.0 profile
- Adjusts how we remove pacakges. Gentoo maintains a list of packages
  that the user has requested be installed called "world". By
  deselecting the packages, we remove them from this list, and at the
  end, call depclean which will uninstall packages no longer selected or
  needed as dependencies.
- Updates profile logic. We should theoretically be able to support any
  new gentoo profile, without having to maintain a static list ourself
  by just updating the base.
- Updates CI job to use default profile as determined by the gentoo
  element. This basically eliminates one more place we need to update
  profiles on change.
- Ensures we install installkernel with USE=+grub so we actually install
  the kernel
- Do not use testing (~amd64) packages unless absolutely neccessary
- Fix growroot openrc initscript to use /sbin/openrc-run instead of
  deprecated-and-now-removed /sbin/runscript.

Change-Id: Ie9d2ab67d72114603034374854bb3a3d52de8ca4
2024-11-20 12:07:08 -08:00

36 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
user_shell_args=
if [ -n "${DIB_DEV_USER_SHELL}" ]; then
user_shell_args="-s ${DIB_DEV_USER_SHELL}"
fi
useradd -m ${DIB_DEV_USER_USERNAME} $user_shell_args
set +x
if [ -n "${DIB_DEV_USER_PASSWORD}" ]; then
echo "Setting password."
echo "${DIB_DEV_USER_USERNAME}:${DIB_DEV_USER_PASSWORD}" | chpasswd
fi
set -x
if [ -n "${DIB_DEV_USER_PWDLESS_SUDO}" ]; then
mkdir -p /etc/sudoers.d/
cat > /etc/sudoers.d/${DIB_DEV_USER_USERNAME} << EOF
${DIB_DEV_USER_USERNAME} ALL=(ALL) NOPASSWD:ALL
EOF
chmod 0440 /etc/sudoers.d/${DIB_DEV_USER_USERNAME}
visudo -c || rm /etc/sudoers.d/${DIB_DEV_USER_USERNAME}
fi
if [ -f /tmp/in_target.d/devuser-ssh-authorized-keys ]; then
mkdir -p /home/${DIB_DEV_USER_USERNAME}/.ssh
cp /tmp/in_target.d/devuser-ssh-authorized-keys /home/${DIB_DEV_USER_USERNAME}/.ssh/authorized_keys
fi
chown -R ${DIB_DEV_USER_USERNAME}:${DIB_DEV_USER_USERNAME} /home/${DIB_DEV_USER_USERNAME}