From a16485f28a56a0934449dc9a1ce98eaa70b062b9 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Fri, 4 Oct 2024 20:29:43 +0300 Subject: [PATCH] Add make script --- Makefile | 27 ++++-- ...b.pikaos-linux.pikmanupdatemanager.desktop | 9 ++ ...ithub.pikaos-linux.pikmanupdatemanager.svg | 17 ++++ data/flatpak-installer | 2 + data/flatpak-installer.desktop | 13 +++ ...nux.pikmanupdatemanager.modify.repo.policy | 19 ++++ ....pikmanupdatemanager.update.manager.policy | 19 ++++ ...pikmanupdatemanager.upgrade.manager.policy | 19 ++++ data/software-properties-gtk | 2 + data/software-properties-gtk.desktop | 43 +++++++++ just_in_case/__main__.py | 91 ------------------- src/bin/gui/build_ui/mod.rs | 7 +- 12 files changed, 167 insertions(+), 101 deletions(-) create mode 100644 data/com.github.pikaos-linux.pikmanupdatemanager.desktop create mode 100644 data/com.github.pikaos-linux.pikmanupdatemanager.svg create mode 100644 data/flatpak-installer create mode 100644 data/flatpak-installer.desktop create mode 100644 data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.modify.repo.policy create mode 100644 data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.update.manager.policy create mode 100644 data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.upgrade.manager.policy create mode 100644 data/software-properties-gtk create mode 100644 data/software-properties-gtk.desktop delete mode 100755 just_in_case/__main__.py diff --git a/Makefile b/Makefile index feb3530..edc511f 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,19 @@ install: mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/ mkdir -p $(DESTDIR)/usr/share/applications mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps - cp -vf target/release/pikman-update-manager $(DESTDIR)/usr/bin/ - cp -vf target/release/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ - cp -vf target/release/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ - cp -vf data/wget.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ + cp -vf target/debug/pikman-update-manager $(DESTDIR)/usr/bin/ + cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/ + cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/ + cp -vf target/debug/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ + cp -vf target/debug/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/ - #cp -vf data/com.github.pikaos-linux.pikagnomelayouts.desktop $(DESTDIR)/usr/share/applications/ - #cp -vfr data/polkit-1 $(DESTDIR)/usr/share/ - chmod 755 $(DESTDIR)/usr/bin/pika/pikman-update-manager + cp -vf data/com.github.pikaos-linux.pikmanupdatemanager.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/ + cp -vf data/*.desktop $(DESTDIR)/usr/share/applications/ + cp -vfr data/polkit-1 $(DESTDIR)/usr/share/ + chmod 755 $(DESTDIR)/usr/bin/pikman-update-manager + chmod 755 $(DESTDIR)/usr/bin/flatpak-installer + chmod 755 $(DESTDIR)/usr/bin/software-properties-gtk chmod 755 $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/* install_no_build_debug: @@ -29,11 +33,16 @@ install_no_build_debug: mkdir -p $(DESTDIR)/usr/share/applications mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps cp -vf target/debug/pikman-update-manager $(DESTDIR)/usr/bin/ + cp -vf data/flatpak-installer $(DESTDIR)/usr/bin/ + cp -vf data/software-properties-gtk $(DESTDIR)/usr/bin/ cp -vf target/debug/apt_update $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ cp -vf target/debug/apt_full_upgrade $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ cp -vf data/modify_repo.sh $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/ cp -vf data/*.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/ - #cp -vf data/com.github.pikaos-linux.pikagnomelayouts.desktop $(DESTDIR)/usr/share/applications/ - #cp -vfr data/polkit-1 $(DESTDIR)/usr/share/ + cp -vf data/com.github.pikaos-linux.pikmanupdatemanager.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/ + cp -vf data/*.desktop $(DESTDIR)/usr/share/applications/ + cp -vfr data/polkit-1 $(DESTDIR)/usr/share/ chmod 755 $(DESTDIR)/usr/bin/pikman-update-manager + chmod 755 $(DESTDIR)/usr/bin/flatpak-installer + chmod 755 $(DESTDIR)/usr/bin/software-properties-gtk chmod 755 $(DESTDIR)/usr/lib/pika/pikman-update-manager/scripts/* \ No newline at end of file diff --git a/data/com.github.pikaos-linux.pikmanupdatemanager.desktop b/data/com.github.pikaos-linux.pikmanupdatemanager.desktop new file mode 100644 index 0000000..4e13f34 --- /dev/null +++ b/data/com.github.pikaos-linux.pikmanupdatemanager.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Pikman Update Manager +Exec=pikman-update-manager +Icon=com.github.pikaos-linux.pikmanupdatemanager +Terminal=false +Type=Application +Encoding=UTF-8 +Categories=GNOME;GTK;Settings;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;X-Unity-Settings-Panel; +StartupNotify=true diff --git a/data/com.github.pikaos-linux.pikmanupdatemanager.svg b/data/com.github.pikaos-linux.pikmanupdatemanager.svg new file mode 100644 index 0000000..2c8e9fd --- /dev/null +++ b/data/com.github.pikaos-linux.pikmanupdatemanager.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/data/flatpak-installer b/data/flatpak-installer new file mode 100644 index 0000000..f8e8d5b --- /dev/null +++ b/data/flatpak-installer @@ -0,0 +1,2 @@ +#! /bin/bash +pikman-update-manager --flatpak-installer "$@" \ No newline at end of file diff --git a/data/flatpak-installer.desktop b/data/flatpak-installer.desktop new file mode 100644 index 0000000..c1a87e5 --- /dev/null +++ b/data/flatpak-installer.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=Flatpak Installer +GenericName=Flatpak Installer +Comment=Easily install Flatpaks +Categories=GNOME;GTK;Settings;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;X-Unity-Settings-Panel; +Exec=flatpak-installer %s +Icon=com.github.pikaos-linux.pikmanupdatemanager +MimeType=application/vnd.flatpak.ref; +Terminal=false +Type=Application +X-GNOME-Gettext-Domain=com.github.pikaos-linux.pikmanupdatemanager +Keywords=Python; +NoDisplay=true \ No newline at end of file diff --git a/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.modify.repo.policy b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.modify.repo.policy new file mode 100644 index 0000000..ea715a4 --- /dev/null +++ b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.modify.repo.policy @@ -0,0 +1,19 @@ + + + + + + Authentication is required to modify APT sources + com.github.pikaos-linux.pika-kernel-manager + + yes + yes + yes + + /usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh + true + + + \ No newline at end of file diff --git a/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.update.manager.policy b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.update.manager.policy new file mode 100644 index 0000000..76fc089 --- /dev/null +++ b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.update.manager.policy @@ -0,0 +1,19 @@ + + + + + + Authentication is required to update the APT cache + com.github.pikaos-linux.pika-kernel-manager + + yes + yes + yes + + /usr/lib/pika/pikman-update-manager/scripts/apt_update + true + + + \ No newline at end of file diff --git a/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.upgrade.manager.policy b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.upgrade.manager.policy new file mode 100644 index 0000000..5602ff3 --- /dev/null +++ b/data/polkit-1/actions/com.github.pikaos-linux.pikmanupdatemanager.upgrade.manager.policy @@ -0,0 +1,19 @@ + + + + + + Authentication is required to upgrade APT packages + com.github.pikaos-linux.pika-kernel-manager + + yes + yes + yes + + /usr/lib/pika/pikman-update-manager/scripts/apt_full_upgrade + true + + + \ No newline at end of file diff --git a/data/software-properties-gtk b/data/software-properties-gtk new file mode 100644 index 0000000..a969efe --- /dev/null +++ b/data/software-properties-gtk @@ -0,0 +1,2 @@ +#! /bin/bash +pikman-update-manager --software-properties "$@" \ No newline at end of file diff --git a/data/software-properties-gtk.desktop b/data/software-properties-gtk.desktop new file mode 100644 index 0000000..a7ceaa8 --- /dev/null +++ b/data/software-properties-gtk.desktop @@ -0,0 +1,43 @@ +[Desktop Entry] +Name=Software & Updates (Repositary Management) +GenericName=Software & Updates (Repositary Management) +Comment=Configure the sources for installable software and updates +Comment[cs]=Konfigurovat zdroje pro instalovatelný software a aktualizace +Comment[da]=Konfigurér kilderne for installérbar software og opdateringer +Comment[de]=Quellen zum Installieren von Software und Aktualisierungen einrichten +Comment[el]=Ρύθμιση των πηγών για λογισμικό και ενημερώσεις +Comment[en_AU]=Configure the sources for installable software and updates +Comment[en_GB]=Configure the sources for installable software and updates +Comment[es]=Configura los orígenes para el software instalable y las actualizaciones +Comment[fi]=Muokkaa asennettavien ohjelmien ja päivitysten lähteitä +Comment[fr]=Configurer les canaux logiciels (sources de mise à jour) et les mises à jour via Internet +Comment[gl]=Configurar as fontes para programas e actualizacións instalables +Comment[he]=הגדרת מקורות התוכנות להתקנה והעדכונים +Comment[hr]=Podesi repozitorije i nadogradnje +Comment[hu]=Telepíthető szoftverek és frissítések forrásának beállítása +Comment[it]=Configura le sorgenti per gli aggiornamenti e per il software installabile +Comment[ka]=პროგრამების დაყენებისა და განახლების წყაროების კონფიგურირება +Comment[ko]=설치할 수 있는 소프트웨어와 업데이트를 위한 소스를 설정 +Comment[ku]=Ji bo nivîsbarî û rojanekirinên têne sazkirin çavkaniyan veava bike +Comment[nl]=Softwarekanalen en internet-updates configureren +Comment[pl]=Konfiguruj źródła pakietów oprogramowania i aktualizacji +Comment[pt]=Configurar os repositórios de software e actualizações instaláveis +Comment[pt_BR]=Configurar as fontes de aplicativos e atualizações +Comment[ro]=Configurează sursele pentru software instalabil şi actualizări +Comment[ru]=Настроить источники установки программ и обновлений +Comment[sv]=Konfigurera källorna för installerbara programvaror och uppdateringar +Comment[th]=ปรับแต่งแหล่งสำหรับซอฟต์แวร์และปรับปรุงที่ติดตั้งได้ +Comment[tr]=Kurulabilir yazılım ve güncellemeler için kaynakları yapılandır +Comment[zh_CN]=设定可安装和升级的源 +Comment[zh_TW]=設置可安裝的軟體及更新部份之來源。 +Keywords=Drivers;Repositories;Repository;PPA; +Exec=software-properties-gtk +Icon=software-properties +Terminal=false +X-MultipleArgs=false +Type=Application +Categories=GNOME;GTK;Settings;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;X-Unity-Settings-Panel; +X-GNOME-Settings-Panel=software-properties +X-Unity-Settings-Panel=software-properties +MimeType=text/x-apt-sources-list; +X-Ubuntu-Gettext-Domain=software-properties \ No newline at end of file diff --git a/just_in_case/__main__.py b/just_in_case/__main__.py deleted file mode 100755 index 5d6f26f..0000000 --- a/just_in_case/__main__.py +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/python3 - -import socket -import os - -import sys -import time - -import apt_pkg - -import apt -import apt.progress.base - -def get_change(current, total): - if current == total: - return 100.0 - try: - return float("{:.1f}".format(((current * 100) / total))) - except ZeroDivisionError: - return 0.0 - -class UpdateProgressSocket(apt.progress.base.AcquireProgress): - # Init - def __init__(self): - pass - - # Start - def start(self): - self.current_bytes = 0 - self.total_bytes = 0 - print("Starting APT Cache Update.") - return super().start() - - # Stop - def stop(self): - print("\nAPT Cache Update Complete!") - return super().stop() - - # Progrss pulse - def pulse(self, owner): - # Calculate current progress percentage - progress_percent = get_change(self.current_bytes, self.total_bytes) - - # apt_update_progress ipc sock - socket_path = "/tmp/pika_apt_update.sock" - - # Create a Unix domain socket - with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: - client.connect(socket_path) - # Send percentage to socket as UTF-8 - client.sendall(str(progress_percent).encode('utf-8')) - - #response = client.recv(1024) - #print(f"Received: {response.decode('utf-8')}") - - return True - - - def fail(self, item): - print("Failure at: %s %s" % (item.uri, item.shortdesc)) - - def fetch(self, item): - print("Fetch: %s %s" % (item.uri, item.shortdesc)) - - def ims_hit(self, item): - print("Download: %s %s" % (item.uri, item.shortdesc)) - - def media_change(self, medium, drive): - print(f"Please insert medium {medium} in drive {drive}") - sys.stdin.readline() - # return False - -def update_cache(): - # First of all, open the cache - cache = apt.Cache() - # Now, lets update the package list - cache.update(UpdateProgressSocket()) - # We need to re-open the cache because it needs to read the package list - cache.open(None) - # We need to re-open the cache because it needs to read the package list - for pkg in cache: - if pkg.is_upgradable: - print(f"{pkg.name} ({pkg.installed.version} -> {pkg.candidate.version})") - -def process(data): - # Echo the input data - return data - -if __name__ == "__main__": - - update_cache() diff --git a/src/bin/gui/build_ui/mod.rs b/src/bin/gui/build_ui/mod.rs index 5cee291..f67ce23 100644 --- a/src/bin/gui/build_ui/mod.rs +++ b/src/bin/gui/build_ui/mod.rs @@ -550,8 +550,13 @@ pub fn build_ui(app: &Application) { .position(|r| r == "--flatpak-installer") .unwrap() as i32) + 1) as usize; - flatpak_entry_signal_action + if index > gtk_application_args.len() -1 { + flatpak_entry_signal_action + .activate(Some(&glib::Variant::from(""))); + } else { + flatpak_entry_signal_action .activate(Some(&glib::Variant::from(>k_application_args[index]))); + } } 0