User setup and erlang installation

A bit fiddly, but this lets us run a realistic erlang install script
from userspace, and then re-enter userspace later without wiping the
installation.
This commit is contained in:
Jarvis Carroll
2025-05-23 21:21:16 +10:00
parent 4f6ee7cc88
commit 28de550295
7 changed files with 204 additions and 13 deletions
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
sudo apt install erlang-base
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Noninteractive, so that other scripts can install things with apt.
export DEBIAN_FRONTEND=noninteractive
# Overwrite locale setting specified before the chroot
export LANG=C
export LC_ALL=C
# Install sudo, since most user-facing scripts will use sudo
apt install sudo
# Add a passwordless sudoer
useradd -m -s /bin/bash -G sudo user
passwd -d user
echo "user ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/user"
chmod 0440 "/etc/sudoers.d/user"
# Copy the install scripts into their home directory
cp -r ~/install_scripts /home/user
chown -R user:user /home/user/install_scripts
# su to this new user... Or sudo -iu, since we want to pass in arguments too.
cd /home/user
sudo -iu user "$@"