From 7a1f867467fff087dc27723574406c3e713634e9 Mon Sep 17 00:00:00 2001 From: debianpepper Date: Fri, 24 May 2024 14:14:37 +0900 Subject: [PATCH] Updated Signed-off-by: debianpepper --- iso_configs/hooks/live/0020-run-py-hook-live | 3 + iso_configs/hooks/live/0030-user-setup | 101 ------------ iso_configs/hooks/live/0040-set-plymouth | 12 -- .../hooks/live/0050-set-misc-permissions | 9 -- .../hooks/live/0060-set-other-settings | 6 - .../normal/deb_32/0520-removeapps.hook.chroot | 12 -- .../hooks/normal/deb_32/0540-misc.hook.chroot | 61 ------- .../0540-run-py-hook-live} | 0 .../deb_32/0600-OS-symlinks.hook.chroot | 37 ----- .../deb_32/0610-set-permissions.hook.chroot | 54 ------- .../deb_32/0950-final-cleanup.hook.chroot | 39 ----- .../deb_32/6050-rename-kernel.hook.binary | 7 - .../0540-run-py-hook-live} | 0 .../0540-run-py-hook-live} | 0 .../normal/dev_32/0520-removeapps.hook.chroot | 12 -- .../hooks/normal/dev_32/0540-misc.hook.chroot | 61 ------- .../0540-run-py-hook-live} | 0 .../dev_32/0600-OS-symlinks.hook.chroot | 37 ----- .../dev_32/0610-set-permissions.hook.chroot | 54 ------- .../dev_32/0950-final-cleanup.hook.chroot | 39 ----- .../dev_32/6050-rename-kernel.hook.binary | 7 - .../hooks/normal/dev_64/0540-run-py-hook-live | 9 ++ .../normal/dev_arm/0540-run-py-hook-live | 9 ++ iso_configs/pylibraries/pepperpy/hooks.py | 6 +- .../pylibraries/pepperpy/hooks_live.py | 149 ++++++++++++++++++ 25 files changed, 173 insertions(+), 551 deletions(-) create mode 100755 iso_configs/hooks/live/0020-run-py-hook-live delete mode 100755 iso_configs/hooks/live/0030-user-setup delete mode 100755 iso_configs/hooks/live/0040-set-plymouth delete mode 100755 iso_configs/hooks/live/0050-set-misc-permissions delete mode 100755 iso_configs/hooks/live/0060-set-other-settings delete mode 100755 iso_configs/hooks/normal/deb_32/0520-removeapps.hook.chroot delete mode 100755 iso_configs/hooks/normal/deb_32/0540-misc.hook.chroot rename iso_configs/hooks/normal/{deb_64/0540-misc.hook.chroot => deb_32/0540-run-py-hook-live} (100%) delete mode 100755 iso_configs/hooks/normal/deb_32/0600-OS-symlinks.hook.chroot delete mode 100755 iso_configs/hooks/normal/deb_32/0610-set-permissions.hook.chroot delete mode 100755 iso_configs/hooks/normal/deb_32/0950-final-cleanup.hook.chroot delete mode 100644 iso_configs/hooks/normal/deb_32/6050-rename-kernel.hook.binary rename iso_configs/hooks/normal/{deb_arm/0540-misc.hook.chroot => deb_64/0540-run-py-hook-live} (100%) rename iso_configs/hooks/normal/{dev_64/0540-misc.hook.chroot => deb_arm/0540-run-py-hook-live} (100%) delete mode 100755 iso_configs/hooks/normal/dev_32/0520-removeapps.hook.chroot delete mode 100755 iso_configs/hooks/normal/dev_32/0540-misc.hook.chroot rename iso_configs/hooks/normal/{dev_arm/0540-misc.hook.chroot => dev_32/0540-run-py-hook-live} (100%) delete mode 100755 iso_configs/hooks/normal/dev_32/0600-OS-symlinks.hook.chroot delete mode 100755 iso_configs/hooks/normal/dev_32/0610-set-permissions.hook.chroot delete mode 100755 iso_configs/hooks/normal/dev_32/0950-final-cleanup.hook.chroot delete mode 100644 iso_configs/hooks/normal/dev_32/6050-rename-kernel.hook.binary create mode 100755 iso_configs/hooks/normal/dev_64/0540-run-py-hook-live create mode 100755 iso_configs/hooks/normal/dev_arm/0540-run-py-hook-live create mode 100644 iso_configs/pylibraries/pepperpy/hooks_live.py diff --git a/iso_configs/hooks/live/0020-run-py-hook-live b/iso_configs/hooks/live/0020-run-py-hook-live new file mode 100755 index 00000000..d40c09aa --- /dev/null +++ b/iso_configs/hooks/live/0020-run-py-hook-live @@ -0,0 +1,3 @@ +#!/bin/bash +# run the main Hooks python module +python3 /usr/lib/python3/dist-packages/pepperpy/hooks_live.py diff --git a/iso_configs/hooks/live/0030-user-setup b/iso_configs/hooks/live/0030-user-setup deleted file mode 100755 index 141ab326..00000000 --- a/iso_configs/hooks/live/0030-user-setup +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh - -. /lib/live/config.sh - -## live-config(7) - System Configuration Components -## Copyright (C) 2016-2020 The Debian Live team -## Copyright (C) 2006-2015 Daniel Baumann -## -## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -## This is free software, and you are welcome to redistribute it -## under certain conditions; see COPYING for details. - - -#set -e - -Cmdline () -{ - # Reading kernel command line - for _PARAMETER in ${LIVE_CONFIG_CMDLINE} - do - case "${_PARAMETER}" in - live-config.user-default-groups=*|user-default-groups=*) - LIVE_USER_DEFAULT_GROUPS="${_PARAMETER#*user-default-groups=}" - ;; - - live-config.user-fullname=*|user-fullname=*) - LIVE_USER_FULLNAME="${_PARAMETER#*user-fullname=}" - ;; - - live-config.username=*|username=*) - LIVE_USERNAME="${_PARAMETER#*username=}" - ;; - esac - done -} - -Init () -{ - # Checking if package is installed or already configured - if ! pkg_is_installed "user-setup" || \ - component_was_executed "user-setup" - then - exit 0 - fi - - echo -n " user-setup" -} - -Config () -{ - # Checking if package is already configured differently - if grep -q "^${LIVE_USERNAME}:" /etc/passwd - then - exit 0 - fi - - # Adjust formating of groups - if [ -n "${LIVE_USER_DEFAULT_GROUPS}" ] - then - LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|,| |g')" - fi - - # Make sure user is not in sudo group if sudo is disabled - case "${LIVE_CONFIG_NOROOT}" in - true) - LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|sudo||')" - ;; - esac - - # Default password is: live - # passwords can be generated with 'echo "live" | mkpasswd -s', - # a blank password is 'U6aMy0wojraho'. -# _PASSWORD="8Ab05sVQ4LLps" - _PASSWORD="U6aMy0wojraho" - -cat > /tmp/live-config.cfg << EOF -user-setup passwd/make-user boolean true -user-setup passwd/root-password-crypted string * -user-setup passwd/user-password-crypted string ${_PASSWORD} -user-setup passwd/user-default-groups string ${LIVE_USER_DEFAULT_GROUPS} -user-setup passwd/user-fullname string ${LIVE_USER_FULLNAME} -user-setup passwd/username string ${LIVE_USERNAME} -user-setup passwd/user-uid string 1000 -EOF - - debconf-set-selections < /tmp/live-config.cfg - rm -f /tmp/live-config.cfg - - # Workaround for bug in shadow - set +e - /usr/lib/user-setup/user-setup-apply 2>&1 \ - | grep -v "Shadow passwords are now on" - set -e - - # Creating state file - touch /var/lib/live/config/user-setup -} - -Cmdline -Init -Config diff --git a/iso_configs/hooks/live/0040-set-plymouth b/iso_configs/hooks/live/0040-set-plymouth deleted file mode 100755 index 9bcee1af..00000000 --- a/iso_configs/hooks/live/0040-set-plymouth +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# set the plymouth on boot -plymouth-set-default-theme -R joy - -#Remove it first -rm -f /etc/alternatives/desktop-theme - -# Then re-add it -ln -s /usr/share/desktop-base/joy-theme /etc/alternatives/desktop-theme - - - diff --git a/iso_configs/hooks/live/0050-set-misc-permissions b/iso_configs/hooks/live/0050-set-misc-permissions deleted file mode 100755 index de51483a..00000000 --- a/iso_configs/hooks/live/0050-set-misc-permissions +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# set installer permissions -chmod 755 /usr/bin/install-peppermint -chmod 755 /usr/share/applications/Install-peppermint.desktop -f=Install-peppermint.desktop ; gio set -t string $f metadata::xfce-exe-checksum "$(sha256sum $f | awk '{print $1}')" -chmod 755 -R /boot/grub/themes -cd /opt -curl -LO https://calamares.io/deploycala.py -python3 deploycala.py diff --git a/iso_configs/hooks/live/0060-set-other-settings b/iso_configs/hooks/live/0060-set-other-settings deleted file mode 100755 index 529ba6bd..00000000 --- a/iso_configs/hooks/live/0060-set-other-settings +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Remove the grub symlink for the background -rm -f /etc/alternatives/desktop-grub -# Then recreate it with the Pep Background -ln -s /usr/share/desktop-base/active-theme/grub/pep-grub-16x9.png /etc/alternatives/desktop-grub diff --git a/iso_configs/hooks/normal/deb_32/0520-removeapps.hook.chroot b/iso_configs/hooks/normal/deb_32/0520-removeapps.hook.chroot deleted file mode 100755 index 79f0fede..00000000 --- a/iso_configs/hooks/normal/deb_32/0520-removeapps.hook.chroot +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -### Error checking added to "lint-trap" section. -### Missing files no longer cause builds to fail. - -# Remove software -# apt remove -y firefox-esr -# apt remove -y termit -apt --purge --yes autoremove gnome-keyring nvidia-tesla-470-alternative systemsettings imagemagick - - - diff --git a/iso_configs/hooks/normal/deb_32/0540-misc.hook.chroot b/iso_configs/hooks/normal/deb_32/0540-misc.hook.chroot deleted file mode 100755 index b7096137..00000000 --- a/iso_configs/hooks/normal/deb_32/0540-misc.hook.chroot +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -#git is needed for the git repos -apt install git --yes -#install pip3, needed for additional python modules -apt install --yes python3-pip -apt install --yes python3.11-venv -# Install the Luakit browser (used for pep tools) -apt install --yes luakit -# Install Plank -apt install --yes plank - -# set the plymouth on boot -plymouth-set-default-theme -R lines - -# install the re keyring -dpkg -i /opt/pepconf/deb-multimedia-keyring_2016.8.1_all.deb - -# install the Wallpapers -apt install --yes pepermint-wallpapers -# Install desktop-base -apt install --yes desktop-base - - - - -# Set the desktop base theme -# Remove it first -rm -f /etc/alternatives/desktop-theme - -# Then re-add it -ln -s /usr/share/desktop-base/lines-theme /etc/alternatives/desktop-theme -# Remove the grub symlink for the background -rm -f /etc/alternatives/desktop-grub -# Then recreate it with the Pep Background -ln -s /usr/share/desktop-base/active-theme/grub/pep-grub-16x9.png /etc/alternatives/desktop-grub - - - -# This will install hblock - a local ad-blocker utility -# https://github.com/hectorm/hblock -# This does not enable it. The user has the choice to turn it on -# by enabling it in PepHub or by typing 'hblock -S builtin' in terminal -curl https://raw.githubusercontent.com/hectorm/hblock/master/hblock --output /tmp/hblock -[ "$(sha256sum /tmp/hblock)" == "4031d86cd04fd7c6cb1b7e9acb1ffdbe9a3f84f693bfb287c68e1f1fa2c14c3b" ] -mv /tmp/hblock /usr/local/bin/hblock -chown 0:0 /usr/local/bin/hblock -chmod 755 /usr/local/bin/hblock -hblock -S none -D none exit 0 - -# check to see if this is the main line if it is then -# take care of raspi -if [ -e /usr/share/peppermint/pep_id ] -then - apt remove raspi-firmware -y - apt purge raspi-firmware -y - apt autoremove -y -else - echo "not there" -fi - diff --git a/iso_configs/hooks/normal/deb_64/0540-misc.hook.chroot b/iso_configs/hooks/normal/deb_32/0540-run-py-hook-live similarity index 100% rename from iso_configs/hooks/normal/deb_64/0540-misc.hook.chroot rename to iso_configs/hooks/normal/deb_32/0540-run-py-hook-live diff --git a/iso_configs/hooks/normal/deb_32/0600-OS-symlinks.hook.chroot b/iso_configs/hooks/normal/deb_32/0600-OS-symlinks.hook.chroot deleted file mode 100755 index 29870c0f..00000000 --- a/iso_configs/hooks/normal/deb_32/0600-OS-symlinks.hook.chroot +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Installing symlinks in the chroot -# We might be changing directories with each symlink. -# Don't assume each instance will be from ~/ for the root user. - -# Workaround for using snapd on debian. Thank You - @stevesveryown. -[ ! -e /etc/skel/.local/share ] && mkdir -p /etc/skel/.local/share -#[ ! -e /var/lib/snapd/desktop/applications ] && -#mkdir -p /var/lib/snapd/desktop/applications && -#chmod 777 /var/lib/snapd/desktop/applications -#ln -s /var/lib/snapd/desktop/applications /etc/skel/.local/share/applications -ln -s snap /usr/bin/snap-store - -# This fixes the 'Right-Click doesn't open terminal in nemo' issue. -ln -s xfce4-terminal /usr/bin/gnome-terminal - -# This work-around lets ICE find Chromium (cromium-browser) in /usr/bin . -# No similar work-arounds were needed for FF, FF-ESR, Chrome or Vivaldi . -ln -s chromium /usr/bin/chromium-browser - - -# These are for the 3 installer scripts - icons.sh, themes.sh & walls.sh -# In 0610- we set the permissions to 777 on the DIRECTORY, not the contents. -ln -s icons /usr/share/pepicons -ln -s themes /usr/share/pepthemes -ln -s backgrounds /usr/share/pepwallpaper - -# A better version of vi and vim than vim-tiny -rm /etc/alternatives/vi -ln -s ../../etc/alternatives/vim /usr/bin/vim -ln -s ../../usr/bin/vim.tiny /etc/alternatives/vim -ln -s ../../usr/bin/busybox /etc/alternatives/vi - -# Put a .png at ~/.face from within /etc/skel -#ln -s /usr/share/pixmaps/logo.png /etc/skel/.face - diff --git a/iso_configs/hooks/normal/deb_32/0610-set-permissions.hook.chroot b/iso_configs/hooks/normal/deb_32/0610-set-permissions.hook.chroot deleted file mode 100755 index be56048f..00000000 --- a/iso_configs/hooks/normal/deb_32/0610-set-permissions.hook.chroot +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# As we progress, we may find additional files REQUIRING special permissions. -# Set write permissions for these files and directories in the chroot here. - -# This allows write access to the Welcome Screen database to users in the "cdrom" group. -# IF this a system wide file, one user can disable or turn it off for *ALL* accounts. -# If this is meant to be on a per user basis, put the .db in ${HOME}/.config . -# Or rewrite welcome.py to write to the .db WHICH user requested to disable this feature. -# Set Permissions on desktop files -# Desktop links -chmod 755 /usr/share/applications/Pephub.desktop -chmod 755 /usr/share/applications/Welcome.desktop -chmod 755 /usr/share/applications/plank.desktop -chmod 755 /usr/share/applications/kumo.desktop -chmod 755 /usr/share/applications/Install-peppermint.desktop -# Executables -chmod 755 /usr/local/bin/hub -chmod 755 /usr/local/bin/xDaily -chmod 755 /usr/local/bin/kumo -chmod 755 /usr/local/bin/welcome -chmod 755 /usr/bin/install-peppermint -# Set permissions on the Python libs -chmod 755 -R /usr/lib/python3/dist-packages/tendo -chmod 755 -R /usr/lib/python3/dist-packages/tendo-0.3.0.dist-info -chmod 755 -R /usr/lib/python3/dist-packages/ttkbootstrap -chmod 755 -R /usr/lib/python3/dist-packages/ttkbootstrap-1.10.1.dist-info -chmod 755 -R /usr/lib/python3/dist-packages/ttkcreator -# Set permissions on the lines theme -chmod 755 -R /usr/share/desktop-base/lines-theme -# Set Grub Themes Permission -chmod 755 -R /boot/grub/themes -# Set the Calamares Permissions] -chmod 755 -R /etc/calamares - -### After installation, additional groups to add new users to. -grep -B99 "#EXTRA_GROUPS=" /etc/adduser.conf > /etc/adduser.conf.new -grep "#EXTRA_GROUPS=" /etc/adduser.conf | cut -c2- >> /etc/adduser.conf.new -grep -B3 "#ADD_EXTRA_GROUPS=" /etc/adduser.conf >> /etc/adduser.conf.new -grep "#ADD_EXTRA_GROUPS=" /etc/adduser.conf | cut -c2- >> /etc/adduser.conf.new -grep -B3 "#NAME_REGEX=" /etc/adduser.conf >> /etc/adduser.conf.new - - -# These are for the 3 installer scripts - icons.sh, themes.sh & walls.sh -# In 0600- we created symlinks to these directories. This makes them writable. -chmod 755 -R /usr/share/icons -chmod 755 -R /usr/share/themes -chmod 755 -R /usr/share/backgrounds -chmod 755 -R /usr/share/pixmaps - -# Quick patch from https://www.zdnet.com/article/major-linux-policykit-security-vulnerability-uncovered-pwnkit/ -#chmod 0755 /usr/bin/pkexec # Their patch didn't work "pkexec must be setuid root" - - diff --git a/iso_configs/hooks/normal/deb_32/0950-final-cleanup.hook.chroot b/iso_configs/hooks/normal/deb_32/0950-final-cleanup.hook.chroot deleted file mode 100755 index 877fb9a3..00000000 --- a/iso_configs/hooks/normal/deb_32/0950-final-cleanup.hook.chroot +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -### Error checking added to "lint-trap" section. -### Missing files no longer cause builds to fail. - -### Do NOT remove these files. -# /usr/share/lightdm/lightdm.conf.d/01_debian.conf - -## This section is the "lint-trap" to remove files and/or -## directories not associated with or required by PepOS. -## Followed by \ , add files to be removed, one per line. - -for i in \ -/usr/bin/install-debian \ -/usr/share/applications/install-debian.desktop \ -/usr/share/applications/xfburn.desktop \ -/usr/share/applications/luakit.desktop \ -/root/.cache/pip \ - - do [ -e $i ] && - rm -rf ${i} || - echo " The path ${i} was not found and couldn't be removed." - done - - -### This might be better in an OS-tweaks hook script. -# Lowers the footprint in RAM by 200 MB at the small expense of added size to the ISO. -update-icon-caches /usr/share/icons/* - -### Setting --apt-recommends and --apt-suggests defaults to '0' -echo -e "# Changing these values to \"1\" may quickly fill up a small partition" > /etc/apt/apt.conf.d/99No-Recommends -echo -e "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99No-Recommends - -### Fixes the "Not installing grub for UEFI Secure Boot" in all versions , after the default was changed. -#sed s/keyutils/"keyutils --install-recommends"/ /usr/sbin/bootloader-config > /tmp/bootloader-config -echo -e "$(grep -A1 -B20 "Installing grub-efi (uefi)..." /usr/sbin/bootloader-config) --install-recommends" > /tmp/bootloader-config -echo -e "$(grep -A2 "else" /usr/sbin/bootloader-config) --install-recommends\nfi" >> /tmp/bootloader-config -chmod +x /tmp/bootloader-config && mv /tmp/bootloader-config /usr/sbin/bootloader-config - diff --git a/iso_configs/hooks/normal/deb_32/6050-rename-kernel.hook.binary b/iso_configs/hooks/normal/deb_32/6050-rename-kernel.hook.binary deleted file mode 100644 index f3e592aa..00000000 --- a/iso_configs/hooks/normal/deb_32/6050-rename-kernel.hook.binary +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -#John's note: this will not harm the other architectures. -rm live/initrd.img -rm live/vmlinuz - -cp live/initrd.img-* live/initrd.img -cp live/vmlinuz-* live/vmlinuz \ No newline at end of file diff --git a/iso_configs/hooks/normal/deb_arm/0540-misc.hook.chroot b/iso_configs/hooks/normal/deb_64/0540-run-py-hook-live similarity index 100% rename from iso_configs/hooks/normal/deb_arm/0540-misc.hook.chroot rename to iso_configs/hooks/normal/deb_64/0540-run-py-hook-live diff --git a/iso_configs/hooks/normal/dev_64/0540-misc.hook.chroot b/iso_configs/hooks/normal/deb_arm/0540-run-py-hook-live similarity index 100% rename from iso_configs/hooks/normal/dev_64/0540-misc.hook.chroot rename to iso_configs/hooks/normal/deb_arm/0540-run-py-hook-live diff --git a/iso_configs/hooks/normal/dev_32/0520-removeapps.hook.chroot b/iso_configs/hooks/normal/dev_32/0520-removeapps.hook.chroot deleted file mode 100755 index 79f0fede..00000000 --- a/iso_configs/hooks/normal/dev_32/0520-removeapps.hook.chroot +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -### Error checking added to "lint-trap" section. -### Missing files no longer cause builds to fail. - -# Remove software -# apt remove -y firefox-esr -# apt remove -y termit -apt --purge --yes autoremove gnome-keyring nvidia-tesla-470-alternative systemsettings imagemagick - - - diff --git a/iso_configs/hooks/normal/dev_32/0540-misc.hook.chroot b/iso_configs/hooks/normal/dev_32/0540-misc.hook.chroot deleted file mode 100755 index b7096137..00000000 --- a/iso_configs/hooks/normal/dev_32/0540-misc.hook.chroot +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -#git is needed for the git repos -apt install git --yes -#install pip3, needed for additional python modules -apt install --yes python3-pip -apt install --yes python3.11-venv -# Install the Luakit browser (used for pep tools) -apt install --yes luakit -# Install Plank -apt install --yes plank - -# set the plymouth on boot -plymouth-set-default-theme -R lines - -# install the re keyring -dpkg -i /opt/pepconf/deb-multimedia-keyring_2016.8.1_all.deb - -# install the Wallpapers -apt install --yes pepermint-wallpapers -# Install desktop-base -apt install --yes desktop-base - - - - -# Set the desktop base theme -# Remove it first -rm -f /etc/alternatives/desktop-theme - -# Then re-add it -ln -s /usr/share/desktop-base/lines-theme /etc/alternatives/desktop-theme -# Remove the grub symlink for the background -rm -f /etc/alternatives/desktop-grub -# Then recreate it with the Pep Background -ln -s /usr/share/desktop-base/active-theme/grub/pep-grub-16x9.png /etc/alternatives/desktop-grub - - - -# This will install hblock - a local ad-blocker utility -# https://github.com/hectorm/hblock -# This does not enable it. The user has the choice to turn it on -# by enabling it in PepHub or by typing 'hblock -S builtin' in terminal -curl https://raw.githubusercontent.com/hectorm/hblock/master/hblock --output /tmp/hblock -[ "$(sha256sum /tmp/hblock)" == "4031d86cd04fd7c6cb1b7e9acb1ffdbe9a3f84f693bfb287c68e1f1fa2c14c3b" ] -mv /tmp/hblock /usr/local/bin/hblock -chown 0:0 /usr/local/bin/hblock -chmod 755 /usr/local/bin/hblock -hblock -S none -D none exit 0 - -# check to see if this is the main line if it is then -# take care of raspi -if [ -e /usr/share/peppermint/pep_id ] -then - apt remove raspi-firmware -y - apt purge raspi-firmware -y - apt autoremove -y -else - echo "not there" -fi - diff --git a/iso_configs/hooks/normal/dev_arm/0540-misc.hook.chroot b/iso_configs/hooks/normal/dev_32/0540-run-py-hook-live similarity index 100% rename from iso_configs/hooks/normal/dev_arm/0540-misc.hook.chroot rename to iso_configs/hooks/normal/dev_32/0540-run-py-hook-live diff --git a/iso_configs/hooks/normal/dev_32/0600-OS-symlinks.hook.chroot b/iso_configs/hooks/normal/dev_32/0600-OS-symlinks.hook.chroot deleted file mode 100755 index 29870c0f..00000000 --- a/iso_configs/hooks/normal/dev_32/0600-OS-symlinks.hook.chroot +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Installing symlinks in the chroot -# We might be changing directories with each symlink. -# Don't assume each instance will be from ~/ for the root user. - -# Workaround for using snapd on debian. Thank You - @stevesveryown. -[ ! -e /etc/skel/.local/share ] && mkdir -p /etc/skel/.local/share -#[ ! -e /var/lib/snapd/desktop/applications ] && -#mkdir -p /var/lib/snapd/desktop/applications && -#chmod 777 /var/lib/snapd/desktop/applications -#ln -s /var/lib/snapd/desktop/applications /etc/skel/.local/share/applications -ln -s snap /usr/bin/snap-store - -# This fixes the 'Right-Click doesn't open terminal in nemo' issue. -ln -s xfce4-terminal /usr/bin/gnome-terminal - -# This work-around lets ICE find Chromium (cromium-browser) in /usr/bin . -# No similar work-arounds were needed for FF, FF-ESR, Chrome or Vivaldi . -ln -s chromium /usr/bin/chromium-browser - - -# These are for the 3 installer scripts - icons.sh, themes.sh & walls.sh -# In 0610- we set the permissions to 777 on the DIRECTORY, not the contents. -ln -s icons /usr/share/pepicons -ln -s themes /usr/share/pepthemes -ln -s backgrounds /usr/share/pepwallpaper - -# A better version of vi and vim than vim-tiny -rm /etc/alternatives/vi -ln -s ../../etc/alternatives/vim /usr/bin/vim -ln -s ../../usr/bin/vim.tiny /etc/alternatives/vim -ln -s ../../usr/bin/busybox /etc/alternatives/vi - -# Put a .png at ~/.face from within /etc/skel -#ln -s /usr/share/pixmaps/logo.png /etc/skel/.face - diff --git a/iso_configs/hooks/normal/dev_32/0610-set-permissions.hook.chroot b/iso_configs/hooks/normal/dev_32/0610-set-permissions.hook.chroot deleted file mode 100755 index be56048f..00000000 --- a/iso_configs/hooks/normal/dev_32/0610-set-permissions.hook.chroot +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# As we progress, we may find additional files REQUIRING special permissions. -# Set write permissions for these files and directories in the chroot here. - -# This allows write access to the Welcome Screen database to users in the "cdrom" group. -# IF this a system wide file, one user can disable or turn it off for *ALL* accounts. -# If this is meant to be on a per user basis, put the .db in ${HOME}/.config . -# Or rewrite welcome.py to write to the .db WHICH user requested to disable this feature. -# Set Permissions on desktop files -# Desktop links -chmod 755 /usr/share/applications/Pephub.desktop -chmod 755 /usr/share/applications/Welcome.desktop -chmod 755 /usr/share/applications/plank.desktop -chmod 755 /usr/share/applications/kumo.desktop -chmod 755 /usr/share/applications/Install-peppermint.desktop -# Executables -chmod 755 /usr/local/bin/hub -chmod 755 /usr/local/bin/xDaily -chmod 755 /usr/local/bin/kumo -chmod 755 /usr/local/bin/welcome -chmod 755 /usr/bin/install-peppermint -# Set permissions on the Python libs -chmod 755 -R /usr/lib/python3/dist-packages/tendo -chmod 755 -R /usr/lib/python3/dist-packages/tendo-0.3.0.dist-info -chmod 755 -R /usr/lib/python3/dist-packages/ttkbootstrap -chmod 755 -R /usr/lib/python3/dist-packages/ttkbootstrap-1.10.1.dist-info -chmod 755 -R /usr/lib/python3/dist-packages/ttkcreator -# Set permissions on the lines theme -chmod 755 -R /usr/share/desktop-base/lines-theme -# Set Grub Themes Permission -chmod 755 -R /boot/grub/themes -# Set the Calamares Permissions] -chmod 755 -R /etc/calamares - -### After installation, additional groups to add new users to. -grep -B99 "#EXTRA_GROUPS=" /etc/adduser.conf > /etc/adduser.conf.new -grep "#EXTRA_GROUPS=" /etc/adduser.conf | cut -c2- >> /etc/adduser.conf.new -grep -B3 "#ADD_EXTRA_GROUPS=" /etc/adduser.conf >> /etc/adduser.conf.new -grep "#ADD_EXTRA_GROUPS=" /etc/adduser.conf | cut -c2- >> /etc/adduser.conf.new -grep -B3 "#NAME_REGEX=" /etc/adduser.conf >> /etc/adduser.conf.new - - -# These are for the 3 installer scripts - icons.sh, themes.sh & walls.sh -# In 0600- we created symlinks to these directories. This makes them writable. -chmod 755 -R /usr/share/icons -chmod 755 -R /usr/share/themes -chmod 755 -R /usr/share/backgrounds -chmod 755 -R /usr/share/pixmaps - -# Quick patch from https://www.zdnet.com/article/major-linux-policykit-security-vulnerability-uncovered-pwnkit/ -#chmod 0755 /usr/bin/pkexec # Their patch didn't work "pkexec must be setuid root" - - diff --git a/iso_configs/hooks/normal/dev_32/0950-final-cleanup.hook.chroot b/iso_configs/hooks/normal/dev_32/0950-final-cleanup.hook.chroot deleted file mode 100755 index 877fb9a3..00000000 --- a/iso_configs/hooks/normal/dev_32/0950-final-cleanup.hook.chroot +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -### Error checking added to "lint-trap" section. -### Missing files no longer cause builds to fail. - -### Do NOT remove these files. -# /usr/share/lightdm/lightdm.conf.d/01_debian.conf - -## This section is the "lint-trap" to remove files and/or -## directories not associated with or required by PepOS. -## Followed by \ , add files to be removed, one per line. - -for i in \ -/usr/bin/install-debian \ -/usr/share/applications/install-debian.desktop \ -/usr/share/applications/xfburn.desktop \ -/usr/share/applications/luakit.desktop \ -/root/.cache/pip \ - - do [ -e $i ] && - rm -rf ${i} || - echo " The path ${i} was not found and couldn't be removed." - done - - -### This might be better in an OS-tweaks hook script. -# Lowers the footprint in RAM by 200 MB at the small expense of added size to the ISO. -update-icon-caches /usr/share/icons/* - -### Setting --apt-recommends and --apt-suggests defaults to '0' -echo -e "# Changing these values to \"1\" may quickly fill up a small partition" > /etc/apt/apt.conf.d/99No-Recommends -echo -e "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99No-Recommends - -### Fixes the "Not installing grub for UEFI Secure Boot" in all versions , after the default was changed. -#sed s/keyutils/"keyutils --install-recommends"/ /usr/sbin/bootloader-config > /tmp/bootloader-config -echo -e "$(grep -A1 -B20 "Installing grub-efi (uefi)..." /usr/sbin/bootloader-config) --install-recommends" > /tmp/bootloader-config -echo -e "$(grep -A2 "else" /usr/sbin/bootloader-config) --install-recommends\nfi" >> /tmp/bootloader-config -chmod +x /tmp/bootloader-config && mv /tmp/bootloader-config /usr/sbin/bootloader-config - diff --git a/iso_configs/hooks/normal/dev_32/6050-rename-kernel.hook.binary b/iso_configs/hooks/normal/dev_32/6050-rename-kernel.hook.binary deleted file mode 100644 index f3e592aa..00000000 --- a/iso_configs/hooks/normal/dev_32/6050-rename-kernel.hook.binary +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -#John's note: this will not harm the other architectures. -rm live/initrd.img -rm live/vmlinuz - -cp live/initrd.img-* live/initrd.img -cp live/vmlinuz-* live/vmlinuz \ No newline at end of file diff --git a/iso_configs/hooks/normal/dev_64/0540-run-py-hook-live b/iso_configs/hooks/normal/dev_64/0540-run-py-hook-live new file mode 100755 index 00000000..31cab666 --- /dev/null +++ b/iso_configs/hooks/normal/dev_64/0540-run-py-hook-live @@ -0,0 +1,9 @@ +#!/bin/bash +# run the main Hooks python module +python3 /usr/lib/python3/dist-packages/pepperpy/hooks.py + +### Setting --apt-recommends and --apt-suggests defaults to '0' +echo -e "# Changing these values to \"1\" may quickly fill up a small partition" > /etc/apt/apt.conf.d/99No-Recommends +echo -e "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99No-Recommends + + diff --git a/iso_configs/hooks/normal/dev_arm/0540-run-py-hook-live b/iso_configs/hooks/normal/dev_arm/0540-run-py-hook-live new file mode 100755 index 00000000..31cab666 --- /dev/null +++ b/iso_configs/hooks/normal/dev_arm/0540-run-py-hook-live @@ -0,0 +1,9 @@ +#!/bin/bash +# run the main Hooks python module +python3 /usr/lib/python3/dist-packages/pepperpy/hooks.py + +### Setting --apt-recommends and --apt-suggests defaults to '0' +echo -e "# Changing these values to \"1\" may quickly fill up a small partition" > /etc/apt/apt.conf.d/99No-Recommends +echo -e "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99No-Recommends + + diff --git a/iso_configs/pylibraries/pepperpy/hooks.py b/iso_configs/pylibraries/pepperpy/hooks.py index 3e0e0198..ae4d9213 100644 --- a/iso_configs/pylibraries/pepperpy/hooks.py +++ b/iso_configs/pylibraries/pepperpy/hooks.py @@ -3,7 +3,7 @@ * * License: SPDX-License-Identifier: GPL-3.0-or-later * -* This hook is the central one used for all the buiold +* This hook is the central one used for all the builds * Add things as needed """ import os @@ -49,11 +49,11 @@ def setup_plymouth_theme_grub(): """ Set the plymouth boot theme and desktop theme, as well as grub """ - os.system('plymouth-set-default-theme -R lines') + os.system('plymouth-set-default-theme -R joy') os.system('rm -f /etc/alternatives/desktop-theme') os.system('rm -f /etc/alternatives/desktop-grub') - theme_source = "/usr/share/desktop-base/lines-theme" + theme_source = "/usr/share/desktop-base/joy-theme" theme_destination = "/etc/alternatives/desktop-theme" theme_command = f"ln -s {theme_source} {theme_destination}" os.system(theme_command) diff --git a/iso_configs/pylibraries/pepperpy/hooks_live.py b/iso_configs/pylibraries/pepperpy/hooks_live.py new file mode 100644 index 00000000..43d04fd9 --- /dev/null +++ b/iso_configs/pylibraries/pepperpy/hooks_live.py @@ -0,0 +1,149 @@ +""" +* Author: "PeppermintOS Team(peppermintosteam@proton.me) +* +* License: SPDX-License-Identifier: GPL-3.0-or-later +* +* This hook is the central one used for the live session +* Add things as needed +""" +import os +import subprocess + +def cmdline(): + """ Function to read kernel command line parameters """ + global LIVE_USER_DEFAULT_GROUPS, LIVE_USER_FULLNAME, LIVE_USERNAME + LIVE_USER_DEFAULT_GROUPS = "" + LIVE_USER_FULLNAME = "" + LIVE_USERNAME = "" + + # Read kernel command line parameters + with open("/proc/cmdline", "r") as f: + cmdline_params = f.read().split() + + for param in cmdline_params: + if "live-config.user-default-groups=" in param or "user-default-groups=" in param: + LIVE_USER_DEFAULT_GROUPS = param.split('=')[-1] + elif "live-config.user-fullname=" in param or "user-fullname=" in param: + LIVE_USER_FULLNAME = param.split('=')[-1] + elif "live-config.username=" in param or "username=" in param: + LIVE_USERNAME = param.split('=')[-1] + + +def pkg_is_installed(pkg_name): + """ Function to check if a package is installed """ + result = subprocess.run(['dpkg', '-s', pkg_name], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + return result.returncode == 0 + + +def component_was_executed(component_name): + """ Function to check if a component was executed """ + return os.path.exists(f"/var/lib/live/config/{component_name}") + + +def init(): + """ Initialization function """ + if not pkg_is_installed("user-setup") or component_was_executed("user-setup"): + exit(0) + print(" user-setup", end='') + + +def config(): + """ Configuration function """ + global LIVE_USER_DEFAULT_GROUPS + + # Check if user is already configured + with open("/etc/passwd", "r") as f: + if any(LIVE_USERNAME in line for line in f): + exit(0) + + # Adjust formatting of groups + if LIVE_USER_DEFAULT_GROUPS: + LIVE_USER_DEFAULT_GROUPS = LIVE_USER_DEFAULT_GROUPS.replace(",", " ") + + # Make sure user is not in sudo group if sudo is disabled + if os.getenv("LIVE_CONFIG_NOROOT") == "true": + LIVE_USER_DEFAULT_GROUPS = LIVE_USER_DEFAULT_GROUPS.replace("sudo", "") + + # Default password is 'U6aMy0wojraho' (blank password) + _PASSWORD = "U6aMy0wojraho" + + # Write configuration to temporary file + with open("/tmp/live-config.cfg", "w") as f: + f.write(f"""user-setup passwd/make-user boolean true +user-setup passwd/root-password-crypted string * +user-setup passwd/user-password-crypted string {_PASSWORD} +user-setup passwd/user-default-groups string {LIVE_USER_DEFAULT_GROUPS} +user-setup passwd/user-fullname string {LIVE_USER_FULLNAME} +user-setup passwd/username string {LIVE_USERNAME} +user-setup passwd/user-uid string 1000 +""") + + # Apply configuration + subprocess.run(['debconf-set-selections', '<', '/tmp/live-config.cfg'], + shell=True) + os.remove("/tmp/live-config.cfg") + + # Workaround for bug in shadow + result = subprocess.run(['/usr/lib/user-setup/user-setup-apply'], + stderr=subprocess.PIPE) + for line in result.stderr.decode().split('\n'): + if "Shadow passwords are now on" not in line: + print(line) + + # Creating state file + with open("/var/lib/live/config/user-setup", "w") as f: + f.write("") + + +def set_plymouth(): + """ + 1. set the plymouth on boot + 2. Remove the defauly theme + 3. Re added the new default theme + """ + source = '/usr/share/desktop-base/joy-theme' + destination = '/etc/alternatives/desktop-theme' + + os.system('plymouth-set-default-theme -R joy') + os.system('rm -f /etc/alternatives/desktop-theme') + os.system(f'ln -sf {source} {destination}') + + +def set_installer_permissions(): + """ + set permmissions needed for general install + """ + source = '/usr/share/desktop-base/joy-theme' + destination = '/etc/alternatives/desktop-theme' + makelnk = f'ln -sf {source} {destination}' + + os.system('chmod 755 /usr/bin/install-peppermint') + os.system('chmod 755 /usr/share/applications/Install-peppermint.desktop') + os.system(makelnk) + os.system('chmod 755 -R /boot/grub/themes') + os.system('cd /opt') + os.system('curl -LO https://calamares.io/deploycala.py') + os.system('python3 deploycala.py') + + +def other_misc_settings(): + """ + Other settings as needed + """ + source ="/usr/share/desktop-base/active-theme/grub/pep-grub-16x9.png" + destination = "/etc/alternatives/desktop-grub" + makelnk = f'ln -sf {source} {destination}' + # Remove the grub symlink for the background + os.system('rm -f /etc/alternatives/desktop-grub') + # Then recreate it with the Pep Background + os.system(makelnk) + + + +# Main execution +cmdline() +init() +config() +set_plymouth() +set_installer_permissions()