stable #2
47
install.sh
47
install.sh
@@ -17,11 +17,44 @@ 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"
|
||||
rm -rf /var/lib/apt/lists/* "Clear cache"
|
||||
rm -rf /var/lib/apt/lists/* "Clear cache"
|
||||
|
||||
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 >>/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"
|
||||
|
||||
echo -e "${RED}→${NC} Configuring VNC..."
|
||||
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 "${RED}→${NC} Created directory for VNC config."
|
||||
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."
|
||||
else
|
||||
echo -e "${RED}✖${NC} No VNC password will be set."
|
||||
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"
|
||||
echo -e "${RED}→${NC} VNC config set to no authentication with geometry 1920x1080."
|
||||
else
|
||||
echo "Authentication=VNC" >> "$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"
|
||||
echo -e "${RED}→${NC} VNC password is set. Authentication will be required."
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✔${NC} VNC configuration updated with geometry 1920x1080."
|
||||
sudo raspi-config nonint do_vnc 0 >>/var/log/install 2>&1 && print_status "VNC enabled in raspi-config"
|
||||
echo -e "${GREEN}✔${NC} VNC configuration completed. You can connect using a VNC viewer."
|
||||
|
||||
echo -e "${RED}→${NC} Creating user 'loginuser'..."
|
||||
sudo adduser --disabled-password --gecos "" loginuser >>/var/log/install 2>&1 && print_status "User 'loginuser' created"
|
||||
@@ -48,7 +81,7 @@ PermitRootLogin no
|
||||
EOF
|
||||
sudo passwd -l root >>/var/log/install 2>&1 && print_status "Root login disabled"
|
||||
|
||||
# Array of source and destination pairs
|
||||
echo -e "${RED}→${NC} Copy requiered files..."
|
||||
declare -A files=(
|
||||
["./rps-client/boot/ro-root.sh"]="/boot/ro-root.sh"
|
||||
["./rps-client/boot/firmware/ro-root.sh"]="/boot/firmware/ro-root.sh"
|
||||
@@ -67,19 +100,13 @@ declare -A files=(
|
||||
["./rps-client/usr/bin/custom/chromium-monitor"]="/usr/bin/custom/chromium-monitor"
|
||||
["./rps-client/usr/bin/custom/watchdog-monitor"]="/usr/bin/custom/watchdog-monitor"
|
||||
)
|
||||
|
||||
# Rsync options
|
||||
RSYNC_OPTS="-a --numeric-ids --info=progress2 --no-owner --no-group"
|
||||
|
||||
# Loop through and sync each file
|
||||
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
|
||||
|
||||
# Final status message
|
||||
print_status "All required files copied"
|
||||
echo -e "${GREEN}✔${NC} All required files copied"
|
||||
|
||||
echo -e "${RED}→${NC} Setting file permissions..."
|
||||
sudo chown loginuser:loginuser -R /home/loginuser >>/var/log/install 2>&1 && print_status "File permissions set"
|
||||
|
||||
Reference in New Issue
Block a user