Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ROOT_UID=0
- SUCCESS=0
- E_USEREXISTS=70
- ######
- # If this file wont run preform ther commands:
- # sudo apt install dos2unix
- # sudo dos2unix -f -n RunAsPi.bash ~/Fixed_RunAsPi.bash
- #######
- # Credentials of the tmux window user
- username="default"
- password="DankMeme"
- read -s -p "Enter password for user mathijs : " mathijs_password
- if [ "$UID" -ne "$ROOT_UID" ]
- then
- echo "Must be root to run this script."
- exit $E_NOTROOT
- fi
- apt update -y && apt upgrade -y && apt install git byobu htop ethstatus mplayer links tmux -y
- groupadd -g 10000 administrators
- useradd -p `mkpasswd "$password"` -d /home/"$username" -m -g users -s /bin/bash "$username"
- useradd -p `mkpasswd "$mathijs_password"` -d /home/"mathijs" -m -g administrators,users,sudo -s /bin/bash "mathijs"
- echo "the account is setup"
- touch /etc/systemd/system/getty@tty1.service.d/autologin.conf
- echo "[Service]" >> /etc/systemd/system/getty@tty1.service.d/autologin.conf
- echo "ExecStart=" >> /etc/systemd/system/getty@tty1.service.d/autologin.conf
- echo "ExecStart=-/sbin/agetty --autologin $username --noclear %I 38400 linux" >> /etc/systemd/system/getty@tty1.service.d/autologin.conf
- chmod +x /etc/systemd/system/getty@tty1.service.d/autologin.conf
- echo 'alias tmux_setup="if [ -z "$TMUX" ]; \' >> /home/$username/.bashrc
- echo "then echo 'Not inside TMUX! Aborting...'; else ~/scripts/tmux_setup.bash;fi\"" >> /home/$username/.bashrc
- mkdir /opt/scripts
- echo "#!/bin/bash" >> /opt/scripts/tmux_setup.bash
- echo " " >> /opt/scripts/tmux_setup.bash
- echo "tmux set -g pane-border-fg green" >> /opt/scripts/tmux_setup.bash
- echo "tmux set -g pane-border-bg black" >> /opt/scripts/tmux_setup.bash
- echo "tmux set -g pane-active-border-fg red" >> /opt/scripts/tmux_setup.bash
- echo "tmux set -g pane-active-border-bg black" >> /opt/scripts/tmux_setup.bash
- echo "tmux split-window -h \"bash -c 'while true; do htop;done'\"" >> /opt/scripts/tmux_setup.bash
- echo "tmux resize-pane -R 41" >> /opt/scripts/tmux_setup.bash
- echo "tmux split-window -v \"bash -c 'while true; do ethstatus -i eth0;done'\"" >> /opt/scripts/tmux_setup.bash
- echo "tmux resize-pane -D 10" >> /opt/scripts/tmux_setup.bash
- echo "tmux select-pane -L" >> /opt/scripts/tmux_setup.bash
- echo "tmux split-window -v \"bash -c 'while true; do echo'Netstat IPv4'; netstat -4; sleep 5; clear; done'\"" >> /opt/scripts/tmux_setup.bash
- echo "tmux split-window -v \"bash -c 'while true; do echo'Netstat IPv6'; netstat -6; sleep 5; clear; done'\"" >> /opt/scripts/tmux_setup.bash
- echo "tmux select-pane -L" >> /opt/scripts/tmux_setup.bash
- echo "tmux select-pane -U" >> /opt/scripts/tmux_setup.bash
- echo "reset" >> /opt/scripts/tmux_setup.bash
- echo "bash" >> /opt/scripts/tmux_setup.bash
- echo "[ -r /home/$username/.byobu/prompt ] && . /home/$username/.byobu/prompt #byobu-prompt#" >> /home/$username/.bashrc
- su -c "byobu-enable-prompt" $username
- echo "byobu new-session -s \"Default_Session\" /opt/scripts/tmux_setup.bash" >> /home/$username/.profile
- chown $username:administrators -R /home/$username/
- chown mathijs:administrators -R /opt/scripts/
- chmod 575 -R /home/$username/
- chmod 775 -R /opt/scripts/
- chmod 775 /home/$username/.byobu/
- chmod 775 -R /home/$username/.byobu/bin/
- echo "************************************************************"
- echo "DONE"
- echo "************************************************************"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement