Compare commits
134 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8f88bb40a | |||
| 18cd5a388d | |||
| 4547c21cba | |||
| 61a4fabac9 | |||
| 8d57596072 | |||
| 4d072450c0 | |||
| 16be62b878 | |||
| 1853f2ff28 | |||
| 5ff6d190c3 | |||
| 9e7f59606c | |||
| a70a362ce4 | |||
| 5dc8681dfd | |||
| c7a77796a1 | |||
| 43b9640eb0 | |||
| 1510ce0758 | |||
| a5cd4e6f2c | |||
| 488b0a6406 | |||
| 1720679c1b | |||
| 689824ac04 | |||
| 04e0b1a3b6 | |||
| e35bbc7d77 | |||
| 620fe0c831 | |||
| 16cfbefd83 | |||
| 6341d49f76 | |||
| dcde376e95 | |||
| ce9bafa069 | |||
| 3e711f04fe | |||
| b239b564f1 | |||
| 777d3981f0 | |||
| 6f1498f422 | |||
| 514cc91ed5 | |||
| 0378024409 | |||
| 5f2cd53026 | |||
| b2d2a89ca3 | |||
| 859759a253 | |||
| a20d85f543 | |||
| 7b46dc4e73 | |||
| 63a40835b6 | |||
| 39ee07fe14 | |||
| 2a1dac448a | |||
| c5ed7dde10 | |||
| af0b0c7bb1 | |||
| 259e0d7f3a | |||
| fc1f25477d | |||
| d754b93250 | |||
| 11451b03be | |||
| 068d6ac9a5 | |||
| b58147b391 | |||
| 86b3bdae71 | |||
| cdfd6359da | |||
| bf0b5e857f | |||
| 9b85eddf09 | |||
| 0d5e790cd2 | |||
| 7d05ae6fa4 | |||
| 0dc0236f40 | |||
| f65185644d | |||
| 73ea27ac67 | |||
| d012e5193d | |||
| 6a631c3aee | |||
| 7276958e0b | |||
| 5f9f63d026 | |||
| b6d889a348 | |||
| e511fcb885 | |||
| 57b5cd5397 | |||
| 26058e12f7 | |||
| 134a398fb9 | |||
| 4b607c3ad8 | |||
| 1d22c6dc07 | |||
| 0b8a9d2ba6 | |||
| b921505906 | |||
| b39edf6343 | |||
| 0d081f2380 | |||
| 8038479898 | |||
| 8fe03e7cad | |||
| 83c6f7de70 | |||
| dece859ca8 | |||
| 0d1a2b7c21 | |||
| d96260222c | |||
| 54d218451a | |||
| 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 | |||
| 6a7b26e3ed | |||
| a21ad47b93 | |||
| 7507e33cd8 | |||
| 33ab3e799c | |||
| a7e26b8017 | |||
| 44a5ebcc5d | |||
| d4f664d528 | |||
| dd4da4fc90 | |||
| 8a5a333b17 | |||
| 1247e986b4 | |||
| 9c543d45b2 | |||
| 659ccb5738 | |||
| 30e8ca7353 | |||
| 6ee7764bd7 | |||
| 8935a49c56 | |||
| 30b88204e7 | |||
| 634d3d17e8 | |||
| 9dd38dbc15 | |||
| fb8ff04041 | |||
| 72f87e68f8 | |||
| 6a3436aaad | |||
| fa768d5267 | |||
| f119be71db | |||
| 5ef683957f |
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*
|
|
||||||
|
|
||||||
10
README.md
10
README.md
@@ -1,2 +1,10 @@
|
|||||||
# RPS-Light-PXE
|
# RPS-Client
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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
|
||||||
|
# Version 1.1:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
|
```
|
||||||
120
boot/firmware/ro-root.sh
Normal file
120
boot/firmware/ro-root.sh
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Read-only Root-FS for Raspian using overlayfs
|
||||||
|
# Version 1.1:
|
||||||
|
# Changed to use /proc/mounts rathern than /etc/fstab for deriving the root filesystem.
|
||||||
|
#
|
||||||
|
# Version 1:
|
||||||
|
# Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script
|
||||||
|
# (raspbian does not use an initramfs on boot)
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Tested with Raspbian mini, 2017-01-11
|
||||||
|
#
|
||||||
|
# This script will mount the root filesystem read-only and overlay it with a temporary tempfs
|
||||||
|
# which is read-write mounted. This is done using the overlayFS which is part of the linux kernel
|
||||||
|
# since version 3.18.
|
||||||
|
# when this script is in use, all changes made to anywhere in the root filesystem mount will be lost
|
||||||
|
# upon reboot of the system. The SD card will only be accessed as read-only drive, which significantly
|
||||||
|
# helps to prolong its life and prevent filesystem coruption in environments where the system is usually
|
||||||
|
# not shut down properly
|
||||||
|
#
|
||||||
|
# Install:
|
||||||
|
# copy this script to /sbin/overlayRoot.sh and add "init=/sbin/overlayRoot.sh" to the cmdline.txt
|
||||||
|
# file in the raspbian image's boot partition.
|
||||||
|
# I strongly recommend to disable swapping before using this. it will work with swap but that just does
|
||||||
|
# not make sens as the swap file will be stored in the tempfs which again resides in the ram.
|
||||||
|
# run these commands on the booted raspberry pi BEFORE you set the init=/sbin/overlayRoot.sh boot option:
|
||||||
|
# sudo dphys-swapfile swapoff
|
||||||
|
# sudo dphys-swapfile uninstall
|
||||||
|
# sudo update-rc.d dphys-swapfile remove
|
||||||
|
#
|
||||||
|
# To install software, run upgrades and do other changes to the raspberry setup, simply remove the init=
|
||||||
|
# entry from the cmdline.txt file and reboot, make the changes, add the init= entry and reboot once more.
|
||||||
|
|
||||||
|
fail(){
|
||||||
|
echo -e "$1"
|
||||||
|
/bin/bash
|
||||||
|
}
|
||||||
|
|
||||||
|
# load module
|
||||||
|
modprobe overlay
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: missing overlay kernel module"
|
||||||
|
fi
|
||||||
|
# mount /proc
|
||||||
|
mount -t proc proc /proc
|
||||||
|
|
||||||
|
# create a writable fs to then create our mountpoints
|
||||||
|
mount -t tmpfs inittemp /mnt
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not create a temporary filesystem to mount the base filesystems for overlayfs"
|
||||||
|
fi
|
||||||
|
mkdir /mnt/lower
|
||||||
|
mkdir /mnt/rw
|
||||||
|
mount -t tmpfs root-rw /mnt/rw
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not create tempfs for upper filesystem"
|
||||||
|
fi
|
||||||
|
mkdir /mnt/rw/upper
|
||||||
|
mkdir /mnt/rw/work
|
||||||
|
mkdir /mnt/newroot
|
||||||
|
|
||||||
|
# mount root filesystem readonly
|
||||||
|
rootDev=`awk '$2 == "/" {print $1}' /proc/mounts`
|
||||||
|
rootMountOpt=`awk '$2 == "/" {print $4}' /proc/mounts`
|
||||||
|
rootFsType=`awk '$2 == "/" {print $3}' /proc/mounts`
|
||||||
|
mount -t ${rootFsType} -o ${rootMountOpt},ro ${rootDev} /mnt/lower
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not ro-mount original root partition"
|
||||||
|
fi
|
||||||
|
mount -t overlay -o lowerdir=/mnt/lower,upperdir=/mnt/rw/upper,workdir=/mnt/rw/work overlayfs-root /mnt/newroot
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not mount overlayFS"
|
||||||
|
fi
|
||||||
|
# create mountpoints inside the new root filesystem-overlay
|
||||||
|
mkdir /mnt/newroot/ro
|
||||||
|
mkdir /mnt/newroot/rw
|
||||||
|
# remove root mount from fstab (this is already a non-permanent modification)
|
||||||
|
grep -v "$rootDev" /mnt/lower/etc/fstab > /mnt/newroot/etc/fstab
|
||||||
|
echo "#the original root mount has been removed by overlayRoot.sh" >> /mnt/newroot/etc/fstab
|
||||||
|
echo "#this is only a temporary modification, the original fstab" >> /mnt/newroot/etc/fstab
|
||||||
|
echo "#stored on the disk can be found in /ro/etc/fstab" >> /mnt/newroot/etc/fstab
|
||||||
|
# change to the new overlay root
|
||||||
|
cd /mnt/newroot
|
||||||
|
pivot_root . mnt
|
||||||
|
exec chroot . sh -c "$(cat <<END
|
||||||
|
# move ro and rw mounts to the new root
|
||||||
|
mount --move /mnt/mnt/lower/ /ro
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: could not move ro-root into newroot"
|
||||||
|
/bin/bash
|
||||||
|
fi
|
||||||
|
mount --move /mnt/mnt/rw /rw
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: could not move tempfs rw mount into newroot"
|
||||||
|
/bin/bash
|
||||||
|
fi
|
||||||
|
# unmount unneeded mounts so we can unmout the old readonly root
|
||||||
|
umount /mnt/mnt
|
||||||
|
umount /mnt/proc
|
||||||
|
umount -l -f /mnt/dev
|
||||||
|
umount -l -f /mnt
|
||||||
|
# continue with regular init
|
||||||
|
exec /sbin/init
|
||||||
|
END
|
||||||
|
)"
|
||||||
120
boot/ro-root.sh
Normal file
120
boot/ro-root.sh
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Read-only Root-FS for Raspian using overlayfs
|
||||||
|
# Version 1.1:
|
||||||
|
# Changed to use /proc/mounts rathern than /etc/fstab for deriving the root filesystem.
|
||||||
|
#
|
||||||
|
# Version 1:
|
||||||
|
# Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script
|
||||||
|
# (raspbian does not use an initramfs on boot)
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Tested with Raspbian mini, 2017-01-11
|
||||||
|
#
|
||||||
|
# This script will mount the root filesystem read-only and overlay it with a temporary tempfs
|
||||||
|
# which is read-write mounted. This is done using the overlayFS which is part of the linux kernel
|
||||||
|
# since version 3.18.
|
||||||
|
# when this script is in use, all changes made to anywhere in the root filesystem mount will be lost
|
||||||
|
# upon reboot of the system. The SD card will only be accessed as read-only drive, which significantly
|
||||||
|
# helps to prolong its life and prevent filesystem coruption in environments where the system is usually
|
||||||
|
# not shut down properly
|
||||||
|
#
|
||||||
|
# Install:
|
||||||
|
# copy this script to /sbin/overlayRoot.sh and add "init=/sbin/overlayRoot.sh" to the cmdline.txt
|
||||||
|
# file in the raspbian image's boot partition.
|
||||||
|
# I strongly recommend to disable swapping before using this. it will work with swap but that just does
|
||||||
|
# not make sens as the swap file will be stored in the tempfs which again resides in the ram.
|
||||||
|
# run these commands on the booted raspberry pi BEFORE you set the init=/sbin/overlayRoot.sh boot option:
|
||||||
|
# sudo dphys-swapfile swapoff
|
||||||
|
# sudo dphys-swapfile uninstall
|
||||||
|
# sudo update-rc.d dphys-swapfile remove
|
||||||
|
#
|
||||||
|
# To install software, run upgrades and do other changes to the raspberry setup, simply remove the init=
|
||||||
|
# entry from the cmdline.txt file and reboot, make the changes, add the init= entry and reboot once more.
|
||||||
|
|
||||||
|
fail(){
|
||||||
|
echo -e "$1"
|
||||||
|
/bin/bash
|
||||||
|
}
|
||||||
|
|
||||||
|
# load module
|
||||||
|
modprobe overlay
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: missing overlay kernel module"
|
||||||
|
fi
|
||||||
|
# mount /proc
|
||||||
|
mount -t proc proc /proc
|
||||||
|
|
||||||
|
# create a writable fs to then create our mountpoints
|
||||||
|
mount -t tmpfs inittemp /mnt
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not create a temporary filesystem to mount the base filesystems for overlayfs"
|
||||||
|
fi
|
||||||
|
mkdir /mnt/lower
|
||||||
|
mkdir /mnt/rw
|
||||||
|
mount -t tmpfs root-rw /mnt/rw
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not create tempfs for upper filesystem"
|
||||||
|
fi
|
||||||
|
mkdir /mnt/rw/upper
|
||||||
|
mkdir /mnt/rw/work
|
||||||
|
mkdir /mnt/newroot
|
||||||
|
|
||||||
|
# mount root filesystem readonly
|
||||||
|
rootDev=`awk '$2 == "/" {print $1}' /proc/mounts`
|
||||||
|
rootMountOpt=`awk '$2 == "/" {print $4}' /proc/mounts`
|
||||||
|
rootFsType=`awk '$2 == "/" {print $3}' /proc/mounts`
|
||||||
|
mount -t ${rootFsType} -o ${rootMountOpt},ro ${rootDev} /mnt/lower
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not ro-mount original root partition"
|
||||||
|
fi
|
||||||
|
mount -t overlay -o lowerdir=/mnt/lower,upperdir=/mnt/rw/upper,workdir=/mnt/rw/work overlayfs-root /mnt/newroot
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fail "ERROR: could not mount overlayFS"
|
||||||
|
fi
|
||||||
|
# create mountpoints inside the new root filesystem-overlay
|
||||||
|
mkdir /mnt/newroot/ro
|
||||||
|
mkdir /mnt/newroot/rw
|
||||||
|
# remove root mount from fstab (this is already a non-permanent modification)
|
||||||
|
grep -v "$rootDev" /mnt/lower/etc/fstab > /mnt/newroot/etc/fstab
|
||||||
|
echo "#the original root mount has been removed by overlayRoot.sh" >> /mnt/newroot/etc/fstab
|
||||||
|
echo "#this is only a temporary modification, the original fstab" >> /mnt/newroot/etc/fstab
|
||||||
|
echo "#stored on the disk can be found in /ro/etc/fstab" >> /mnt/newroot/etc/fstab
|
||||||
|
# change to the new overlay root
|
||||||
|
cd /mnt/newroot
|
||||||
|
pivot_root . mnt
|
||||||
|
exec chroot . sh -c "$(cat <<END
|
||||||
|
# move ro and rw mounts to the new root
|
||||||
|
mount --move /mnt/mnt/lower/ /ro
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: could not move ro-root into newroot"
|
||||||
|
/bin/bash
|
||||||
|
fi
|
||||||
|
mount --move /mnt/mnt/rw /rw
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: could not move tempfs rw mount into newroot"
|
||||||
|
/bin/bash
|
||||||
|
fi
|
||||||
|
# unmount unneeded mounts so we can unmout the old readonly root
|
||||||
|
umount /mnt/mnt
|
||||||
|
umount /mnt/proc
|
||||||
|
umount -l -f /mnt/dev
|
||||||
|
umount -l -f /mnt
|
||||||
|
# continue with regular init
|
||||||
|
exec /sbin/init
|
||||||
|
END
|
||||||
|
)"
|
||||||
@@ -2,3 +2,6 @@
|
|||||||
"PasswordManagerEnabled": false,
|
"PasswordManagerEnabled": false,
|
||||||
"PasswordManagerAllowShowPasswords": false
|
"PasswordManagerAllowShowPasswords": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Version 1.0:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -11,3 +11,6 @@ request subnet-mask, broadcast-address, time-offset, routers,
|
|||||||
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
|
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
|
||||||
netbios-name-servers, netbios-scope, interface-mtu,
|
netbios-name-servers, netbios-scope, interface-mtu,
|
||||||
rfc3442-classless-static-routes, ntp-servers, url, monitor, watchdog, screen;
|
rfc3442-classless-static-routes, ntp-servers, url, monitor, watchdog, screen;
|
||||||
|
|
||||||
|
# Version 1.0:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
[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]
|
||||||
# Wait until Chromium is running
|
|
||||||
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
|
User=loginuser
|
||||||
ExecStart=/usr/bin/chromium-monitor
|
ExecStart=/usr/bin/custom/chromium-monitor
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
# Version 1.1:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=-/sbin/agetty --autologin loginuser --noclear %I $TERM
|
ExecStart=-/sbin/agetty --autologin loginuser --noclear %I $TERM
|
||||||
|
|
||||||
|
# Version 1.0:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
11
etc/systemd/system/hostname.service
Normal file
11
etc/systemd/system/hostname.service
Normal 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
|
||||||
13
etc/systemd/system/watchdog-monitor.service
Normal file
13
etc/systemd/system/watchdog-monitor.service
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Watchdog Monitor Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/custom/watchdog-monitor
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
# Version 1.1:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Watchdog Monitor Service
|
|
||||||
After=network.target getty@tty1.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=-/bin/sleep 120
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/bin/watchdog
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -4,3 +4,6 @@ then
|
|||||||
exit
|
exit
|
||||||
sudo reboot
|
sudo reboot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Version 1.0:
|
||||||
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
@@ -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 \
|
||||||
@@ -47,3 +52,6 @@ chromium-browser $WBS \
|
|||||||
--user-data-dir=/tmp/chromium-profile
|
--user-data-dir=/tmp/chromium-profile
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
# Version 1.0:
|
||||||
|
# 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==
|
||||||
301
install.sh
301
install.sh
@@ -1,143 +1,174 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Starte Systemupdate..."
|
|
||||||
sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y && sudo apt clean -y
|
# Function to print status with a checkmark
|
||||||
echo "Starte Systemupdate..."
|
print_status() {
|
||||||
echo "Systemupdate erfolgreich..."
|
echo -e "${GREEN}✔${NC} ${1} completed."
|
||||||
echo "Installierse benötigte Pakete..."
|
}
|
||||||
sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit chromium-browser fonts-noto-color-emoji nfs-common watchdog xdotool rsync -y
|
|
||||||
clear
|
echo -e "${RED}→${NC} Starting System Update..." | tee -a /var/log/install
|
||||||
echo "Starte Systemupdate..."
|
sudo apt update >>/var/log/install 2>&1 && print_status "System Update"
|
||||||
echo "Systemupdate erfolgreich..."
|
sudo apt upgrade -y >>/var/log/install 2>&1 && print_status "System Upgrade"
|
||||||
echo "Installierse benötigte Pakete..."
|
sudo apt dist-upgrade -y >>/var/log/install 2>&1 && print_status "System Dist-Upgrade"
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
echo -e "${RED}→${NC} Installing required packages..." | tee -a /var/log/install
|
||||||
sudo adduser --disabled-password --gecos "" loginuser
|
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"
|
||||||
clear
|
sudo apt install realvnc-vnc-server overlayroot -y >>/var/log/install 2>&1 && print_status "VNC and Overlayroot installed"
|
||||||
echo "Starte Systemupdate..."
|
sudo apt autoremove -y >>/var/log/install 2>&1 && print_status "Autoremove"
|
||||||
echo "Systemupdate erfolgreich..."
|
sudo apt clean >>/var/log/install 2>&1 && print_status "Clean"
|
||||||
echo "Installierse benötigte Pakete..."
|
rm -rf /var/lib/apt/lists/* >>/var/log/install 2>&1 && print_status "Clear cache"
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
echo -e "${RED}→${NC} Configuring Raspberry Pi settings..." | tee -a /var/log/install
|
||||||
echo "Loginuser angelegt..."
|
sudo raspi-config nonint do_camera 0 >> /var/log/install 2>&1 && print_status "Camera disabled"
|
||||||
echo "Setze Rechte für \"loginuser\""
|
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"
|
||||||
|
|
||||||
|
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
|
loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop chromium-monitor, /usr/bin/systemctl start chromium-monitor
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/echo
|
loginuser ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop watchdog-monitor, /usr/bin/systemctl start watchdog-monitor
|
||||||
loginuser ALL=(ALL) NOPASSWD: /usr/bin/cp
|
|
||||||
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/*
|
||||||
|
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
|
sudo usermod -aG video loginuser >>/var/log/install 2>&1 && print_status "Permissions for 'loginuser' set"
|
||||||
clear
|
|
||||||
echo "Starte Systemupdate..."
|
echo -e "${RED}→${NC} Disabling root login..." | tee -a /var/log/install
|
||||||
echo "Systemupdate erfolgreich..."
|
sudo tee /etc/ssh/sshd_config >/dev/null << 'EOF'
|
||||||
echo "Installierse benötigte Pakete..."
|
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
|
||||||
echo "Loginuser angelegt..."
|
|
||||||
echo "Setze Rechte für \"loginuser\""
|
|
||||||
echo "Rechte gesetzt..."
|
|
||||||
echo "Verbiete login für ROOT..."
|
|
||||||
sudo tee /etc/ssh/sshd_config >> /dev/null << 'EOF'
|
|
||||||
PermitRootLogin no
|
PermitRootLogin no
|
||||||
EOF
|
EOF
|
||||||
sudo passwd -l root
|
sudo passwd -l root >>/var/log/install 2>&1 && print_status "Root login disabled"
|
||||||
clear
|
|
||||||
echo "Starte Systemupdate..."
|
echo -e "${RED}→${NC} Setting file permissions..." | tee -a /var/log/install
|
||||||
echo "Systemupdate erfolgreich..."
|
sudo chown loginuser:loginuser -R /home/loginuser >>/var/log/install 2>&1 && print_status "File permissions for 'loginuser' set"
|
||||||
echo "Installierse benötigte Pakete..."
|
sudo chown wis:wis -R /home/wis >>/var/log/install 2>&1 && print_status "File permissions for 'wis' set"
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
echo -e "${RED}→${NC} Creating log files..." | tee -a /var/log/install
|
||||||
echo "Loginuser angelegt..."
|
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"
|
||||||
echo "Setze Rechte für \"loginuser\""
|
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"
|
||||||
echo "Rechte gesetzt..."
|
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"
|
||||||
echo "Deaktiviere login für ROOT..."
|
sudo chmod +x /usr/bin/custom/* >>/var/log/install 2>&1 && print_status "Permissions set for script files"
|
||||||
echo "ROOT login deaktiviert..."
|
|
||||||
echo "Kopiere erfoderliche Dateie..."
|
echo -e "${RED}→${NC} Enabling services..." | tee -a /var/log/install
|
||||||
rm ./rps-light-pxe/.gitignore ./rps-light-pxe/LICENSE ./rps-light-pxe/README.md
|
sudo systemctl daemon-reload >>/var/log/install 2>&1 && print_status "Daemon reloaded"
|
||||||
cp -r ./rps-light-pxe/ /
|
sudo systemctl enable hostname watchdog chromium-monitor vncserver-x11-serviced.service getty@tty1 >>/var/log/install 2>&1 && print_status "Services enabled"
|
||||||
clear
|
sudo systemctl restart getty@tty1 >>/var/log/install 2>&1 && print_status "getty service restarted"
|
||||||
echo "Starte Systemupdate..."
|
|
||||||
echo "Systemupdate erfolgreich..."
|
echo -e "${RED}→${NC} Do you want to clean up unused kernels? (y/n):" | tee -a /var/log/install
|
||||||
echo "Installierse benötigte Pakete..."
|
read -r clean_kernels
|
||||||
echo "Alle Pakete wurden installiert..."
|
if [[ "$clean_kernels" =~ ^[Yy](e[Ss]?)?$ ]]; then
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
echo -e "${RED}→${NC} Cleaning up unused kernels..." | tee -a /var/log/install
|
||||||
echo "Loginuser angelegt..."
|
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"
|
||||||
echo "Setze Rechte für \"loginuser\""
|
else
|
||||||
echo "Rechte gesetzt..."
|
echo -e "${RED}→${NC} Skipping unused kernel cleanup..." | tee -a /var/log/install
|
||||||
echo "Deaktiviere login für ROOT..."
|
echo -e "${GREEN}✔${NC} Cleanup has been skipped" | tee -a /var/log/install
|
||||||
echo "ROOT login deaktiviert..."
|
fi
|
||||||
echo "Spiele erforderliche Daten ein..."
|
|
||||||
echo "Alle Daten wurden eingespielt..."
|
echo "performance" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||||
echo "Setze alle Dateiberechtigungen..."
|
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
|
||||||
sudo chown loginuser:loginuser /home/loginuser/.xinitrc
|
|
||||||
sudo chown loginuser:loginuser /home/loginuser/.bash_profile
|
echo -e "${RED}→${NC} Cleaning up installer..." | tee -a /var/log/install
|
||||||
sudo chmod +x /root/remove_unused_kernel.sh
|
sudo rm -rf ./rps-client >>/var/log/install 2>&1 && print_status "Installer cleaned up"
|
||||||
sudo chmod +x /usr/bin/watchdog
|
|
||||||
sudo chmod +x /usr/bin/chromium-monitor
|
echo -e "${RED}→${NC} Configuring Overlayroot..." | tee -a /var/log/install
|
||||||
clear
|
CONFIG_FILE="/etc/overlayroot.conf"
|
||||||
echo "Starte Systemupdate..."
|
echo 'overlayroot_cfgdisk="disabled"' | sudo tee "$CONFIG_FILE" >/dev/null
|
||||||
echo "Systemupdate erfolgreich..."
|
echo 'overlayroot=""' | sudo tee -a "$CONFIG_FILE" >/dev/null
|
||||||
echo "Installierse benötigte Pakete..."
|
read -p "Do you want to activate overlayfs? (y/n): " -r
|
||||||
echo "Alle Pakete wurden installiert..."
|
if [[ $REPLY =~ ^[Yy](e[Ss]?)?$ ]]; then
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
echo 'overlayroot="tmpfs:overlayfs"' | sudo tee -a "$CONFIG_FILE"
|
||||||
echo "Loginuser angelegt..."
|
sudo raspi-config nonint do_overlayroot 0 >>/var/log/install 2>&1 && print_status "Overlayroot enabled in raspi-config"
|
||||||
echo "Setze Rechte für \"loginuser\""
|
echo -e "${GREEN}✔${NC} Overlayroot has been activated." | tee -a /var/log/install
|
||||||
echo "Rechte gesetzt..."
|
else
|
||||||
echo "Deaktiviere login für ROOT..."
|
echo 'overlayroot=""' | sudo tee -a "$CONFIG_FILE"
|
||||||
echo "ROOT login deaktiviert..."
|
echo -e "${GREEN}✔${NC} Overlayroot has not been activated." | tee -a /var/log/install
|
||||||
echo "Spiele erforderliche Daten ein..."
|
fi
|
||||||
echo "Alle Daten wurden eingespielt..."
|
|
||||||
echo "Setze alle Dateiberechtigungen..."
|
echo -e "${GREEN}✔${NC} Installation complete. Press any key to reboot..." >> /var/log/install 2>&1
|
||||||
echo "Alle Berechtigungen wurden gesetzt..."
|
|
||||||
echo "Aktiviere benötigte Services..."
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable watchdog
|
|
||||||
sudo systemctl enable chromium-monitor
|
|
||||||
sudo systemctl enable getty@tty1
|
|
||||||
clear
|
|
||||||
echo "Starte Systemupdate..."
|
|
||||||
echo "Systemupdate erfolgreich..."
|
|
||||||
echo "Installierse benötigte Pakete..."
|
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
|
||||||
echo "Loginuser angelegt..."
|
|
||||||
echo "Setze Rechte für \"loginuser\""
|
|
||||||
echo "Rechte gesetzt..."
|
|
||||||
echo "Deaktiviere login für ROOT..."
|
|
||||||
echo "ROOT login deaktiviert..."
|
|
||||||
echo "Spiele erforderliche Daten ein..."
|
|
||||||
echo "Alle Daten wurden eingespielt..."
|
|
||||||
echo "Setze alle Dateiberechtigungen..."
|
|
||||||
echo "Alle Berechtigungen wurden gesetzt..."
|
|
||||||
echo "Aktiviere benötigte Services..."
|
|
||||||
echo "Watchdog, Chromium und AutoLogin wurden aktiviert..."
|
|
||||||
echo "Lösche nicht mehr benötigte Kernel..."
|
|
||||||
sudo bash /root/remove_unused_kernel.sh -u -e
|
|
||||||
rm /root/remove_unused_kernel.sh
|
|
||||||
clear
|
|
||||||
echo "Starte Systemupdate..."
|
|
||||||
echo "Systemupdate erfolgreich..."
|
|
||||||
echo "Installierse benötigte Pakete..."
|
|
||||||
echo "Alle Pakete wurden installiert..."
|
|
||||||
echo "Lege den Benutzer \"loginuser\" an..."
|
|
||||||
echo "Loginuser angelegt..."
|
|
||||||
echo "Setze Rechte für \"loginuser\""
|
|
||||||
echo "Rechte gesetzt..."
|
|
||||||
echo "Deaktiviere login für ROOT..."
|
|
||||||
echo "ROOT login deaktiviert..."
|
|
||||||
echo "Spiele erforderliche Daten ein..."
|
|
||||||
echo "Alle Daten wurden eingespielt..."
|
|
||||||
echo "Setze alle Dateiberechtigungen..."
|
|
||||||
echo "Alle Berechtigungen wurden gesetzt..."
|
|
||||||
echo "Aktiviere benötigte Services..."
|
|
||||||
echo "Watchdog, Chromium und AutoLogin wurden aktiviert..."
|
|
||||||
echo "Lösche nicht mehr benötigte Kernel..."
|
|
||||||
echo "Alte Kernel gelöscht..."
|
|
||||||
echo "Installation komplett..."
|
|
||||||
echo "Zum Neustarten bitte eine beliebige Taste drücken..."
|
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
|
|
||||||
sudo reboot
|
sudo reboot
|
||||||
|
|
||||||
|
# Version 1.2:
|
||||||
|
# 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==
|
||||||
@@ -1 +0,0 @@
|
|||||||
Authentication=None
|
|
||||||
@@ -1,33 +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
|
|
||||||
51
usr/bin/custom/chromium-monitor
Normal file
51
usr/bin/custom/chromium-monitor
Normal 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
40
usr/bin/custom/hostname
Normal 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.
|
||||||
99
usr/bin/custom/watchdog-monitor
Normal file
99
usr/bin/custom/watchdog-monitor
Normal 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.
|
||||||
@@ -1,19 +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
|
|
||||||
Reference in New Issue
Block a user