Update ttyd scripts

This commit is contained in:
Mo 2023-08-13 02:00:47 +02:00
parent 45de0a56eb
commit d240bb5c2e
6 changed files with 25 additions and 56 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env fish
if test -z $argv[1]
echo "A container number as an argument is required!"
echo "A container number is required as the first argument!"
exit 1
end
@ -12,7 +12,7 @@ set -l container_home_dir $container_volumes_dir/home
mkdir -p $container_volumes_dir
if not test -d $container_home_dir
cp -r ~/sync/volumes/fedora_home $container_home_dir
cp -r ~/fedora_home_clone $container_home_dir
end
podman-default-create \

8
images/ttyd/buildah_unshare.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
MNT=$(buildah mount builder)
rm -rf ~/fedora_home_clone
cp -r $MNT/home/student ~/fedora_home_clone
buildah unmount builder

View file

@ -1,16 +1,12 @@
#!/usr/bin/env fish
if podman image exists ttyd
if not podman rmi ttyd
exit 1
end
end
# Clean up
podman rmi -i ttyd
buildah rm builder &>/dev/null
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest
# Remove flag that prevents installing docs
# Remove the flag that prevents installing docs
buildah run builder -- sed -i /nodocs/d /etc/dnf/dnf.conf
buildah run builder -- dnf update -y
@ -20,7 +16,6 @@ set -l installed_packages (buildah run builder -- dnf list --installed | tail -n
buildah run builder -- dnf reinstall -y $installed_packages
buildah run builder -- dnf install -y \
cargo \
fish \
git \
htop \
@ -28,25 +23,28 @@ buildah run builder -- dnf install -y \
man-db \
man-pages \
nano \
neovim \
openssh-clients \
# openssh-clients \
openssl-devel \
passwd \
procps-ng \
# procps-ng \
python3 \
python3-ipython \
rsync \
tree \
util-linux
tree
# util-linux
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean all
buildah run builder -- dnf clean -y all
set -l user_password "student:$STUDENT_USER_PASSWORD"
set -l user_credentials "student:$STUDENT_USER_PASSWORD"
buildah run builder -- useradd student
buildah run builder -- bash -c "echo $user_password | chpasswd"
buildah run builder -- bash -c "echo $user_credentials | chpasswd"
buildah run builder -- usermod -aG wheel student
# Install Rust
buildah run builder -- bash -c "runuser -u student -- bash -c \"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\""
buildah unshare -- sh (status dirname)/buildah_unshare.sh
buildah config \
--workingdir /home/student \
--cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -c $TTYD_USER:$TTYD_PASSWORD bash'" \

View file

@ -1,2 +0,0 @@
# ~/.bash_logout

View file

@ -1,8 +0,0 @@
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs

View file

@ -1,27 +0,0 @@
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc