diff --git a/build.sh b/build.sh index 0ed242b..e8c39d6 100755 --- a/build.sh +++ b/build.sh @@ -198,15 +198,16 @@ if [ -z "${DEPLOY_COMPRESSION}" ] && [ "${DEPLOY_ZIP:-1}" = "0" ]; then echo "Please update your config file" DEPLOY_COMPRESSION=none fi -export DEPLOY_COMPRESSION=${DEPLOY_COMPRESSION:-zip} +export DEPLOY_COMPRESSION=${DEPLOY_COMPRESSION:-xz} export COMPRESSION_LEVEL=${COMPRESSION_LEVEL:-6} export LOG_FILE="${WORK_DIR}/build.log" export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi} -export FIRST_USER_NAME=${FIRST_USER_NAME:-setup} +export FIRST_USER_NAME=${FIRST_USER_NAME:-system} export FIRST_USER_PASS export DISABLE_FIRST_BOOT_USER_RENAME=${DISABLE_FIRST_BOOT_USER_RENAME:-0} +export FIRST_USER_ISSYSTEM=${FIRST_USER_ISSYSTEM:-true} export WPA_COUNTRY export ENABLE_SSH="${ENABLE_SSH:-0}" export PUBKEY_ONLY_SSH="${PUBKEY_ONLY_SSH:-0}" diff --git a/export-image/01-user-rename/00-packages b/export-image/01-user-rename/00-packages index e8b69fc..1cde73d 100644 --- a/export-image/01-user-rename/00-packages +++ b/export-image/01-user-rename/00-packages @@ -1 +1 @@ -userconf-pi +#userconf-pi diff --git a/export-image/01-user-rename/01-run.sh b/export-image/01-user-rename/01-run.sh index aa5dd94..7af6c06 100755 --- a/export-image/01-user-rename/01-run.sh +++ b/export-image/01-user-rename/01-run.sh @@ -1,9 +1,9 @@ #!/bin/bash -e -if [[ "${DISABLE_FIRST_BOOT_USER_RENAME}" == "0" ]]; then - on_chroot <<- EOF - SUDO_USER="${FIRST_USER_NAME}" rename-user -f -s - EOF -else - rm -f "${ROOTFS_DIR}/etc/xdg/autostart/piwiz.desktop" -fi +#if [[ "${DISABLE_FIRST_BOOT_USER_RENAME}" == "0" ]]; then +# on_chroot <<- EOF +# SUDO_USER="${FIRST_USER_NAME}" rename-user -f -s +# EOF +#else +# rm -f "${ROOTFS_DIR}/etc/xdg/autostart/piwiz.desktop" +#fi diff --git a/export-image/02-set-sources/01-run.sh b/export-image/02-set-sources/01-run.sh index 3cfb9d5..cf783c5 100755 --- a/export-image/02-set-sources/01-run.sh +++ b/export-image/02-set-sources/01-run.sh @@ -3,8 +3,8 @@ rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" find "${ROOTFS_DIR}/var/lib/apt/lists/" -type f -delete on_chroot << EOF -apt-file update apt-get update apt-get -y dist-upgrade --auto-remove --purge apt-get clean +apt-file update EOF diff --git a/export-image/04-set-partuuid/00-run.sh b/export-image/04-set-partuuid/00-run.sh index 99500f3..c4d0304 100755 --- a/export-image/04-set-partuuid/00-run.sh +++ b/export-image/04-set-partuuid/00-run.sh @@ -6,8 +6,10 @@ IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f BOOT_PARTUUID="${IMGID}-01" ROOT_PARTUUID="${IMGID}-02" +#HOME_PARTUUID="${IMGID}-03" sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab" sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab" +#sed -i "s/HOMEDEV/PARTUUID=${HOME_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab" sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/firmware/cmdline.txt" diff --git a/export-image/05-finalise/01-run.sh b/export-image/05-finalise/01-run.sh index c59c23b..6121878 100755 --- a/export-image/05-finalise/01-run.sh +++ b/export-image/05-finalise/01-run.sh @@ -19,9 +19,9 @@ if [ -f "${ROOTFS_DIR}/etc/initramfs-tools/update-initramfs.conf" ]; then sed -i 's/^MODULES=.*/MODULES=dep/' "${ROOTFS_DIR}/etc/initramfs-tools/initramfs.conf" fi -if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then - chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" -fi +#if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then +# chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" +#fi rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static" diff --git a/export-image/mk-img.sh b/export-image/mk-img.sh index 6a5309a..796c77e 100755 --- a/export-image/mk-img.sh +++ b/export-image/mk-img.sh @@ -18,7 +18,7 @@ ALIGN="$((4 * 1024 * 1024))" # some overhead (since actual space usage is usually rounded up to the # filesystem block size) and gives some free space on the resulting # image. -ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)" +ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 400 * 1024 * 1024) / 1" | bc)" BOOT_PART_START=$((ALIGN)) BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN)) diff --git a/scripts/common b/scripts/common index fbc1d89..3dfb988 100644 --- a/scripts/common +++ b/scripts/common @@ -12,7 +12,6 @@ bootstrap(){ BOOTSTRAP_ARGS+=(--arch arm64) BOOTSTRAP_ARGS+=(--include gnupg) BOOTSTRAP_ARGS+=(--components "main,contrib,non-free") - #BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg") BOOTSTRAP_ARGS+=(--exclude=info,ifupdown) BOOTSTRAP_ARGS+=(--include=ca-certificates) BOOTSTRAP_ARGS+=("$@") diff --git a/stage0/00-configure-apt/00-run.sh b/stage0/00-configure-apt/00-run.sh index 2b8fe5a..6181fb6 100755 --- a/stage0/00-configure-apt/00-run.sh +++ b/stage0/00-configure-apt/00-run.sh @@ -1,12 +1,14 @@ #!/bin/bash -e +# Configure apt sources install -m 644 files/sources.list "${ROOTFS_DIR}/etc/apt/" install -m 644 files/raspi.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" -#install -m 644 files/oxmc.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" +install -m 644 files/oxmc.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list" sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.list" -#sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/oxmc.list" +sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/oxmc.list" +# Configure apt proxy if [ -n "$APT_PROXY" ]; then install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" sed "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -i -e "s|APT_PROXY|${APT_PROXY}|" @@ -14,10 +16,18 @@ else rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" fi +# Configure apt preferences +install -m 644 files/apt-chillcraftos-prefs "${ROOTFS_DIR}/etc/apt/preferences.d/" + +# Add raspberrypi-archive-keyring to apt cat files/raspberrypi.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" install -m 644 "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" -#cat files/oxmc.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/oxmc.gpg" -#install -m 644 "${STAGE_WORK_DIR}/oxmc.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" + +# Add oxmc-archive-keyring to apt +cat files/oxmc.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/oxmc.gpg" +install -m 644 "${STAGE_WORK_DIR}/oxmc.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" + +# Add armhf and arm64 architectures, update and upgrade and cache policy on_chroot <<- \EOF ARCH="$(dpkg --print-architecture)" if [ "$ARCH" = "armhf" ]; then @@ -27,4 +37,5 @@ on_chroot <<- \EOF fi apt-get update apt-get dist-upgrade -y + apt-cache policy EOF diff --git a/stage0/00-configure-apt/files/apt-chillcraftos-prefs b/stage0/00-configure-apt/files/apt-chillcraftos-prefs new file mode 100644 index 0000000..405beff --- /dev/null +++ b/stage0/00-configure-apt/files/apt-chillcraftos-prefs @@ -0,0 +1,3 @@ +Package: * +Pin: release o=cdn.oxmc.me/apt, n=bookworm +Pin-Priority: 1001 diff --git a/stage0/00-configure-apt/files/oxmc.list b/stage0/00-configure-apt/files/oxmc.list index f505c6b..ccb7a94 100644 --- a/stage0/00-configure-apt/files/oxmc.list +++ b/stage0/00-configure-apt/files/oxmc.list @@ -1,3 +1,3 @@ -deb http://apt.oxmc.me/ RELEASE main +deb https://cdn.oxmc.me/apt RELEASE main # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://apt.oxmc.me/ RELEASE main \ No newline at end of file +#deb-src https://cdn.oxmc.me/apt RELEASE main \ No newline at end of file diff --git a/stage0/files/raspberrypi.gpg b/stage0/files/raspberrypi.gpg deleted file mode 100644 index fe1d207..0000000 Binary files a/stage0/files/raspberrypi.gpg and /dev/null differ diff --git a/stage1/01-sys-tweaks/00-run.sh b/stage1/01-sys-tweaks/00-run.sh index dca0573..686161b 100755 --- a/stage1/01-sys-tweaks/00-run.sh +++ b/stage1/01-sys-tweaks/00-run.sh @@ -2,11 +2,16 @@ install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab" # SteamOS like readonly root -install -m 644 files/system-readonly "${ROOTFS_DIR}/sbin/" +install -m 755 files/system-readonly "${ROOTFS_DIR}/sbin/" on_chroot << EOF if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then - adduser --disabled-password --gecos "" ${FIRST_USER_NAME} + #adduser --disabled-password --gecos "" ${FIRST_USER_NAME} + if [ "${FIRST_USER_ISSYSTEM}" = "true" ]; then + useradd -r -M -d / ${FIRST_USER_NAME} + else + adduser --disabled-password --gecos "" ${FIRST_USER_NAME} + fi fi if [ -n "${FIRST_USER_PASS}" ]; then @@ -14,5 +19,3 @@ if [ -n "${FIRST_USER_PASS}" ]; then fi echo "root:root" | chpasswd EOF - - diff --git a/stage1/01-sys-tweaks/files/fstab b/stage1/01-sys-tweaks/files/fstab index 14aa0d2..c46cb56 100644 --- a/stage1/01-sys-tweaks/files/fstab +++ b/stage1/01-sys-tweaks/files/fstab @@ -1,5 +1,5 @@ -proc /proc proc defaults 0 0 +proc /proc proc defaults 0 0 BOOTDEV /boot/firmware vfat defaults 0 2 ROOTDEV / ext4 defaults,noatime 0 1 # For /home (always writable): -LABEL=home /home ext4 defaults 0 2 \ No newline at end of file +#LABEL=home /home ext4 defaults 0 2 \ No newline at end of file diff --git a/stage1/01-sys-tweaks/files/system-readonly b/stage1/01-sys-tweaks/files/system-readonly index 3ea6c22..d5d2fac 100644 --- a/stage1/01-sys-tweaks/files/system-readonly +++ b/stage1/01-sys-tweaks/files/system-readonly @@ -4,24 +4,24 @@ FSTAB_FILE="/etc/fstab" if [ "$1" == "enable" ]; then echo "Enabling read-only mode..." - + # Modify fstab to set root filesystem as read-only - sudo sed -i 's|\(ROOTDEV.* / .* ext4 \)defaults,noatime|\1ro,noatime|' "$FSTAB_FILE" - + sudo sed -i 's|\(PARTUUID=[^ ]* / .* ext4 \)defaults,noatime|\1ro,noatime|' "$FSTAB_FILE" + # Remount root as read-only sudo mount -o remount,ro / - + echo "System is now read-only. Reboot for changes to persist." elif [ "$1" == "disable" ]; then echo "Disabling read-only mode..." - + # Modify fstab to set root filesystem as writable - sudo sed -i 's|\(ROOTDEV.* / .* ext4 \)ro,noatime|\1defaults,noatime|' "$FSTAB_FILE" - + sudo sed -i 's|\(PARTUUID=[^ ]* / .* ext4 \)ro,noatime|\1defaults,noatime|' "$FSTAB_FILE" + # Remount root as writable sudo mount -o remount,rw / - + echo "System is now writable. Reboot for changes to persist." else diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages index fa876ca..adfbe8e 100644 --- a/stage3/00-install-packages/00-packages +++ b/stage3/00-install-packages/00-packages @@ -1,5 +1,5 @@ gstreamer1.0-x gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav -evince gtk2-engines alsa-utils +gtk2-engines alsa-utils desktop-base git gvfs @@ -9,7 +9,7 @@ gldriver-test fonts-droid-fallback fonts-liberation2 obconf -raindrop python3-pyqt5 python3-opengl vulkan-tools mesa-vulkan-drivers +libopengl0 \ No newline at end of file diff --git a/stage3/00-install-packages/00-packages-nr b/stage3/00-install-packages/00-packages-nr index ef17362..2980e65 100644 --- a/stage3/00-install-packages/00-packages-nr +++ b/stage3/00-install-packages/00-packages-nr @@ -1,8 +1,6 @@ xserver-xorg xinit -mousepad -eom menu-xdg yad zenity xdg-utils gvfs-backends gvfs-fuse -gdm3 gnome-themes-extra-data gnome-icon-theme +gdm3 gnome-themes-extra-data gnome-icon-theme papirus-icon-theme gnome-keyring diff --git a/stage3/01-install-desktop/00-packages b/stage3/01-install-desktop/00-packages index f71a8cf..436fc96 100644 --- a/stage3/01-install-desktop/00-packages +++ b/stage3/01-install-desktop/00-packages @@ -4,13 +4,11 @@ python3-pgzero python3-serial python3-pip python3-numpy -rc-gui tree libgl1-mesa-dri libgles1 libgles2-mesa xcompmgr -geany -piclone python3-twython pprompt ffmpeg vlc rpi-imager +plymouth os-release-snos hyfetch \ No newline at end of file diff --git a/stage3/01-install-desktop/00-packages-nr b/stage3/01-install-desktop/00-packages-nr index 2a8d122..5b08f7d 100644 --- a/stage3/01-install-desktop/00-packages-nr +++ b/stage3/01-install-desktop/00-packages-nr @@ -1,2 +1 @@ -pi-package -gnome-core gnome-tweaks gnome-shell-extension-no-annoyance gnome-shell-extension-manager gnome-shell-extension-gsconnect gnome-shell-extension-dash-to-panel gnome-shell-extension-bluetooth-quick-connect gnome-shell-extension-appindicator gnome-initial-setup \ No newline at end of file +gnome-session gnome-shell libpam-gnome-keyring gnome-control-center gnome-software network-manager-gnome pulseaudio gnome-terminal gnome-initial-setup gnome-tweaks gnome-shell-extension-no-annoyance gnome-shell-extension-manager gnome-shell-extension-gsconnect gnome-shell-extension-dash-to-panel gnome-shell-extension-bluetooth-quick-connect gnome-shell-extension-appindicator gnome-shell-extension-desktop-icons-ng \ No newline at end of file diff --git a/stage3/02-extras/00-run.sh b/stage3/02-extras/00-run.sh deleted file mode 100755 index 46975d0..0000000 --- a/stage3/02-extras/00-run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -e - -#polkit fixes -install -m 644 files/polkit-admin.conf "${ROOTFS_DIR}/etc/polkit-1/localauthority.conf.d/51-admin.conf" \ No newline at end of file diff --git a/stage3/05-setup/00-run.sh b/stage3/02-setup/00-run.sh similarity index 66% rename from stage3/05-setup/00-run.sh rename to stage3/02-setup/00-run.sh index a3b067f..6593244 100755 --- a/stage3/05-setup/00-run.sh +++ b/stage3/02-setup/00-run.sh @@ -9,9 +9,4 @@ on_chroot << EOF sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/daemon.conf mkdir -p /var/lib/gdm touch /var/lib/gdm/run-initial-setup -EOF - -# Remove setup user (chill) [This allows for the user to be created in the first boot from the gnome-initial-setup] -on_chroot << EOF -deluser --remove-home --remove-all-files ${FIRST_USER_NAME} EOF \ No newline at end of file diff --git a/stage3/02-setup/files/vendor.conf b/stage3/02-setup/files/vendor.conf new file mode 100644 index 0000000..9637c8e --- /dev/null +++ b/stage3/02-setup/files/vendor.conf @@ -0,0 +1,5 @@ +[pages] +# Pages to show when a user already exists +existing_user_only=language;keyboard;timezone;goa; +# Only show the following pages in a 'first boot' situation +new_user_only=welcome;language;keyboard;timezone;account;network;privacy;goa; \ No newline at end of file diff --git a/stage3/04-enable-xcompmgr/00-run.sh b/stage3/04-enable-xcompmgr/00-run.sh deleted file mode 100755 index ad6298d..0000000 --- a/stage3/04-enable-xcompmgr/00-run.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -e - -on_chroot << EOF - raspi-config nonint do_xcompmgr 0 -EOF diff --git a/stage3/02-extras/00-packages b/stage3/04-extras-fixes/00-packages similarity index 100% rename from stage3/02-extras/00-packages rename to stage3/04-extras-fixes/00-packages diff --git a/stage3/04-extras-fixes/00-run.sh b/stage3/04-extras-fixes/00-run.sh new file mode 100755 index 0000000..fdce4d0 --- /dev/null +++ b/stage3/04-extras-fixes/00-run.sh @@ -0,0 +1,47 @@ +#!/bin/bash -e + +# Enable xcompmgr +on_chroot << EOF + raspi-config nonint do_xcompmgr 0 +EOF + +# polkit fixes +install -m 644 files/polkit-admin.conf "${ROOTFS_DIR}/etc/polkit-1/localauthority.conf.d/51-admin.conf" + +# Set default gnome-extensions +on_chroot << EOF +# Create the necessary directories for dconf settings and profiles +mkdir -p /etc/dconf/db/local.d +mkdir -p /etc/dconf/profile + +# Create the user profile to link user-db:user and system-db:local +echo "user-db:user" > /etc/dconf/profile/user +echo "system-db:local" >> /etc/dconf/profile/user +EOF +install -m 755 files/gnome-extensions "${ROOTFS_DIR}/etc/dconf/db/local.d/00-extensions" + +# Set default Wallpaper +on_chroot << EOF +# Create the necessary directories for the wallpaper +mkdir -p /usr/local/share/backgrounds +EOF +install -m 644 files/loveimage.png "${ROOTFS_DIR}/usr/local/share/backgrounds/loveimage.png" +install -m 644 files/gnome-background "${ROOTFS_DIR}/etc/dconf/db/local.d/00-background" + +# Run the dconf update as the first user +on_chroot << EOF +SUDO_USER="${FIRST_USER_NAME}" dconf update +EOF + +# Pi-Apps (this is a bash script that installs pi-apps when the user runs it, then gets overwritten by the actual pi-apps) +install -m 755 files/pi-apps "${ROOTFS_DIR}/usr/bin/pi-apps" +install -m 755 files/pi-apps.desktop "${ROOTFS_DIR}/usr/share/applications/pi-apps.desktop" +install -m 644 files/pi-apps-logo.png "${ROOTFS_DIR}/usr/share/icons/hicolor/256x256/apps/pi-apps.png" + +# Remove setup user (only if it's not a system account) +on_chroot << EOF +#deluser --remove-home --remove-all-files ${FIRST_USER_NAME} +if [ "${FIRST_USER_ISSYSTEM}" = "false" ]; then + deluser --remove-home --remove-all-files ${FIRST_USER_NAME} +fi +EOF \ No newline at end of file diff --git a/stage3/04-extras-fixes/files/gnome-background b/stage3/04-extras-fixes/files/gnome-background new file mode 100644 index 0000000..060b976 --- /dev/null +++ b/stage3/04-extras-fixes/files/gnome-background @@ -0,0 +1,5 @@ +[org/gnome/desktop/background] +picture-uri='file:///usr/local/share/backgrounds/loveimage.png' +picture-options='spanned' +primary-color='000000' +secondary-color='FFFFFF' \ No newline at end of file diff --git a/stage3/04-extras-fixes/files/gnome-extensions b/stage3/04-extras-fixes/files/gnome-extensions new file mode 100644 index 0000000..5478c37 --- /dev/null +++ b/stage3/04-extras-fixes/files/gnome-extensions @@ -0,0 +1,2 @@ +[org/gnome/shell] +enabled-extensions=['dash-to-panel@jderose9.github.com', 'ding@rastersoft.com', 'noannoyance@daase.net', 'ubuntu-appindicators@ubuntu.com', 'user-themes@gnome-shell-extensions.gcampax.github.com'] \ No newline at end of file diff --git a/stage3/04-extras-fixes/files/loveimage.png b/stage3/04-extras-fixes/files/loveimage.png new file mode 100644 index 0000000..1c85ca6 Binary files /dev/null and b/stage3/04-extras-fixes/files/loveimage.png differ diff --git a/stage3/04-extras-fixes/files/pi-apps b/stage3/04-extras-fixes/files/pi-apps new file mode 100644 index 0000000..2d84139 --- /dev/null +++ b/stage3/04-extras-fixes/files/pi-apps @@ -0,0 +1,194 @@ +#!/bin/bash + +# Check if ~/pi-apps or /usr/local/bin/pi-apps exists +if [ -d ~/pi-apps ] || [ -f /usr/local/bin/pi-apps ]; then + # Run the users pi-apps instead of installing it + /usr/local/bin/pi-apps + exit 0 +fi + +function error { + echo -e "\e[91m$1\e[39m" + exit 1 +} + +cd "$HOME" + +#ensure non-root +if [[ "$(id -u)" == 0 ]]; then + error "Pi-Apps is not designed to be installed as root! Please try again as a regular user." +fi + +#ensure debian +command -v apt >/dev/null || error "apt: command not found. Most likely this system is not running Debian." + +#Ensure running arm processor +if uname -m | grep -qi 'x86\|i686\|i386' ;then + error "Pi-Apps is not supported on non-ARM CPU architectures. We encourage you to use your distro's app store, like Gnome Software or Discover Software Center." +fi + +sudo apt update || error "The command 'sudo apt update' failed. Before Pi-Apps will work, you must fix your apt package-management system." + +#install dependencies +dependencies='yad curl wget aria2 lsb-release software-properties-common apt-utils apt-transport-https gnupg imagemagick bc librsvg2-bin locales shellcheck git wmctrl xdotool x11-utils rsync unzip debsums libgtk3-perl bzip2' + +if ! dpkg -s $dependencies &>/dev/null ;then + sudo apt install $dependencies -y -f --no-install-recommends || error "Pi-Apps dependencies failed to install and so the Pi-Apps install has been aborted. Before Pi-Apps can be installed you must solve any errors above." +fi + +#remove annoying "YAD icon browser" launcher +sudo rm -f /usr/share/applications/yad-icon-browser.desktop + +#download pi-apps if folder missing +DIRECTORY="$(readlink -f "$(dirname "$0")")" +if [ -z "$DIRECTORY" ] || [ "$DIRECTORY" == "$HOME" ] || [ "$DIRECTORY" == bash ] || [ ! -f "${DIRECTORY}/api" ] || [ ! -f "${DIRECTORY}/gui" ];then + DIRECTORY="$HOME/pi-apps" +fi +downloaded=0 #track if pi-apps was downloaded this time + +#Re-download pi-apps folder in all cases if pi-apps already exists +#users expect to use the install script to "restore" a working pi-apps install in incase their local version is somehow not working or corrupted +if [ -d "$DIRECTORY" ];then + rm -rf ~/pi-apps-forced-update + + echo "Reinstalling Pi-Apps..." + downloaded=1 + output="$(git clone --depth 1 https://github.com/Botspot/pi-apps ~/pi-apps-forced-update 2>&1)" + if [ $? != 0 ] || [ ! -d "$DIRECTORY" ];then + error "Pi-Apps download failed!\ngit clone output was: $output" + fi + cp -af "${DIRECTORY}/data" ~/pi-apps-forced-update + cp -af "${DIRECTORY}/apps" ~/pi-apps-forced-update + rm -rf "$DIRECTORY" + mv -f ~/pi-apps-forced-update "$DIRECTORY" + +#if pi-apps folder does not exist, download it +elif [ ! -d "$DIRECTORY" ];then + echo "Downloading Pi-Apps..." + downloaded=1 + output="$(git clone --depth 1 https://github.com/Botspot/pi-apps "$DIRECTORY" 2>&1)" + if [ $? != 0 ] || [ ! -d "$DIRECTORY" ];then + error "Pi-Apps download failed!\ngit clone output was: $output" + fi + #click new installation analytics link + "${DIRECTORY}/api" shlink_link script install +fi + +#Past this point, DIRECTORY variable populated with valid pi-apps directory + +#if ChromeOS, install lxterminal +if command -v garcon-terminal-handler >/dev/null ;then + echo "In order to install apps on ChromeOS, a working terminal emulator is required. +Installing lxterminal in 10 seconds... (press Ctrl+C to cancel)" + sleep 10 + sudo apt install -yf lxterminal || error "Failed to install lxterminal on ChromeOS!" +fi + +#menu button +if [ ! -f ~/.local/share/applications/pi-apps.desktop ];then + echo "Creating menu button..." +fi +mkdir -p ~/.local/share/applications +if [ -f /etc/xdg/menus/lxde-pi-applications.menu ];then #If on PiOS, place launcher in Accessories as it has always been there and is more intuitive there +echo "[Desktop Entry] +Name=Pi-Apps +Comment=Raspberry Pi App Store for open source projects +Exec=${DIRECTORY}/gui +Icon=${DIRECTORY}/icons/logo.png +Terminal=false +StartupWMClass=Pi-Apps +Type=Application +Categories=Utility +StartupNotify=true" > ~/.local/share/applications/pi-apps.desktop +else #if not on PiOS, place launcher in Preferences to match the wider decision of putting app installers there (see PR #2388) +echo "[Desktop Entry] +Name=Pi-Apps +Comment=Raspberry Pi App Store for open source projects +Exec=${DIRECTORY}/gui +Icon=${DIRECTORY}/icons/logo.png +Terminal=false +StartupWMClass=Pi-Apps +Type=Application +Categories=Utility;System;PackageManager; +StartupNotify=true" > ~/.local/share/applications/pi-apps.desktop +fi +chmod 755 ~/.local/share/applications/pi-apps.desktop +gio set ~/.local/share/applications/pi-apps.desktop "metadata::trusted" yes + +#copy menu button to Desktop +mkdir -p ~/Desktop +cp -f ~/.local/share/applications/pi-apps.desktop ~/Desktop/ + +chmod 755 ~/Desktop/pi-apps.desktop +gio set ~/Desktop/pi-apps.desktop "metadata::trusted" yes + +#copy icon to local icons directory (necessary on some wayland DEs like on PiOS Wayfire) +mkdir -p ~/.local/share/icons +cp -f ${DIRECTORY}/icons/logo.png ~/.local/share/icons/pi-apps.png +cp -f ${DIRECTORY}/icons/settings.png ~/.local/share/icons/pi-apps-settings.png + +#settings menu button +if [ ! -f ~/.local/share/applications/pi-apps-settings.desktop ];then + echo "Creating Settings menu button..." +fi +echo "[Desktop Entry] +Name=Pi-Apps Settings +Comment=Configure Pi-Apps or create an App +Exec=${DIRECTORY}/settings +Icon=${DIRECTORY}/icons/settings.png +Terminal=false +StartupWMClass=Pi-Apps-Settings +Type=Application +Categories=Settings; +StartupNotify=true" > ~/.local/share/applications/pi-apps-settings.desktop + +if [ ! -f ~/.config/autostart/pi-apps-updater.desktop ];then + echo "Creating autostarted updater..." +fi +mkdir -p ~/.config/autostart +echo "[Desktop Entry] +Name=Pi-Apps Updater +Exec=${DIRECTORY}/updater onboot +Icon=${DIRECTORY}/icons/logo.png +Terminal=false +StartupWMClass=Pi-Apps +Type=Application +X-GNOME-Autostart-enabled=true +Hidden=false +NoDisplay=false" > ~/.config/autostart/pi-apps-updater.desktop + +mkdir -p "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status" \ + "${DIRECTORY}/data/preload" "${DIRECTORY}/data/settings" \ + "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status" \ + "${DIRECTORY}/data/categories" + +#pi-apps terminal command +if [ ! -f /usr/local/bin/pi-apps ] || ! cat /usr/local/bin/pi-apps | grep -q "${DIRECTORY}/gui" ;then + echo "#!/bin/bash +${DIRECTORY}/gui"' "$@"' | sudo tee /usr/local/bin/pi-apps >/dev/null + sudo chmod +x /usr/local/bin/pi-apps +fi + +#check if system is broken +errors="$("${DIRECTORY}/api" is_supported_system)" || error "$errors" + +#preload app list +if [ ! -f "$DIRECTORY/data/preload/LIST-" ];then + echo "Preloading app list..." +fi +"${DIRECTORY}/preload" yad &>/dev/null + +#Run runonce entries +"${DIRECTORY}/etc/runonce-entries" &>/dev/null + +#Determine message of the day. If announcements file missing or over a day old, download it. +if [ ! -f "${DIRECTORY}/data/announcements" ] || [ ! -z "$(find "${DIRECTORY}/data/announcements" -mtime +1 -print)" ]; then + wget https://raw.githubusercontent.com/Botspot/pi-apps-announcements/main/message -qO "${DIRECTORY}/data/announcements" +fi + +if [ $downloaded == 1 ];then + echo "Installation complete. Pi-Apps can be launched from the start menu or by running the command 'pi-apps'." + echo "Further explanation for how to use Pi-Apps can be found on our getting started webpage: https://pi-apps.io/wiki/getting-started/running-pi-apps/" +else + echo -e "Please note that Pi-Apps has NOT been freshly downloaded, because $DIRECTORY already exists." +fi diff --git a/stage3/04-extras-fixes/files/pi-apps-logo.png b/stage3/04-extras-fixes/files/pi-apps-logo.png new file mode 100644 index 0000000..962f142 Binary files /dev/null and b/stage3/04-extras-fixes/files/pi-apps-logo.png differ diff --git a/stage3/04-extras-fixes/files/pi-apps.desktop b/stage3/04-extras-fixes/files/pi-apps.desktop new file mode 100644 index 0000000..996f6b0 --- /dev/null +++ b/stage3/04-extras-fixes/files/pi-apps.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Pi-Apps +Comment=Raspberry Pi App Store for open source projects +Exec=/usr/bin/pi-apps +Icon=/usr/share/icons/hicolor/256x256/apps/pi-apps.png +Terminal=false +StartupWMClass=Pi-Apps +Type=Application +Categories=Utility;System;PackageManager; +StartupNotify=true \ No newline at end of file diff --git a/stage3/02-extras/files/polkit-admin.conf b/stage3/04-extras-fixes/files/polkit-admin.conf similarity index 100% rename from stage3/02-extras/files/polkit-admin.conf rename to stage3/04-extras-fixes/files/polkit-admin.conf diff --git a/stage3/05-print-support/00-packages b/stage3/05-print-support/00-packages deleted file mode 100644 index e9c36bd..0000000 --- a/stage3/05-print-support/00-packages +++ /dev/null @@ -1,2 +0,0 @@ -cups -system-config-printer diff --git a/stage3/05-print-support/01-run.sh b/stage3/05-print-support/01-run.sh deleted file mode 100755 index dc9e2b2..0000000 --- a/stage3/05-print-support/01-run.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -e - -on_chroot <