From 9b0d4c43947432a45af03e50bf73aa85d05a7428 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Sun, 15 Oct 2023 17:09:32 -0500 Subject: [PATCH] Completely finish the backend for pkgselect --- common/modules/pkgselect/pkgselect.qml | 15 -------- common/snap_install | 40 +++++++++++++++++++++ debian/rules | 2 ++ lubuntu/modules/packages.conf | 2 +- lubuntu/modules/pkgselect_context.conf | 13 +++++++ lubuntu/modules/pkgselect_snap_context.conf | 7 ++++ lubuntu/settings.conf | 9 ++++- 7 files changed, 71 insertions(+), 17 deletions(-) create mode 100755 common/snap_install create mode 100644 lubuntu/modules/pkgselect_context.conf create mode 100644 lubuntu/modules/pkgselect_snap_context.conf diff --git a/common/modules/pkgselect/pkgselect.qml b/common/modules/pkgselect/pkgselect.qml index 3cdc920..981e259 100644 --- a/common/modules/pkgselect/pkgselect.qml +++ b/common/modules/pkgselect/pkgselect.qml @@ -142,21 +142,6 @@ Item { font.italic: true font.pointSize: 10 } - CheckBox { - text: qsTr("VSCodium") - objectName: "vscodium" - font.pointSize: 11 - indicator.width: 18 - indicator.height: 18 - onClicked: { - updatePackageSelections(objectName, checked); - } - } - Text { - text: qsTr("Code editor redefined and optimized for building and debugging modern web and cloud applications") - font.italic: true - font.pointSize: 10 - } CheckBox { text: qsTr("Virtual Machine Manager") objectName: "virt-manager" diff --git a/common/snap_install b/common/snap_install new file mode 100755 index 0000000..2cd8e18 --- /dev/null +++ b/common/snap_install @@ -0,0 +1,40 @@ +#!/bin/bash + +chroot_root="$1" +shift +new_snaps=("$@") +seed_dir="$chroot_root/var/lib/snapd/seed" +snaps_dir="$seed_dir/snaps" +assertions_dir="$seed_dir/assertions" +seed_yaml="$seed_dir/seed.yaml" + +# Loop through each snap and download it, then update seed.yaml +for snap_info in "${new_snaps[@]}"; do + snap_name=${snap_info%=*} + channel=${snap_info#*=} + + # Download + snap download --channel="$channel" "$snap_name" --target-directory="$snaps_dir" + + sleep 5 + + # Get revision number + snap_file=$(ls "$snaps_dir" | grep ".snap" | grep "^${snap_name}_") + rev_num=$(echo "$snap_file" | grep -oP '(?<=_)\d+') + + # Move assertions + mv "$snaps_dir/${snap_name}_${rev_num}.assert" "$assertions_dir" + + # Append to seed.yaml + { + echo " - name: $snap_name" + echo " file: $snap_file" + echo " channel: $channel" + } >> "$seed_yaml" +done + +# Remove state.json if exists +[ -f "$chroot_root/var/lib/snapd/state.json" ] && rm "$chroot_root/var/lib/snapd/state.json" + +# Validate +snap debug validate-seed "$seed_yaml" diff --git a/debian/rules b/debian/rules index 4fe3746..1012151 100755 --- a/debian/rules +++ b/debian/rules @@ -27,3 +27,5 @@ override_dh_missing: chmod -R 755 debian/calamares-settings-ubuntu-common/usr/lib/ chmod 644 $(MODULES_DIR)/automirror/automirror.conf chmod 644 $(MODULES_DIR)/automirror/module.desc + mkdir -pv debian/calamares-settings-ubuntu-common/usr/bin/ + cp -v common/snap_install debian/calamares-settings-ubuntu-common/usr/bin/calamares_snap_install diff --git a/lubuntu/modules/packages.conf b/lubuntu/modules/packages.conf index 7c670de..9c8c808 100644 --- a/lubuntu/modules/packages.conf +++ b/lubuntu/modules/packages.conf @@ -1,4 +1,4 @@ -update_db: false +update_db: true backend: apt operations: - remove: diff --git a/lubuntu/modules/pkgselect_context.conf b/lubuntu/modules/pkgselect_context.conf new file mode 100644 index 0000000..476ab1d --- /dev/null +++ b/lubuntu/modules/pkgselect_context.conf @@ -0,0 +1,13 @@ +--- +dontChroot: false +timeout: 300 +"packages.minimalInstall": + true: + - "apt-get -y --purge remove snapd vlc plasma-discover muon transmission-qt quassel 2048-qt featherpad noblenote kcalc qps zsync partitionmanager qapt-deb-installer picom qlipper qtpass libreoffice*" + - "apt-get -y autoremove" +"packages.updateNow": + true: "apt-get -y full-upgrade" +"packages.virt-manager": + true: "apt-get -y install virt-manager" +"packages.thunderbird": + true: "apt-get -y install thunderbird" diff --git a/lubuntu/modules/pkgselect_snap_context.conf b/lubuntu/modules/pkgselect_snap_context.conf new file mode 100644 index 0000000..2b0a156 --- /dev/null +++ b/lubuntu/modules/pkgselect_snap_context.conf @@ -0,0 +1,7 @@ +--- +dontChroot: true +timeout: 600 +"packages.element": + true: "calamares_snap_install ${ROOT} element-desktop=stable" +"packages.krita": + true: "calamares_snap_install ${ROOT} krita=stable kf5-5-108-qt-5-15-10-core22=stable" diff --git a/lubuntu/settings.conf b/lubuntu/settings.conf index b58554b..cd22992 100644 --- a/lubuntu/settings.conf +++ b/lubuntu/settings.conf @@ -20,6 +20,12 @@ instances: - id: add386arch module: shellprocess config: shellprocess_add386arch.conf +- id: pkgselect_action + module: contextualprocess + config: pkgselect_context.conf +- id: pkgselect_snap_action + module: contextualprocess + config: pkgselect_snap_context.conf sequence: - show: @@ -54,8 +60,9 @@ sequence: - contextualprocess@after_bootloader - automirror - shellprocess@add386arch - - pkgselect - packages + - contextualprocess@pkgselect_action + - contextualprocess@pkgselect_snap_action - shellprocess@logs - umount - show: