6666 exit 1
6767fi
6868
69+ # Ensure Debian has contrib, non-free, and non-free-firmware enabled (required for nvidia-driver)
70+ if [ " $DISTRO " == " debian" ]; then
71+ log_step " 1a" " Ensuring contrib, non-free, and non-free-firmware are enabled in sources.list..."
72+
73+ if [ -f /etc/apt/sources.list ]; then
74+ sudo sed -i ' s/^\s*deb\s\+\(.*\)\s\+main\s*$/deb \1 main contrib non-free non-free-firmware/' /etc/apt/sources.list
75+ fi
76+
77+ # Update once the new components are present
78+ sudo apt-get update
79+ fi
80+
6981# Install necessary packages based on the distribution
7082log_step 2 " Installing a Minimal Desktop Environment, Git, Firefox, ImageMagick, and feh..."
7183if [ " $DISTRO " == " raspbian" ] || [ " $DISTRO " == " debian" ]; then
@@ -82,7 +94,6 @@ if [ "$DISTRO" == "raspbian" ] || [ "$DISTRO" == "debian" ]; then
8294 sudo apt-get install -y exfatprogs || true
8395 sudo apt-get install -y ntfs-3g || true
8496 sudo apt-get install -y exfat-fuse || true
85- sudo apt-get install -y exfatprogs || true
8697 sudo apt-get install -y firefox-esr || true
8798 sudo apt-get install -y alsa-utils || true
8899 sudo apt-get install -y pulseaudio pavucontrol || true
@@ -100,6 +111,14 @@ if [ "$DISTRO" == "raspbian" ] || [ "$DISTRO" == "debian" ]; then
100111 sudo apt-get install -y python3 || true
101112 sudo apt-get install -y python3-pyqt5 || true
102113 sudo apt-get install -y python3-pyqt5* || true
114+ # if [ "$DISTRO" == "debian" ]; then
115+ # sudo apt-get install -y nvidia-driver || true
116+ # sudo apt-get install -y nvidia-tesla-470-driver || true
117+ # sudo apt-get install -y glx-alternative-nvidia || true
118+ # sudo apt-get install -y firmware-misc-nonfree || true
119+ # sudo apt-get install -y firmware-amd-graphics || true
120+ # sudo apt-get install -y xserver-xorg-video-nouveau || true
121+ # fi
103122else
104123 echo " Unsupported distribution: $DISTRO "
105124 exit 1
@@ -136,6 +155,21 @@ sudo chmod +x /usr/local/bin/thinos-devmon || true
136155# Add user to plugdev group
137156sudo usermod -aG plugdev " $USER " || true
138157
158+ #
159+ # # Remove udisks2 entirely to prevent it from auto-mounting optical media to /media/cdrom0
160+ # sudo apt-get purge -y udisks2 2>/dev/null || true
161+ # sudo apt-get autoremove -y 2>/dev/null || true
162+
163+ # Disable udisks2 automount (we use devmon/udevil instead to mount as the session user)
164+ sudo systemctl disable --now udisks2.service udisks2.socket 2> /dev/null || true
165+ sudo systemctl mask udisks2.service udisks2.socket 2> /dev/null || true
166+
167+ #
168+ # If a previous devmon system service exists, disable it (devmon should run in the user session)
169+ sudo systemctl disable --now devmon.service 2> /dev/null || true
170+
171+ echo " NOTE: If optical discs still mount to /media/cdrom0 after reboot, check /etc/fstab for /dev/sr0 entries and remove them so devmon/udevil can handle sr0."
172+
139173# Install or update the PyRDPConnect repository in /usr/share
140174log_step 4 " Installing or updating the PyRDPConnect repository in /usr/share..."
141175if [ -d " /usr/share/PyRDPConnect" ] && [ ! -f " /usr/share/PyRDPConnect/.gitmodules" ]; then
@@ -161,6 +195,10 @@ if [ -d $HOME/.config/openbox ]; then
161195 rm -r $HOME /.config/openbox
162196fi
163197ln -sfn /usr/share/thinOS/src/openbox $HOME /.config/openbox
198+
199+ # NOTE: devmon (auto-mount) should be started from the Openbox autostart file in the thinOS repo.
200+ # Ensure /usr/share/thinOS/src/openbox/autostart (or autostart.sh) contains:
201+ # ( sleep 2 && /usr/local/bin/thinos-devmon ) &
164202ln -sfn /usr/share/thinOS/src/.xinitrc $HOME /.xinitrc
165203ln -sfn /usr/share/thinOS/src/.xinitrc $HOME /.xsession
166204mkdir -p $HOME /.themes
@@ -203,6 +241,22 @@ if [ -f "$FILE" ]; then
203241 sudo sed -i ' s/$/ splash quiet plymouth.ignore-serial-consoles/' " $FILE "
204242 fi
205243fi
244+ if [ " $DISTRO " == " debian" ]; then
245+ log_step " 10a" " Enabling splash and quiet mode via GRUB on Debian..."
246+
247+ # Only touch GRUB_CMDLINE_LINUX_DEFAULT line
248+ if grep -q ' ^GRUB_CMDLINE_LINUX_DEFAULT=' /etc/default/grub; then
249+ # Ensure 'quiet' is present
250+ sudo sed -i ' s/^GRUB_CMDLINE_LINUX_DEFAULT="\([^"]*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 quiet"/' /etc/default/grub
251+
252+ # Ensure 'splash' is present
253+ sudo sed -i ' s/^GRUB_CMDLINE_LINUX_DEFAULT="\([^"]*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 splash plymouth.ignore-serial-consoles net.ifnames=0 biosdevname=0"/' /etc/default/grub
254+ else
255+ echo ' GRUB_CMDLINE_LINUX_DEFAULT="quiet splash plymouth.ignore-serial-consoles"' | sudo tee -a /etc/default/grub
256+ fi
257+
258+ sudo update-grub
259+ fi
206260
207261# Copy and set custom Plymouth theme
208262log_step 11 " Setting the custom Plymouth theme..."
@@ -316,11 +370,31 @@ EOL"
316370 fi
317371fi
318372
319- # Install necessary packages based on the distribution
320- log_step 2 " Installing a ..."
373+ # Configure systemd-resolved and NetworkManager DNS integration
374+ log_step " 14c " " Configuring systemd-resolved and NetworkManager DNS integration ..."
321375if [ " $DISTRO " == " raspbian" ] || [ " $DISTRO " == " debian" ]; then
322- sudo apt-get install -y openvpn-systemd-resolved || true
376+ # Ensure required packages are installed
377+ sudo apt-get install -y systemd-resolved network-manager openvpn-systemd-resolved || true
378+
379+ # Enable and start services
323380 sudo systemctl enable --now systemd-resolved || true
381+ sudo systemctl enable --now NetworkManager || true
382+
383+ # Make /etc/resolv.conf use the systemd-resolved stub resolver
384+ if [ -e /etc/resolv.conf ] || [ -L /etc/resolv.conf ]; then
385+ sudo rm -f /etc/resolv.conf
386+ fi
387+ sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
388+
389+ # Tell NetworkManager to hand DNS to systemd-resolved
390+ sudo mkdir -p /etc/NetworkManager/conf.d
391+ sudo bash -c ' cat > /etc/NetworkManager/conf.d/10-dns-systemd-resolved.conf' << "EOF "
392+ [main]
393+ dns=systemd-resolved
394+ EOF
395+
396+ # Restart NetworkManager to apply DNS settings
397+ sudo systemctl restart NetworkManager || true
324398else
325399 echo " Unsupported distribution: $DISTRO "
326400 exit 1
0 commit comments