From 3a911dc2f03ffb4bc548300a79224a0972e11f35 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 24 Mar 2024 00:43:31 +0200 Subject: [PATCH] Make gui module use /opt/custompios/scripts # 218 https://github.com/guysoft/FullPageOS/issues/525 --- src/modules/gui/end_chroot_script | 6 ++++-- .../gui/filesystem/{home/pi => opt}/scripts/enable_gpu | 2 +- .../gui/filesystem/{home/pi => opt}/scripts/rotate.sh | 0 .../gui/filesystem/{home/pi => opt}/scripts/start_gui | 0 src/modules/gui/filesystem/opt/scripts/update_lightdm_conf | 6 ++++++ .../etc/systemd/system/enable_gpu_first_boot.service | 2 +- .../root_init/usr/share/xsessions/guisession.desktop | 2 +- src/modules/gui/start_chroot_script | 4 +++- 8 files changed, 16 insertions(+), 6 deletions(-) rename src/modules/gui/filesystem/{home/pi => opt}/scripts/enable_gpu (93%) rename src/modules/gui/filesystem/{home/pi => opt}/scripts/rotate.sh (100%) rename src/modules/gui/filesystem/{home/pi => opt}/scripts/start_gui (100%) create mode 100755 src/modules/gui/filesystem/opt/scripts/update_lightdm_conf diff --git a/src/modules/gui/end_chroot_script b/src/modules/gui/end_chroot_script index 998d1799..7c734dbf 100755 --- a/src/modules/gui/end_chroot_script +++ b/src/modules/gui/end_chroot_script @@ -9,9 +9,11 @@ install_cleanup_trap #set up gui service sed -i 's/#user-session=.*/user-session=guisession/g' /etc/lightdm/lightdm.conf -sed -i 's/#autologin-user=.*/autologin-user=pi/g' /etc/lightdm/lightdm.conf +# This is now down as a systemd service to handle username conf on boot +sed -i 's/#autologin-user=.*/autologin-user=UID_1000_PLACEHOLDER/g' /etc/lightdm/lightdm.conf +systemctl enable update_lightdm_conf.service # set the gui to run the main script of the GUI session -sed -i "s@GUI_SESSION_PLACEHOLDEFR@${GUI_STARTUP_SCRIPT}@g" /home/pi/scripts/start_gui +sed -i "s@GUI_SESSION_PLACEHOLDEFR@${GUI_STARTUP_SCRIPT}@g" /opt/custompios/scripts/start_gui rm -r /usr/sbin/policy-rc.d || true diff --git a/src/modules/gui/filesystem/home/pi/scripts/enable_gpu b/src/modules/gui/filesystem/opt/scripts/enable_gpu similarity index 93% rename from src/modules/gui/filesystem/home/pi/scripts/enable_gpu rename to src/modules/gui/filesystem/opt/scripts/enable_gpu index 0646af49..5b812b72 100755 --- a/src/modules/gui/filesystem/home/pi/scripts/enable_gpu +++ b/src/modules/gui/filesystem/opt/scripts/enable_gpu @@ -1,6 +1,6 @@ #!/bin/bash if [ ! -f /etc/gpu_enabled ]; then - sudo sed 's@matchbox-window-manager \&@compton -b -d :0 --backend glx --unredir-if-possible --glx-swap-method buffer-age --glx-no-stencil --paint-on-overlay --vsync opengl \nmatchbox-window-manager \&@g' -i /home/pi/scripts/start_gui + sudo sed 's@matchbox-window-manager \&@compton -b -d :0 --backend glx --unredir-if-possible --glx-swap-method buffer-age --glx-no-stencil --paint-on-overlay --vsync opengl \nmatchbox-window-manager \&@g' -i /opt/custompios/scripts/scripts/start_gui sudo sed -i /boot/firmware/cmdline.txt -e "s/ quiet//" sudo sed -i /boot/firmware/cmdline.txt -e "s/ splash//" sudo sed -i /boot/firmware/cmdline.txt -e "s/ plymouth.ignore-serial-consoles//" diff --git a/src/modules/gui/filesystem/home/pi/scripts/rotate.sh b/src/modules/gui/filesystem/opt/scripts/rotate.sh similarity index 100% rename from src/modules/gui/filesystem/home/pi/scripts/rotate.sh rename to src/modules/gui/filesystem/opt/scripts/rotate.sh diff --git a/src/modules/gui/filesystem/home/pi/scripts/start_gui b/src/modules/gui/filesystem/opt/scripts/start_gui similarity index 100% rename from src/modules/gui/filesystem/home/pi/scripts/start_gui rename to src/modules/gui/filesystem/opt/scripts/start_gui diff --git a/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf b/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf new file mode 100755 index 00000000..1fbd68ff --- /dev/null +++ b/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf @@ -0,0 +1,6 @@ +#!/bin/bash +if [ ! -f /etc/updated_lightdm_conf ]; then + sed -i 's/UID_1000_PLACEHOLDER/'$(id -nu 1000)'/g' /etc/lightdm/lightdm.conf + touch /etc/updated_lightdm_conf + # sudo shutdown -r now +fi diff --git a/src/modules/gui/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service b/src/modules/gui/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service index 68953004..e51df8b2 100644 --- a/src/modules/gui/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service +++ b/src/modules/gui/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service @@ -1,7 +1,7 @@ [Unit] Description=on first boot set up GPU acceleration [Service] -ExecStart=/home/pi/scripts/enable_gpu +ExecStart=/opt/custompios/scripts/enable_gpu ExecStop= [Install] WantedBy=multi-user.target diff --git a/src/modules/gui/filesystem/root_init/usr/share/xsessions/guisession.desktop b/src/modules/gui/filesystem/root_init/usr/share/xsessions/guisession.desktop index 88b9600e..1d37b57a 100644 --- a/src/modules/gui/filesystem/root_init/usr/share/xsessions/guisession.desktop +++ b/src/modules/gui/filesystem/root_init/usr/share/xsessions/guisession.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Version=1.0 Name=GUISession -Exec=/home/pi/scripts/start_gui +Exec=/opt/custompios/scripts/start_gui Comment=Startup of the minimal CustomPiOS GUI Type=Application diff --git a/src/modules/gui/start_chroot_script b/src/modules/gui/start_chroot_script index 46827ef1..4fd74da8 100755 --- a/src/modules/gui/start_chroot_script +++ b/src/modules/gui/start_chroot_script @@ -8,9 +8,11 @@ set -e source /common.sh -unpack /filesystem/home/pi /home/pi pi +unpack /filesystem/opt /opt/custompios pi unpack /filesystem/root_init / +ln -s /opt/custompios/scripts /home/pi/scripts + echo exit 101 > /usr/sbin/policy-rc.d chmod +x /usr/sbin/policy-rc.d