1
0

- Rewrite aeon-firstboot to be multi-threaded and install locales

(boo#1224328, boo#1213055, boo#1208869, boo#1217466, boo#1223608)

OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/gnome-branding-Aeon?expand=0&rev=16
This commit is contained in:
Richard Brown 2024-05-23 12:55:59 +00:00 committed by Git OBS Bridge
parent f11a992f6d
commit c9d972f25b
3 changed files with 138 additions and 54 deletions

View File

@ -1,60 +1,138 @@
#!/bin/sh #!/bin/bash
(
echo "# Waiting for Internet connection"
until /usr/bin/curl -s --max-time 5 https://flathub.org > /dev/null; do sleep 1; done
echo "10"
echo "# Adding Flathub Repository" # SPDX-License-Identifier: MIT
/usr/bin/flatpak remote-add --user --if-not-exists flathub /usr/share/aeon/flathub.flatpakrepo # SPDX-FileCopyrightText: Copyright 2024 SUSE LLC
if [ "$?" != 0 ] ; then # SPDX-FileCopyrightText: Copyright 2024 Richard Brown
zenity --error \ # SPDX-FileCopyrightText: Copyright 2024 Raymond Yip
--text="Adding Flathub Repo Failed"
exit 1
fi
echo "20"
echo "# Installing Firefox" installFlatpakRepo(){
/usr/bin/flatpak install --user --noninteractive flathub org.mozilla.firefox /usr/bin/flatpak remote-add --user --if-not-exists flathub /usr/share/aeon/flathub.flatpakrepo
if [ "$?" != 0 ] ; then if [ "$?" != 0 ] ; then
zenity --error \ zenity --error \
--text="Installing Firefox Failed" --text="Adding Flathub Repo Failed"
exit 1 exit 1
fi fi
}
echo "40" installFlatpakPackage(){
echo "# Installing Calculator" /usr/bin/flatpak install --user --noninteractive flathub $1
/usr/bin/flatpak install --user --noninteractive flathub org.gnome.Calculator if [ "$?" != 0 ] ; then
if [ "$?" != 0 ] ; then zenity --error \
zenity --error \ --text="Installing $1 Failed"
--text="Installing Calculator Failed" exit 1
exit 1 fi
fi }
echo "60" defaultOptions() {
echo "# Installing Text Editor" pkgs=("org.mozilla.firefox" "org.gnome.Calculator" "org.gnome.TextEditor")
/usr/bin/flatpak install --user --noninteractive flathub org.gnome.TextEditor }
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Text Editor Failed"
exit 1
fi
echo "80" customizeOptions() {
echo "# Installing Extension Manager" #User has decided to customize their installed flatpaks
/usr/bin/flatpak install --user --noninteractive flathub com.mattjakeman.ExtensionManager selection=$(zenity --list --width=1000 --height=1025 --title="Choose software to install" \
if [ "$?" != 0 ] ; then --text="Select which software you would like to install\nMore software can be found in the <b>Software</b> App" \
zenity --error \ --checklist --column="" --column="AppName" --column="Application" --column="Description" \
--text="Installing Extension Manager Failed" --hide-column=2 \
exit 1 TRUE org.mozilla.firefox "Mozilla Firefox" "Default Web Browser" \
fi TRUE org.gnome.Calculator "Calculator" "Basic Calculator" \
TRUE org.gnome.TextEditor "Text Editor" "Basic Text Editor" \
FALSE com.mattjakeman.ExtensionManager "Extension Manager" "Shell Extensions Manager" \
FALSE com.github.tchx84.Flatseal "Flatseal" "Application Permissions Manager" \
FALSE com.valvesoftware.Steam "Steam" "Steam Games Launcher" \
FALSE org.gnome.Loupe "Image Viewer" "Basic Image Viewer" \
FALSE org.gnome.gThumb "gThumb" "Advanced Image Viewer" \
FALSE io.github.celluloid_player.Celluloid "Celluloid" "Basic Video Player" \
FALSE org.videolan.VLC "VLC" "Advanced Video Player" \
FALSE org.mozilla.Thunderbird "Thunderbird" "Mail Client" \
FALSE org.telegram.desktop "Telegram Desktop" "Telegram Messaging Client" \
FALSE org.libreoffice.LibreOffice "LibreOffice" "LibreOffice Office Suite" \
FALSE org.gimp.GIMP "GNU Image Manipulation Program" "Image Editor" \
FALSE org.gnome.Builder "Builder" "Graphical IDE" \
FALSE io.github.dvlv.boxbuddyrs "BoxBuddy" "Distrobox Container Manager" \
FALSE org.gnome.Boxes "Boxes" "Virtualisation" \
FALSE org.gnome.World.PikaBackup "Pika Backup" "Basic Backup Tool" \
FALSE org.gnome.SimpleScan "Document Scanner" "Basic Document Scanner" \
)
#the above command outputs pipe-delimeted lists of all the flathub app names people chose..eg
#org.mozilla.firefox|org.gnome.Calculator|org.gnome.TextEditor|com.github.tchx84.Flatseal|com.valvesoftware.Steam|org.telegram.desktop
#So that could be parsed to figure out the number of apps chosen and fed into flatpak —user —noninteractive flathub and allow people to pick what they install on first boot
if [[ -z "${selection}" ]]; then
#if cancel is pressed, $custom variable is empty so we go back to use the default options
defaultOptions
else
IFS='|' read -a pkgs <<< "$selection"
fi
}
echo "100" firstMSG() {
echo "# Cleaning up" #Insert Welcome message here
rm ~/.config/autostart/aeon-firstboot.desktop zenity --question --icon=distributor-logo-Aeon-symbolic --no-wrap --title 'Welcome to openSUSE Aeon' \
) | --text 'Almost done, there is one last step\n\nWe need to download some applications to get you started\n\nYou can add more software later using the <b>Software</b> App' \
zenity --progress --title="Aeon Firstboot" --percentage=0 --auto-close --no-cancel --width=300 --width 300 --height 300 \
--ok-label OK \
--cancel-label Customise
option=$?
if [ "$option" != 0 ]; then
#User wants to customize software
customizeOptions
else
#OK Button selected, running with defaults
defaultOptions
fi
}
if [ "$?" != 0 ] ; then lastMSG() {
zenity --error \ #Insert Welcome message here
--text="Firstboot Configuration Error" zenity --info --icon=distributor-logo-Aeon-symbolic --no-wrap --title 'Welcome to openSUSE Aeon' \
fi --text 'Congratulations!\n\nYour system is ready to be used\n\nWe hope you enjoy using <b>openSUSE Aeon</b>' \
--width 300 --height 300
}
detectLocale() {
if [[ ! "${LANG}" =~ ^en_ ]]; then
need_locale=${LANG}
fi
}
show_progress() {
(
echo "# Waiting for Internet connection"
until /usr/bin/curl -s --max-time 5 https://flathub.org > /dev/null; do sleep 1; done
while /usr/bin/pgrep -f '/usr/bin/flatpak|/usr/sbin/transactional-update|/usr/bin/pkexec' >/dev/null; do
echo "# Installing Packages"
sleep 1
done
)| zenity --progress --title="Final Setup" --width=300 --pulsate --auto-close --no-cancel
}
install_locale() {
pkexec sh -c "/usr/sbin/transactional-update -n run zypper aloc ${need_locale} && /usr/sbin/transactional-update -n apply"
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Locales Failed"
exit 1
fi
for i in "$HOME/Desktop" "$HOME/Downloads" "$HOME/Templates" "$HOME/Public" "$HOME/Documents" "$HOME/Music" "$HOME/Pictures" "$HOME/Videos"
do
rmdir $i
done
xdg-user-dirs-update --force
}
run_tasks() {
until /usr/bin/curl -s --max-time 5 https://flathub.org > /dev/null; do sleep 1; done
if [[ -n "${need_locale}" ]]; then
install_locale &
fi
installFlatpakRepo
for pkg in "${pkgs[@]}"; do
installFlatpakPackage $pkg &
done
}
detectLocale
firstMSG
run_tasks &
show_progress
lastMSG

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu May 23 12:53:48 UTC 2024 - Richard Brown <rbrown@suse.com>
- Rewrite aeon-firstboot to be multi-threaded and install locales
(boo#1224328, boo#1213055, boo#1208869, boo#1217466, boo#1223608)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Dec 28 14:52:59 UTC 2023 - dopice <0xdopice@protonmail.com> Thu Dec 28 14:52:59 UTC 2023 - dopice <0xdopice@protonmail.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package gnome-branding-Aeon # spec file for package gnome-branding-Aeon
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2024 SUSE LLC
# Copyright (c) 2021 SUSE Software Solutions GmbH # Copyright (c) 2021 SUSE Software Solutions GmbH
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties