Update TTYd installation

-Now copies passwd from /etc to /opt/etc in the case of SELINUX is enabled on the module
-Sets the root user's home folder to /usrdata/root to allow for default writability and more available space
-Creates a .profile to be placed in the home directory that sets the correct $PATH This file can be used to execute a startup menu later.
-Creates /usrdata/root/bin for binaries to be pushed to later. This is added to the $PATH as well by .profile
This commit is contained in:
Cameron Thompson
2024-03-24 20:17:23 -04:00
committed by GitHub
parent e1fb14118b
commit 93621b3f64

View File

@@ -818,8 +818,17 @@ install_ttyd() {
exit 1
fi
# Replacing the login and passwd binaries
# Replacing the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/passwd /opt/etc
mkdir /usrdata/root
mkdir /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
cp /etc/shadow /opt/etc/
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin