88 Commits
v1.1 ... v1.8

Author SHA1 Message Date
c8f88bb40a install.sh aktualisiert 2024-11-11 17:37:44 +01:00
18cd5a388d install.sh aktualisiert 2024-11-09 22:13:38 +01:00
4547c21cba install.sh aktualisiert 2024-11-08 12:46:38 +01:00
61a4fabac9 install.sh aktualisiert 2024-11-08 12:40:54 +01:00
8d57596072 home/loginuser/.xinitrc aktualisiert 2024-10-30 17:36:28 +01:00
4d072450c0 install.sh aktualisiert 2024-10-30 17:34:55 +01:00
16be62b878 install.sh aktualisiert 2024-10-30 10:10:25 +01:00
1853f2ff28 install.sh aktualisiert 2024-10-30 10:01:30 +01:00
5ff6d190c3 install.sh aktualisiert 2024-10-30 09:58:01 +01:00
9e7f59606c README.md aktualisiert 2024-10-30 09:35:00 +01:00
a70a362ce4 install.sh aktualisiert 2024-10-30 09:33:36 +01:00
5dc8681dfd home/loginuser/.xinitrc aktualisiert 2024-10-29 21:02:35 +01:00
c7a77796a1 install.sh aktualisiert 2024-10-29 20:59:57 +01:00
43b9640eb0 home/loginuser/.xinitrc aktualisiert 2024-10-29 20:57:22 +01:00
1510ce0758 home/loginuser/.xinitrc aktualisiert 2024-10-29 20:55:43 +01:00
a5cd4e6f2c home/loginuser/.xinitrc aktualisiert 2024-10-29 20:49:14 +01:00
488b0a6406 home/loginuser/.xinitrc aktualisiert 2024-10-29 20:37:08 +01:00
1720679c1b install.sh aktualisiert 2024-10-29 16:02:39 +01:00
689824ac04 install.sh aktualisiert 2024-10-29 15:41:39 +01:00
04e0b1a3b6 install.sh aktualisiert 2024-10-29 15:32:37 +01:00
e35bbc7d77 install.sh aktualisiert 2024-10-29 15:21:54 +01:00
620fe0c831 root/.vnc/config.d/vncserver-x11 gelöscht 2024-10-29 15:07:22 +01:00
16cfbefd83 install.sh aktualisiert 2024-10-29 14:54:19 +01:00
6341d49f76 usr/bin/custom/hostname aktualisiert 2024-10-29 14:52:32 +01:00
dcde376e95 usr/bin/custom/chromium-monitor aktualisiert 2024-10-29 14:51:46 +01:00
ce9bafa069 install.sh aktualisiert 2024-10-29 14:32:20 +01:00
3e711f04fe install.sh aktualisiert 2024-10-29 14:24:31 +01:00
b239b564f1 install.sh aktualisiert 2024-10-29 14:13:57 +01:00
777d3981f0 install.sh aktualisiert 2024-10-29 13:52:37 +01:00
6f1498f422 install.sh aktualisiert 2024-10-29 13:41:46 +01:00
514cc91ed5 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-29 13:41:05 +01:00
0378024409 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-29 13:22:34 +01:00
5f2cd53026 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 20:21:20 +01:00
b2d2a89ca3 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 20:18:11 +01:00
859759a253 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 20:10:09 +01:00
a20d85f543 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 20:05:13 +01:00
7b46dc4e73 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:59:31 +01:00
63a40835b6 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:58:33 +01:00
39ee07fe14 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:48:27 +01:00
2a1dac448a usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:47:12 +01:00
c5ed7dde10 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:37:17 +01:00
af0b0c7bb1 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 19:29:33 +01:00
259e0d7f3a install.sh aktualisiert 2024-10-28 19:26:53 +01:00
fc1f25477d install.sh aktualisiert 2024-10-28 19:22:05 +01:00
d754b93250 install.sh aktualisiert 2024-10-28 19:19:44 +01:00
11451b03be etc/systemd/system/watchdog-monitor.service aktualisiert 2024-10-28 19:04:32 +01:00
068d6ac9a5 install.sh aktualisiert 2024-10-28 19:04:08 +01:00
b58147b391 etc/systemd/system/chromium-monitor.service aktualisiert 2024-10-28 19:01:11 +01:00
86b3bdae71 etc/systemd/system/watchdog-monitor.service aktualisiert 2024-10-28 19:00:47 +01:00
cdfd6359da usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 18:59:56 +01:00
bf0b5e857f usr/bin/custom/watchdog aktualisiert 2024-10-28 18:53:03 +01:00
9b85eddf09 usr/bin/custom/watchdog aktualisiert 2024-10-28 18:45:05 +01:00
0d5e790cd2 usr/bin/custom/watchdog-monitor aktualisiert 2024-10-28 18:29:13 +01:00
7d05ae6fa4 etc/systemd/system/chromium-monitor.service aktualisiert 2024-10-28 17:22:16 +01:00
0dc0236f40 etc/systemd/system/watchdog.service aktualisiert 2024-10-28 17:21:55 +01:00
f65185644d install.sh aktualisiert 2024-10-28 17:15:43 +01:00
73ea27ac67 usr/bin/custom/chromium-monitor aktualisiert 2024-10-28 16:59:11 +01:00
d012e5193d usr/bin/custom/chromium-monitor aktualisiert 2024-10-28 16:41:08 +01:00
6a631c3aee install.sh aktualisiert 2024-10-28 16:08:29 +01:00
7276958e0b install.sh aktualisiert 2024-10-28 15:40:26 +01:00
5f9f63d026 etc/systemd/system/chromium-monitor.service aktualisiert 2024-10-28 15:29:25 +01:00
b6d889a348 etc/systemd/system/watchdog.service aktualisiert 2024-10-28 15:29:05 +01:00
e511fcb885 install.sh aktualisiert 2024-10-28 15:23:43 +01:00
57b5cd5397 install.sh aktualisiert 2024-10-28 14:11:42 +01:00
26058e12f7 usr/bin/custom/hostname aktualisiert 2024-10-28 14:06:16 +01:00
134a398fb9 usr/bin/custom/hostname aktualisiert 2024-10-28 14:05:07 +01:00
4b607c3ad8 etc/systemd/system/hostname.service hinzugefügt 2024-10-28 14:03:39 +01:00
1d22c6dc07 usr/bin/hostname hinzugefügt 2024-10-28 14:02:25 +01:00
0b8a9d2ba6 install.sh aktualisiert 2024-10-28 13:51:09 +01:00
b921505906 etc/systemd/system/watchdog.service aktualisiert 2024-10-28 13:45:55 +01:00
b39edf6343 etc/systemd/system/chromium-monitor.service aktualisiert 2024-10-28 13:45:43 +01:00
0d081f2380 install.sh aktualisiert 2024-10-28 13:45:03 +01:00
8038479898 usr/bin/custom/watchdog aktualisiert 2024-10-28 13:43:46 +01:00
8fe03e7cad usr/bin/custom/chromium-monitor aktualisiert 2024-10-28 13:43:36 +01:00
83c6f7de70 install.sh aktualisiert 2024-10-28 13:41:40 +01:00
dece859ca8 install.sh aktualisiert 2024-10-28 13:04:35 +01:00
0d1a2b7c21 usr/bin/watchdog aktualisiert 2024-10-28 13:02:32 +01:00
d96260222c usr/bin/chromium-monitor aktualisiert 2024-10-28 13:01:36 +01:00
54d218451a etc/systemd/system/watchdog.service aktualisiert 2024-10-28 09:54:46 +01:00
ef29887a40 root/.ssh/id_rsa.pub hinzugefügt 2024-10-27 18:36:19 +01:00
67e55e37bb roo/.ssh/id_rsa.pub gelöscht 2024-10-27 18:36:02 +01:00
b01e957dfa roo/.ssh/id_rsa.pub hinzugefügt 2024-10-27 18:35:44 +01:00
5940c1e4e8 .gitignore gelöscht 2024-10-27 18:33:04 +01:00
4a2afa57e0 install.sh aktualisiert 2024-10-27 18:32:45 +01:00
eb785117d7 etc/systemd/system/watchdog.service aktualisiert 2024-10-27 18:27:11 +01:00
eb74659abf etc/systemd/system/chromium-monitor.service aktualisiert 2024-10-27 18:26:12 +01:00
3cd8e0bea6 usr/bin/watchdog aktualisiert 2024-10-27 18:23:34 +01:00
651f9280c9 usr/bin/chromium-monitor aktualisiert 2024-10-27 18:21:21 +01:00
14 changed files with 347 additions and 125 deletions

15
.gitignore vendored
View File

@@ -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*

View File

@@ -1,7 +1,7 @@
# RPS-Client # RPS-Client
```bash ```bash
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 ; wget -qO- --header 'Authorization:token 9031f8d227dd83ba601680bf3a9f6c2d26c1a970' https://gitea.int.eertmoed.net/WiS/RPS-Client/archive/latest.tar.gz | tar xvz ; bash /root/rps-client/install.sh ;
``` ```
```ruby ```ruby

View File

@@ -1,12 +1,11 @@
[Unit] [Unit]
Description=A Service to monitor the Kiosk's current site Description=A Service to monitor the Kiosk's current site
After=network.target getty@tty1.service After=network.target
[Service] [Service]
ExecStartPre=-/bin/sleep 120
Type=simple Type=simple
ExecStart=/usr/bin/chromium-monitor User=loginuser
Restart=on-failure ExecStart=/usr/bin/custom/chromium-monitor
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Set Hostname from DHCP
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/custom/hostname
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@@ -1,15 +1,13 @@
[Unit] [Unit]
Description=Watchdog Monitor Service Description=Watchdog Monitor Service
After=network.target getty@tty1.service After=network.target
[Service] [Service]
ExecStartPre=-/bin/sleep 120
Type=simple Type=simple
ExecStart=/usr/bin/watchdog ExecStart=/usr/bin/custom/watchdog-monitor
Restart=on-failure
[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.

View File

@@ -14,7 +14,8 @@ then
xset s noblank xset s noblank
xset s off xset s off
else else
xset s $SCREEN xset +dpms
xset dmps 0 0 $SCREEN
fi fi
#NO-Var fallback site #NO-Var fallback site
@@ -23,7 +24,11 @@ then
WBS=https://www.wis.gmbh/ WBS=https://www.wis.gmbh/
fi fi
#Start Chromium sudo systemctl stop watchdog-monitor
sudo systemctl stop chromium-monitor
sudo systemctl start watchdog-monitor
sudo systemctl start chromium-monitor
chromium-browser $WBS \ chromium-browser $WBS \
--window-size=$RES \ --window-size=$RES \
--window-position=0,0 \ --window-position=0,0 \

View File

@@ -11,69 +11,164 @@ print_status() {
echo -e "${GREEN}${NC} ${1} completed." echo -e "${GREEN}${NC} ${1} completed."
} }
echo -e "${RED}${NC} Starting System Update..." echo -e "${RED}${NC} Starting System Update..." | tee -a /var/log/install
sudo apt update >>/var/log/install 2>&1 && print_status "System Update" sudo apt update >>/var/log/install 2>&1 && print_status "System Update"
sudo apt upgrade -y >>/var/log/install 2>&1 && print_status "System Upgrade" 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 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..." | tee -a /var/log/install
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" 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"
sudo apt install realvnc-vnc-server overlayroot -y >>/var/log/install 2>&1 && print_status "VNC and Overlayroot installed" sudo apt install realvnc-vnc-server overlayroot -y >>/var/log/install 2>&1 && print_status "VNC and Overlayroot installed"
sudo apt autoremove -y >>/var/log/install 2>&1 && print_status "Autoremove"
sudo apt clean >>/var/log/install 2>&1 && print_status "Clean"
rm -rf /var/lib/apt/lists/* >>/var/log/install 2>&1 && print_status "Clear cache"
echo -e "${RED}${NC} Creating user 'loginuser'..." echo -e "${RED}${NC} Configuring Raspberry Pi settings..." | tee -a /var/log/install
sudo raspi-config nonint do_camera 0 >> /var/log/install 2>&1 && print_status "Camera disabled"
sudo raspi-config nonint do_vnc 0 >> /var/log/install 2>&1 && print_status "VNC enabled"
sudo raspi-config nonint do_spi 0 >> /var/log/install 2>&1 && print_status "SPI disabled"
sudo raspi-config nonint do_i2c 0 >> /var/log/install 2>&1 && print_status "I2C disabled"
sudo raspi-config nonint do_serial 0 0 >> /var/log/install 2>&1 && print_status "Serial port disabled"
sudo raspi-config nonint do_onewire 0 >> /var/log/install 2>&1 && print_status "1-Wire disabled"
sudo raspi-config nonint do_remote_gpio 0 >> /var/log/install 2>&1 && print_status "Remote GPIO disabled"
sudo raspi-config nonint do_gpu_memory 256 >> /var/log/install 2>&1 && print_status "GPU memory set to 256MB"
sudo raspi-config nonint do_locale "de_DE.UTF-8" "de_DE.UTF-8" >> /var/log/install 2>&1 && print_status "Locale set to de_DE.UTF-8"
sudo raspi-config nonint do_timezone "Europe/Berlin" >> /var/log/install 2>&1 && print_status "Timezone set to Europe/Berlin"
sudo raspi-config nonint do_boot_order 3 >> /var/log/install 2>&1 && print_status "Boot order set to network boot"
echo -e "${RED}${NC} Creating user 'loginuser'..." | tee -a /var/log/install
sudo adduser --disabled-password --gecos "" loginuser >>/var/log/install 2>&1 && print_status "User 'loginuser' created" sudo adduser --disabled-password --gecos "" loginuser >>/var/log/install 2>&1 && print_status "User 'loginuser' created"
echo -e "${RED}${NC} Setting permissions for 'loginuser'..." echo -e "${RED}${NC} Copy requiered files..." | tee -a /var/log/install
mkdir -p /etc/chromium/policies/managed /home/wis/.ssh /usr/bin/custom
declare -A files=(
["/root/rps-client/boot/ro-root.sh"]="/boot/ro-root.sh"
["/root/rps-client/boot/firmware/ro-root.sh"]="/boot/firmware/ro-root.sh"
["/root/rps-client/etc/dhcp/dhclient.conf"]="/etc/dhcp/dhclient.conf"
["/root/rps-client/etc/systemd/system/hostname.service"]="/etc/systemd/system/hostname.service"
["/root/rps-client/etc/systemd/system/watchdog-monitor.service"]="/etc/systemd/system/watchdog-monitor.service"
["/root/rps-client/etc/systemd/system/chromium-monitor.service"]="/etc/systemd/system/chromium-monitor.service"
["/root/rps-client/etc/systemd/system/getty@tty1.service.d/override.conf"]="/etc/systemd/system/getty@tty1.service.d/override.conf"
["/root/rps-client/etc/chromium/policies/managed/disable_password_saving.json"]="/etc/chromium/policies/managed/disable_password_saving.json"
["/root/rps-client/home/loginuser/.bash_profile"]="/home/loginuser/.bash_profile"
["/root/rps-client/home/loginuser/.xinitrc"]="/home/loginuser/.xinitrc"
["/root/rps-client/home/wis/.ssh/id_rsa.pub"]="/home/wis/.ssh/id_rsa.pub"
["/root/rps-client/root/remove_unused_kernel.sh"]="/root/remove_unused_kernel.sh"
["/root/rps-client/usr/bin/custom/hostname"]="/usr/bin/custom/hostname"
["/root/rps-client/usr/bin/custom/chromium-monitor"]="/usr/bin/custom/chromium-monitor"
["/root/rps-client/usr/bin/custom/watchdog-monitor"]="/usr/bin/custom/watchdog-monitor"
)
RSYNC_OPTS="-a --numeric-ids --info=progress2 --no-owner --no-group"
for src in "${!files[@]}"; do
dst="${files[$src]}"
echo "Copying $src to $dst..."
sudo rsync $RSYNC_OPTS "$src" "$dst" >>/var/log/install 2>&1 && print_status "$src copied to $dst"
done
print_status "All files have been successfully copied"
echo -e "${RED}${NC} Configuring VNC..." | tee -a /var/log/install
sudo systemctl enable vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "VNC service enabled"
sudo systemctl start vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "VNC service started"
CONFIG_FILE="/root/.vnc/config.d/vncserver-x11"
if [ ! -d "$(dirname "$CONFIG_FILE")" ]; then
mkdir -p "$(dirname "$CONFIG_FILE")"
echo -e "${GREEN}${NC} Created directory for VNC config." | tee -a /var/log/install
fi
read -p "Do you want to set a VNC password? (y/n): " -r
if [[ $REPLY =~ ^[Yy](e[Ss]?)?$ ]]; then
vncpasswd
echo -e "${GREEN}${NC} VNC password has been set." | tee -a /var/log/install
else
echo -e "${GREEN}${NC} No VNC password will be set." | tee -a /var/log/install
fi
if [ "$(vncpasswd -o)" = 'none' ]; then
echo "Authentication=none" >> "$CONFIG_FILE"
echo "Geometry=1920x1080" >> "$CONFIG_FILE"
echo "# Version 1.0:" >> "$CONFIG_FILE"
echo "# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspbian as custom PXE init script." >> "$CONFIG_FILE"
print_status "VNC config set to no authentication with geometry 1920x1080." >> /var/log/install 2>&1
else
echo "Authentication=none" >> "$CONFIG_FILE"
echo "Geometry=1920x1080" >> "$CONFIG_FILE"
echo "# Version 1.0:" >> "$CONFIG_FILE"
echo "# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspbian as custom PXE init script." >> "$CONFIG_FILE"
print_status "VNC password is set. Authentication will be required." >> /var/log/install 2>&1
fi
sudo raspi-config nonint do_vnc 0 >>/var/log/install 2>&1 && print_status "VNC enabled in raspi-config"
sudo systemctl unmask vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "VNC unmask"
sudo systemctl enable vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "VNC enabled systemctl"
echo -e "${RED}${NC} Setting permissions for 'loginuser'..." | tee -a /var/log/install
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, /usr/bin/systemctl restart chromium-monitor loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop chromium-monitor, /usr/bin/systemctl start chromium-monitor
loginuser ALL=(ALL) NOPASSWD: /usr/bin/echo, /usr/bin/cp, /usr/bin/sed loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop watchdog-monitor, /usr/bin/systemctl start watchdog-monitor
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/reboot, /usr/sbin/dhclient eth0, /usr/bin/fbset
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cat /var/lib/dhcp/* loginuser ALL=(ALL) NOPASSWD: /usr/bin/cat /var/lib/dhcp/*
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cp /etc/watchdog.conf /etc/watchdog.conf.bak
loginuser ALL=(ALL) NOPASSWD: /usr/bin/tee /etc/watchdog.conf, /usr/bin/tee -a /etc/watchdog.conf
loginuser ALL=(ALL) NOPASSWD: /usr/bin/sed -i
loginuser ALL=(ALL) NOPASSWD: /usr/bin/sed -r 's/[x]+/,/g'
loginuser ALL=(ALL) NOPASSWD: /usr/bin/fbset -s
loginuser ALL=(ALL) NOPASSWD: /usr/bin/hostnamectl set-hostname
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/dhclient eth0
loginuser ALL=(ALL) NOPASSWD: /usr/sbin/reboot
EOF EOF
sudo usermod -aG video loginuser >>/var/log/install 2>&1 && print_status "Permissions for 'loginuser' set" sudo usermod -aG video loginuser >>/var/log/install 2>&1 && print_status "Permissions for 'loginuser' set"
echo -e "${RED}${NC} Disabling root login..." echo -e "${RED}${NC} Disabling root login..." | tee -a /var/log/install
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 >>/var/log/install 2>&1 && print_status "Root login disabled" sudo passwd -l root >>/var/log/install 2>&1 && print_status "Root login disabled"
echo -e "${RED}${NC} Copying required files..." echo -e "${RED}${NC} Setting file permissions..." | tee -a /var/log/install
sudo rsync -a --numeric-ids --info=progress2 --no-owner --no-group \ sudo chown loginuser:loginuser -R /home/loginuser >>/var/log/install 2>&1 && print_status "File permissions for 'loginuser' set"
./rps-client/boot/ro-root.sh /boot/ro-root.sh \ sudo chown wis:wis -R /home/wis >>/var/log/install 2>&1 && print_status "File permissions for 'wis' set"
./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} Creating log files..." | tee -a /var/log/install
sudo chown loginuser:loginuser -R /home/loginuser >>/var/log/install 2>&1 && print_status "File permissions set" sudo touch /var/log/watchdog.log /var/log/chromium-monitor.log /var/log/hostname.log >>/var/log/install 2>&1 && print_status "Log files created"
sudo chown loginuser:loginuser /var/log/watchdog.log /var/log/chromium-monitor.log /var/log/hostname.log >>/var/log/install 2>&1 && print_status "Ownership set for log files"
sudo chmod 777 /var/log/watchdog.log /var/log/chromium-monitor.log /var/log/hostname.log >>/var/log/install 2>&1 && print_status "Permissions set for log files"
sudo chmod +x /usr/bin/custom/* >>/var/log/install 2>&1 && print_status "Permissions set for script files"
echo -e "${RED}${NC} Enabling services..." echo -e "${RED}${NC} Enabling services..." | tee -a /var/log/install
sudo systemctl daemon-reload >>/var/log/install 2>&1 && print_status "Daemon reloaded" sudo systemctl daemon-reload >>/var/log/install 2>&1 && print_status "Daemon reloaded"
sudo systemctl enable watchdog chromium-monitor vncserver-x11-serviced.service >>/var/log/install 2>&1 && print_status "Services enabled" sudo systemctl enable hostname watchdog chromium-monitor vncserver-x11-serviced.service getty@tty1 >>/var/log/install 2>&1 && print_status "Services enabled"
sudo systemctl restart getty@tty1 >>/var/log/install 2>&1 && print_status "getty service restarted" sudo systemctl restart getty@tty1 >>/var/log/install 2>&1 && print_status "getty service restarted"
echo -e "${RED}${NC} Cleaning up old kernels..." echo -e "${RED}${NC} Do you want to clean up unused kernels? (y/n):" | tee -a /var/log/install
sudo bash /root/remove_unused_kernel.sh -u -e >>/var/log/install 2>&1 && print_status "Old kernels cleaned up" read -r clean_kernels
if [[ "$clean_kernels" =~ ^[Yy](e[Ss]?)?$ ]]; then
echo -e "${RED}${NC} Cleaning up unused kernels..." | tee -a /var/log/install
yes yes | head -n 2 | 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..." | tee -a /var/log/install
echo -e "${GREEN}${NC} Cleanup has been skipped" | tee -a /var/log/install
fi
echo -e "${RED}${NC} Cleaning up installer..." echo "performance" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
echo -e "${RED}${NC} Cleaning up installer..." | tee -a /var/log/install
sudo rm -rf ./rps-client >>/var/log/install 2>&1 && print_status "Installer cleaned up" sudo rm -rf ./rps-client >>/var/log/install 2>&1 && print_status "Installer cleaned up"
echo -e "${GREEN}${NC} Installation complete. Press any key to reboot..." echo -e "${RED}${NC} Configuring Overlayroot..." | tee -a /var/log/install
CONFIG_FILE="/etc/overlayroot.conf"
echo 'overlayroot_cfgdisk="disabled"' | sudo tee "$CONFIG_FILE" >/dev/null
echo 'overlayroot=""' | sudo tee -a "$CONFIG_FILE" >/dev/null
read -p "Do you want to activate overlayfs? (y/n): " -r
if [[ $REPLY =~ ^[Yy](e[Ss]?)?$ ]]; then
echo 'overlayroot="tmpfs:overlayfs"' | sudo tee -a "$CONFIG_FILE"
sudo raspi-config nonint do_overlayroot 0 >>/var/log/install 2>&1 && print_status "Overlayroot enabled in raspi-config"
echo -e "${GREEN}${NC} Overlayroot has been activated." | tee -a /var/log/install
else
echo 'overlayroot=""' | sudo tee -a "$CONFIG_FILE"
echo -e "${GREEN}${NC} Overlayroot has not been activated." | tee -a /var/log/install
fi
echo -e "${GREEN}${NC} Installation complete. Press any key to reboot..." >> /var/log/install 2>&1
read -n 1 -s read -n 1 -s
sudo reboot sudo reboot
# Version 1.1: # 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
View 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==

View File

@@ -1,4 +0,0 @@
Authentication=None
# Version 1.0:
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.

View File

@@ -1,36 +0,0 @@
#!/bin/bash
get_monitor() {
sudo cat /var/lib/dhcp/* | grep -a "option monitor" | tail -1 | \
awk '{ s = ""; for (i = 3; i <= NF; i++) s = s $i " "; print s}' | \
awk -F '"' '{print $2}'
}
get_current_window() {
DISPLAY=:0 xdotool getwindowfocus getwindowname | awk -F '- Chromium' '{print $1}'
}
monitor=""
while [ -z "$monitor" ]; do
monitor=$(get_monitor)
if [ -z "$monitor" ]; then
sleep 5
fi
done
monitor_md5=$(echo -n ${monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
while true; do
new_monitor=$(get_monitor)
new_current=$(get_current_window)
if [ -n "$new_monitor" ] && [ -n "$new_current" ]; then
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}')
if [ "$new_monitor_md5" != "$monitor_md5" ] && [ "$current_md5" != "$monitor_md5" ]; then
echo "Mismatch detected. Rebooting now."
sudo reboot
exit 1
fi
else
echo "Either monitor or current is not available, skipping check."
fi
sleep 5s
done
# Version 1.0:
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.

View File

@@ -0,0 +1,51 @@
#!/bin/bash
LOGFILE="/var/log/chromium-monitor.log"
# Function to log messages with timestamps
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOGFILE"
}
# Function to get the monitor value from DHCP
get_monitor() {
sudo cat /var/lib/dhcp/* | grep -a "option monitor" | tail -1 | \
awk '{ s = ""; for (i = 3; i <= NF; i++) s = s $i " "; print s}' | \
awk -F '"' '{print $2}'
}
# Function to get the current window name
get_current_window() {
DISPLAY=:0 xdotool getwindowfocus getwindowname
}
# Initialize monitor variable
monitor=""
while [ -z "$monitor" ]; do
monitor=$(get_monitor)
if [ -n "$monitor" ]; then
log "Initial monitor detected: $monitor" # Log initial monitor
fi
sleep 5
done
# Main loop to continuously check the current window
while true; do
current_window=$(get_current_window) # Get the current window name
if [ -n "$current_window" ]; then
# Check for mismatch using case-insensitive comparison
if ! echo "$current_window" | grep -iq "$monitor"; then
log "Mismatch detected! Monitor: $monitor, Current: $current_window"
log "Rebooting now."
sudo reboot
exit 1
fi
fi
# Sleep for a short duration before the next check
sleep 5
done
# Version 1.0:
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspbian as custom PXE init script.

40
usr/bin/custom/hostname Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
LOGFILE="/var/log/hostname.log"
# Function to log messages with timestamps
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOGFILE"
}
# Function to read the hostname from the DHCP lease file
get_hostname() {
sudo cat /var/lib/dhcp/* | grep -a "option host-name" | tail -1 | \
awk -F '"' '{print $2}'
}
# Function to update /etc/hosts with the new hostname
update_hosts() {
local hostname="$1"
# Replace the second line with the new hostname
sudo sed -i "2s/.*/127.0.1.1 ${hostname}/" /etc/hosts
log "Updated /etc/hosts with hostname: $hostname"
}
# Read the hostname from DHCP
hostname=$(get_hostname)
if [ -n "$hostname" ]; then
# Set the hostname using hostnamectl
sudo hostnamectl set-hostname "$hostname"
log "Set hostname to: $hostname"
update_hosts "$hostname"
else
log "No hostname found."
fi
# Log completion
log "Hostname update script completed."
# Version 1.0:
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspbian as custom PXE init script.

View File

@@ -0,0 +1,99 @@
#!/bin/bash
# Log file
log_file="/var/log/watchdog.log"
# Configuration file
config_file="/etc/watchdog.conf"
# Function to log messages with timestamp
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$log_file"
}
# Function to update watchdog configuration
update_watchdog_config() {
# Extract watchdog IP addresses
watchdog=$(sudo cat /var/lib/dhcp/* | grep -a "option watchdog" | tail -1 | \
awk '{for (i=3; i<=NF; i++) printf "%s ", $i}' | tr -d '";')
IFS=', ' read -r -a ip_array <<< "$watchdog" # Split IPs by comma or space
# Backup current configuration
sudo cp "$config_file" "$config_file.bak"
log "Backup of $config_file created successfully."
# Write static configuration to file
{
echo "realtime = yes"
echo "priority = 1"
echo "interface = eth0"
echo "interval = 58"
echo "ping-count = 1"
} | sudo tee "$config_file" > /dev/null
log "Static configuration written to $config_file."
if [ ${#ip_array[@]} -eq 0 ]; then
log "No IP addresses found. Watchdog configuration cleared."
return 1 # No IP addresses to configure
else
# Append IPs to config
for ip in "${ip_array[@]}"; do
echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null
done
log "Configured watchdog to ping: ${ip_array[*]}"
# Attempt to restart watchdog service
if ! sudo systemctl restart watchdog; then
log "Failed to restart watchdog service. Attempting to stop and start."
# Fallback: stop then start the service
sudo systemctl stop watchdog
if sudo systemctl start watchdog; then
log "Watchdog service started successfully after stop."
else
log "Failed to start watchdog service after stop."
return 1
fi
else
log "Watchdog service restarted successfully."
fi
# Stop watchdog-monitor service if restart/start was successful
if sudo systemctl stop watchdog-monitor; then
log "watchdog-monitor service stopped successfully."
else
log "Failed to stop watchdog-monitor service."
fi
return 0 # Successful restart/start
fi
}
# Loop parameters
interval=30 # Interval to wait between checks
start_time=$(date +%s)
end_time=$((start_time + 300)) # 5 minutes in seconds
# Main loop
while true; do
if ! update_watchdog_config; then
log "IP addresses found and watchdog restarted. Exiting loop."
break
else
log "No IP addresses found or restart failed. Waiting for $interval seconds before checking again..."
fi
# Check if 5 minutes have passed
if [ "$(date +%s)" -ge "$end_time" ]; then
log "5 minutes have passed. Stopping the watchdog service."
sudo systemctl stop watchdog
break
fi
log "Waiting for $interval seconds before checking for IP addresses again..."
sleep $interval
done
# Version 1.5:
# Created 2024 by Tim Eertmoed @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom PXE init script.

View File

@@ -1,22 +0,0 @@
#!/bin/bash
watchdog=$(sudo cat /var/lib/dhcp/* | grep -a "option watchdog" | tail -1 | \
awk '{for (i=3; i<=NF; i++) printf "%s ", $i}' | tr -d '";')
IFS=' ' read -r -a ip_array <<< "$watchdog"
config_file="/etc/watchdog.conf"
sudo cp "$config_file" "$config_file.bak"
sudo sed -i '/ping/d' "$config_file"
sudo sed -i '/^interval/d' "$config_file"
echo "interval = 60" | sudo tee -a "$config_file" > /dev/null
if [ ${#ip_array[@]} -eq 0 ]; then
sudo sed -i '/interval/d' "$config_file"
echo "No IP addresses found. Watchdog configuration cleared." >&2
sudo systemctl stop watchdog
else
for ip in "${ip_array[@]}"; do
echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null
done
fi
sudo systemctl restart watchdog
# Version 1.0:
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.