Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef29887a40 | |||
| 67e55e37bb | |||
| b01e957dfa | |||
| 5940c1e4e8 | |||
| 4a2afa57e0 | |||
| eb785117d7 | |||
| eb74659abf | |||
| 3cd8e0bea6 | |||
| 651f9280c9 | |||
| 10ca7032ef | |||
| 00ef7ab4b7 | |||
| 95d3a9ccd9 | |||
| ee9d49cba5 | |||
| d1e9a179fc | |||
| 3bdee6bd3e | |||
| c76a1c3613 | |||
| d92f9cebb8 | |||
| 14fc513e70 | |||
| f9ad27df20 | |||
| e4fa735c71 | |||
| 40b802a418 | |||
| 643bc897f3 | |||
| aefd8d032a | |||
| 531f4bdaa4 | |||
| 1858524a0f | |||
| 95ae6ffa2f | |||
| 74b3a695cb | |||
| bed96e3b77 | |||
| 78dd888b98 | |||
| 1f99185b38 | |||
| 8cb69931a6 |
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1,15 +0,0 @@
|
|||||||
# ---> Linux
|
|
||||||
*~
|
|
||||||
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# RPS-Light-PXE
|
# RPS-Client
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wget -qO- --header 'Authorization:token 9031f8d227dd83ba601680bf3a9f6c2d26c1a970' https://gitea.int.eertmoed.net/WiS/RPS-Light-PXE/archive/latest.tar.gz| tar xvz ; bash ./rps-light-pxe/install.sh ;
|
wget -qO- --header 'Authorization:token 9031f8d227dd83ba601680bf3a9f6c2d26c1a970' https://gitea.int.eertmoed.net/WiS/RPS-Client/archive/latest.tar.gz | tar xvz ; bash ./rps-client/install.sh ;
|
||||||
```
|
```
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# Version 1.0:
|
# Version 1.1:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
```
|
```
|
||||||
@@ -3,15 +3,16 @@ Description=A Service to monitor the Kiosk's current site
|
|||||||
After=network.target getty@tty1.service
|
After=network.target getty@tty1.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
# Wait until Chromium is running
|
ExecStartPre=-/bin/sleep 120
|
||||||
ExecStartPre=-/bin/bash -c 'while ! pgrep -f chromium-browser > /dev/null; do sleep 5; done'
|
|
||||||
ExecStartPre=-/usr/bin/sleep 20
|
|
||||||
Type=simple
|
Type=simple
|
||||||
User=loginuser
|
|
||||||
ExecStart=/usr/bin/chromium-monitor
|
ExecStart=/usr/bin/chromium-monitor
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
StandardOutput=append:/var/log/chromium-monitor
|
||||||
|
StandardError=append:/var/log/chromium-monitor
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
# Version 1.0:
|
# Version 1.1:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -7,9 +7,12 @@ ExecStartPre=-/bin/sleep 120
|
|||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/watchdog
|
ExecStart=/usr/bin/watchdog
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
StandardOutput=append:/var/log/watchdog
|
||||||
|
StandardError=append:/var/log/watchdog
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
# Version 1.0:
|
# Version 1.1:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
1
home/wis/.ssh/id_rsa.pub
Normal file
1
home/wis/.ssh/id_rsa.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCYDmONGe644a3bWKAyX1W704B8fCwlj4x/QjwyJX6gKpX2hmtrxZtusK729wTxP0lr1Gzll9A8LAEGqW5/sxxJqwtYDMOEfINsgE8fmvg9XSmJ9t5zOxJAuQfJB/dmE2a2mX3VSH740czvJ6NKlf9BUeu+41ZZUilyHngfgpVxEIED/6ZHRrkMUfaY09IfvwmNiYPTtK4cufLBdeEoNJPQvYdY1i+N+cJstUzlDRs179w8CqLPuPhIb0iQ3WO1S1XXQH4vUm4MaMmK+hDR4J/pfhuI3DXulwE04rZFU2izXQwl5VdYLv8w31gcegyRz68p+LprusY4QiDP62yaUCTE6JdrjjQSxbEag+OqCzozfvoO+SxMdWsxg2eViM4sKTODc0cQBSA4HJcDWeag5LU9k4WGeuVVj8BCCBqh+93IqylqyK7AKMztVZNiftSBEbfK8ZoHawg5PM26LtCTz6YcmGhn/dHpcpyC8606+SHSTl5YinDaRjarCBM4nppD3o5pizVFKutI28Ys3wkVAe96njnJqIi/J5tNQgrbJmteCE3/9SWhpsXjnuZX1RaZYLE3bBg8Gisz/sm7rN3acVXe6QD03PIxwn9Xp8r3avzDkQKo4vqxoYK6JF6j3vs+U4WLElq+NtvuMewfAWF2cgL2quognLWUM5s0p1/zLzxa8w==
|
||||||
99
install.sh
99
install.sh
@@ -6,80 +6,81 @@ NC='\033[0m' # No Color
|
|||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
# Function to print status with a checkmark
|
||||||
|
print_status() {
|
||||||
|
echo -e "${GREEN}✔${NC} ${1} completed."
|
||||||
|
}
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Starting System Update..."
|
echo -e "${RED}→${NC} Starting System Update..."
|
||||||
sudo apt update >/dev/null 2>&1 && sudo apt upgrade -y >/dev/null 2>&1 && sudo apt dist-upgrade -y >/dev/null 2>&1 && sudo apt autoremove -y >/dev/null 2>&1 && sudo apt clean -y >/dev/null 2>&1
|
sudo apt update >>/var/log/install 2>&1 && print_status "System Update"
|
||||||
echo -e "${GREEN}✔${NC} System Update Completed..."
|
sudo apt upgrade -y >>/var/log/install 2>&1 && print_status "System Upgrade"
|
||||||
|
sudo apt dist-upgrade -y >>/var/log/install 2>&1 && print_status "System Dist-Upgrade"
|
||||||
|
sudo apt autoremove -y >>/var/log/install 2>&1 && print_status "Autoremove"
|
||||||
|
sudo apt clean >>/var/log/install 2>&1 && print_status "Clean"
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Installing required packages..."
|
echo -e "${RED}→${NC} Installing required packages..."
|
||||||
sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit chromium-browser fonts-noto-color-emoji nfs-common watchdog xdotool rsync -y >/dev/null 2>&1
|
sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit chromium-browser fonts-noto-color-emoji nfs-common watchdog xdotool rsync -y >>/var/log/install 2>&1 && print_status "Required packages installed"
|
||||||
echo -e "${GREEN}✔${NC} Required packages installed..."
|
sudo apt install realvnc-vnc-server overlayroot -y >>/var/log/install 2>&1 && print_status "VNC and Overlayroot installed"
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Creating user 'loginuser'..."
|
echo -e "${RED}→${NC} Creating user 'loginuser'..."
|
||||||
sudo adduser --disabled-password --gecos "" loginuser >/dev/null 2>&1
|
sudo adduser --disabled-password --gecos "" loginuser >>/var/log/install 2>&1 && print_status "User 'loginuser' created"
|
||||||
echo -e "${GREEN}✔${NC} User 'loginuser' created..."
|
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Setting permissions for 'loginuser'..."
|
echo -e "${RED}→${NC} Setting permissions for 'loginuser'..."
|
||||||
sudo tee /etc/sudoers.d/loginuser >/dev/null << 'EOF'
|
sudo tee /etc/sudoers.d/loginuser >/dev/null << 'EOF'
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart watchdog
|
loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart watchdog, /usr/bin/systemctl restart chromium-monitor
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/echo
|
loginuser ALL=(ALL) NOPASSWD: /usr/bin/echo, /usr/bin/cp, /usr/bin/sed
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cp
|
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/reboot, /usr/sbin/dhclient eth0, /usr/bin/fbset
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/sed
|
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/reboot
|
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/dhclient eth0
|
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/fbset
|
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cat /var/lib/dhcp/*
|
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cat /var/lib/dhcp/*
|
||||||
EOF
|
EOF
|
||||||
sudo usermod -aG video loginuser >/dev/null 2>&1
|
sudo usermod -aG video loginuser >>/var/log/install 2>&1 && print_status "Permissions for 'loginuser' set"
|
||||||
echo -e "${GREEN}✔${NC} Permissions for 'loginuser' set..."
|
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Disabling root login..."
|
echo -e "${RED}→${NC} Disabling root login..."
|
||||||
sudo tee /etc/ssh/sshd_config >/dev/null << 'EOF'
|
sudo tee /etc/ssh/sshd_config >/dev/null << 'EOF'
|
||||||
PermitRootLogin no
|
PermitRootLogin no
|
||||||
EOF
|
EOF
|
||||||
sudo passwd -l root >/dev/null 2>&1
|
sudo passwd -l root >>/var/log/install 2>&1 && print_status "Root login disabled"
|
||||||
echo -e "${GREEN}✔${NC} Root login disabled..."
|
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Copying required files..."
|
echo -e "${RED}→${NC} Copying required files..."
|
||||||
sudo rm ./rps-light-pxe/.gitignore ./rps-light-pxe/LICENSE ./rps-light-pxe/README.md >/dev/null 2>&1
|
sudo rsync -a --numeric-ids --info=progress2 --no-owner --no-group \
|
||||||
sudo cp -r ./rps-light-pxe/ / >/dev/null 2>&1
|
./rps-client/boot/ro-root.sh /boot/ro-root.sh \
|
||||||
echo -e "${GREEN}✔${NC} Required files copied..."
|
./rps-client/boot/firmware/ro-root.sh /boot/firmware/ro-root.sh \
|
||||||
|
./rps-client/etc/dhcp/dhclient.conf /etc/dhcp/dhclient.conf \
|
||||||
|
./rps-client/etc/systemd/system/watchdog.service /etc/systemd/system/watchdog.service \
|
||||||
|
./rps-client/etc/systemd/system/chromium-monitor.service /etc/systemd/system/chromium-monitor.service \
|
||||||
|
./rps-client/etc/systemd/system/getty@tty1.service.d/override.conf /etc/systemd/system/getty@tty1.service.d/override.conf \
|
||||||
|
./rps-client/etc/chromium/policies/managed/disable_password_saving.json /etc/chromium/policies/managed/disable_password_saving.json \
|
||||||
|
./rps-client/home/loginuser/.bash_profile /home/loginuser/.bash_profile \
|
||||||
|
./rps-client/home/loginuser/.xinitrc /home/loginuser/.xinitrc \
|
||||||
|
./rps-client/home/wis/.ssh/id_rsa.pub /home/wis/.ssh/id_rsa.pub \
|
||||||
|
./rps-client/root/remove_unused_kernel.sh /root/remove_unused_kernel.sh \
|
||||||
|
./rps-client/root/.vnc/config.d/vncserver-x11 /root/.vnc/config.d/vncserver-x11 \
|
||||||
|
./rps-client/usr/bin/chromium-monitor /usr/bin/chromium-monitor \
|
||||||
|
./rps-client/usr/bin/watchdog /usr/bin/watchdog >>/var/log/install 2>&1 && print_status "Required files copied"
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Setting file permissions..."
|
echo -e "${RED}→${NC} Setting file permissions..."
|
||||||
sudo chown loginuser:loginuser /home/loginuser/.xinitrc >/dev/null 2>&1
|
sudo chown loginuser:loginuser -R /home/loginuser >>/var/log/install 2>&1 && print_status "File permissions set"
|
||||||
sudo chown loginuser:loginuser /home/loginuser/.bash_profile >/dev/null 2>&1
|
|
||||||
sudo chmod +x /root/remove_unused_kernel.sh >/dev/null 2>&1
|
|
||||||
sudo chmod +x /usr/bin/watchdog >/dev/null 2>&1
|
|
||||||
sudo chmod +x /usr/bin/chromium-monitor >/dev/null 2>&1
|
|
||||||
echo -e "${GREEN}✔${NC} File permissions set..."
|
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Enabling services..."
|
echo -e "${RED}→${NC} Enabling services..."
|
||||||
sudo systemctl daemon-reload >/dev/null 2>&1
|
sudo systemctl daemon-reload >>/var/log/install 2>&1 && print_status "Daemon reloaded"
|
||||||
sudo systemctl enable watchdog >/dev/null 2>&1
|
sudo systemctl enable watchdog chromium-monitor vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "Services enabled"
|
||||||
sudo systemctl enable chromium-monitor >/dev/null 2>&1
|
sudo systemctl restart getty@tty1 >>/var/log/install 2>&1 && print_status "getty service restarted"
|
||||||
sudo systemctl enable getty@tty1 >/dev/null 2>&1
|
|
||||||
echo -e "${GREEN}✔${NC} Services enabled..."
|
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Cleaning up old kernels..."
|
# Ask user about cleaning unused kernels
|
||||||
sudo bash /root/remove_unused_kernel.sh -u -e >/dev/null 2>&1
|
echo -e "${RED}→${NC} Do you want to clean up unused kernels? (yes/y/ye to proceed):"
|
||||||
sudo rm /root/remove_unused_kernel.sh >/dev/null 2>&1
|
read -r clean_kernels
|
||||||
echo -e "${GREEN}✔${NC} Old kernels cleaned up..."
|
if [[ "$clean_kernels" =~ ^[Yy](e[Ss]?)?$ ]]; then
|
||||||
|
echo -e "${RED}→${NC} Cleaning up unused kernels..."
|
||||||
|
sudo bash /root/remove_unused_kernel.sh -u -e >>/var/log/install 2>&1 && print_status "Unused kernels cleaned up"
|
||||||
|
else
|
||||||
|
echo -e "${RED}→${NC} Skipping unused kernel cleanup."
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "${RED}→${NC} Cleaning up installer..."
|
echo -e "${RED}→${NC} Cleaning up installer..."
|
||||||
sudo rm -rf ./rps-light-pxe >/dev/null 2>&1
|
sudo rm -rf ./rps-client >>/var/log/install 2>&1 && print_status "Installer cleaned up"
|
||||||
echo -e "${GREEN}✔${NC} Installer cleaned up..."
|
|
||||||
|
|
||||||
echo -e "${GREEN}✔${NC} Installation complete. Press any key to reboot."
|
echo -e "${GREEN}✔${NC} Installation complete. Press any key to reboot..."
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
|
|
||||||
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null << 'EOF'
|
|
||||||
[Service]
|
|
||||||
ExecStart=
|
|
||||||
ExecStart=-/sbin/agetty --autologin loginuser --noclear %I $TERM
|
|
||||||
EOF
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl restart getty@tty1
|
|
||||||
sudo systemctl enable getty@tty1
|
|
||||||
sudo reboot
|
sudo reboot
|
||||||
|
|
||||||
# Version 1.0:
|
# Version 1.2:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
|
|||||||
1
root/.ssh/id_rsa.pub
Normal file
1
root/.ssh/id_rsa.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCYDmONGe644a3bWKAyX1W704B8fCwlj4x/QjwyJX6gKpX2hmtrxZtusK729wTxP0lr1Gzll9A8LAEGqW5/sxxJqwtYDMOEfINsgE8fmvg9XSmJ9t5zOxJAuQfJB/dmE2a2mX3VSH740czvJ6NKlf9BUeu+41ZZUilyHngfgpVxEIED/6ZHRrkMUfaY09IfvwmNiYPTtK4cufLBdeEoNJPQvYdY1i+N+cJstUzlDRs179w8CqLPuPhIb0iQ3WO1S1XXQH4vUm4MaMmK+hDR4J/pfhuI3DXulwE04rZFU2izXQwl5VdYLv8w31gcegyRz68p+LprusY4QiDP62yaUCTE6JdrjjQSxbEag+OqCzozfvoO+SxMdWsxg2eViM4sKTODc0cQBSA4HJcDWeag5LU9k4WGeuVVj8BCCBqh+93IqylqyK7AKMztVZNiftSBEbfK8ZoHawg5PM26LtCTz6YcmGhn/dHpcpyC8606+SHSTl5YinDaRjarCBM4nppD3o5pizVFKutI28Ys3wkVAe96njnJqIi/J5tNQgrbJmteCE3/9SWhpsXjnuZX1RaZYLE3bBg8Gisz/sm7rN3acVXe6QD03PIxwn9Xp8r3avzDkQKo4vqxoYK6JF6j3vs+U4WLElq+NtvuMewfAWF2cgL2quognLWUM5s0p1/zLzxa8w==
|
||||||
@@ -22,12 +22,12 @@ while true; do
|
|||||||
new_monitor_md5=$(echo -n ${new_monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
new_monitor_md5=$(echo -n ${new_monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
||||||
current_md5=$(echo -n ${new_current^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
current_md5=$(echo -n ${new_current^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
||||||
if [ "$new_monitor_md5" != "$monitor_md5" ] && [ "$current_md5" != "$monitor_md5" ]; then
|
if [ "$new_monitor_md5" != "$monitor_md5" ] && [ "$current_md5" != "$monitor_md5" ]; then
|
||||||
echo "Mismatch detected. Rebooting now."
|
echo "Mismatch detected. Rebooting now." >> /var/log/chromium-monitor
|
||||||
sudo reboot
|
sudo reboot
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Either monitor or current is not available, skipping check."
|
echo "Either monitor or current is not available, skipping check." >> /var/log/chromium-monitor
|
||||||
fi
|
fi
|
||||||
sleep 5s
|
sleep 5s
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ sudo sed -i '/^interval/d' "$config_file"
|
|||||||
echo "interval = 60" | sudo tee -a "$config_file" > /dev/null
|
echo "interval = 60" | sudo tee -a "$config_file" > /dev/null
|
||||||
if [ ${#ip_array[@]} -eq 0 ]; then
|
if [ ${#ip_array[@]} -eq 0 ]; then
|
||||||
sudo sed -i '/interval/d' "$config_file"
|
sudo sed -i '/interval/d' "$config_file"
|
||||||
echo "No IP addresses found. Watchdog configuration cleared." >&2
|
echo "No IP addresses found. Watchdog configuration cleared." >> /var/log/watchdog 2>&1
|
||||||
sudo systemctl stop watchdog
|
sudo systemctl stop watchdog
|
||||||
else
|
else
|
||||||
for ip in "${ip_array[@]}"; do
|
for ip in "${ip_array[@]}"; do
|
||||||
echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null
|
echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
sudo systemctl restart watchdog
|
sudo systemctl restart watchdog >> /var/log/watchdog 2>&1
|
||||||
|
|
||||||
# Version 1.0:
|
# Version 1.1:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
Reference in New Issue
Block a user