first commit

This commit is contained in:
Penelope Gwen 2024-03-01 22:50:13 -07:00
commit 88a6cbf414
16 changed files with 262 additions and 0 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
# Sapphic-Package-Manager

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
pogupdate (1.0-1) UNRELEASED; urgency=medium
* Initial release.
-- Penelope Gwen <support@pogmom.me> Thu, 29 Feb 2024 13:45:02 -0700

11
debian/control vendored Normal file
View file

@ -0,0 +1,11 @@
Source: pogupdate
Maintainer: Penelope Gwen <support@pogmom.me>
Section: utils
Priority: standard
Standards-Version: 4.6.2
Build-Depends: debhelper-compat (= 13)
Package: pogupdate
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: update apt, flatpak, and pipx packages quickly

0
debian/copyright vendored Normal file
View file

3
debian/rules vendored Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (native)

View file

@ -0,0 +1 @@

12
test Normal file
View file

@ -0,0 +1,12 @@
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
libnsl-dev libtirpc-dev
0 upgraded, 0 newly installed, 2 to remove and 127 not upgraded.
After this operation, 1164 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 280244 files and directories currently installed.)
Removing libnsl-dev:arm64 (1.3.0-3) ...
Removing libtirpc-dev:arm64 (1.3.4+ds-1) ...
Processing triggers for man-db (2.12.0-3) ...

45
usr/bin/spm Executable file
View file

@ -0,0 +1,45 @@
#!/bin/bash
_completions()
{
COMPREPLY+=("now")
COMPREPLY+=("tomorrow")
COMPREPLY+=("never")
}
COMMAND="${1}"
#VERSION=$(cat /lib/spm/version)
upgrade() {
spm_upgrade $@
}
clean() {
spm_clean $@
}
search() {
spm_search $@
}
usage() {
echo "Sapphic Package Manager v${VERSION}"
cat ./usr/share/doc/spm/spm
sed -e 's/^/ /' ./usr/share/doc/spm/spm_upgrade
sed -e 's/^/ /' ./usr/share/doc/spm/spm_search
sed -e 's/^/ /' ./usr/share/doc/spm/spm_clean
}
case $COMMAND in
upgrade|search|clean )
shift 1;;&
upgrade )
upgrade $@;;
clean )
clean $@;;
search )
search $@;;
*|usage )
usage;;
esac

46
usr/bin/spm_clean Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
isroot=false
issudo=false
if [ "$EUID" -eq 0 ];then isroot=true;fi
if [ -n "$SUDO_USER" ]; then issudo=true;fi
usage(){
echo -n "spm "
cat ./usr/share/doc/spm/spm_clean
}
yn=""
while getopts 'hYyNnafp' flag; do
case "${flag}" in
[YyNnafp] ) yn="${yn}${flag}" ;;
h|* ) usage;exit 1 ;;
esac
done
if $isroot; then
echo -e "\033[1mUpdating apt sources...\033[0m"
apt -qqq update
echo -e "\033[1mThe following packages were automatically installed and are no longer required:\033[0m"
apt list '?garbage'
fi
echo -e "\033[1mUnable to preview unused flatpak packages\033[0m"
echo -e "\033[1mUnable to clean pipx packages\033[0m"
while true; do
if [ -z "$yn" ];then
echo "Yy: Clean all"
echo "Nn: Clean nothing"
if $isroot; then echo "Aa: Remove unused apt packages";fi
echo "Ff: Remove unused flatpak packages"
read -p "Clean packages? " yn
fi
case $yn in
*[Nn]* ) exit;;
*[Yya]* ) if $isroot; then echo -e "\033[1mRemoving unused apt packages...\033[0m";apt -y autoremove;fi;;&
*[Yyf]* ) if $issudo; then echo -e "\033[1mRemoving unused flatpak packages...\033[0m";sudo -u $SUDO_USER flatpak uninstall -y --unused;else flatpak uninstall -y --unused;fi;;&
*[p]* ) echo -e "\033[1mUnable to clean pipx packages\033[0m";;&
*[Yyafp]* ) break;;
* ) yn=""; echo "Please select a valid option.";;
esac
done

48
usr/bin/spm_search Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
isroot=false
issudo=false
if [ "$EUID" -eq 0 ];then isroot=true;fi
if [ -n "$SUDO_USER" ]; then issudo=true;suggestsudo="sudo ";fi
usage(){
echo -n "spm "
cat ./usr/share/doc/spm/spm_search
}
yn=""
while getopts 'hafp' flag; do
case "${flag}" in
[afp] ) yn="${yn}${flag}" ;;
h|* ) usage
exit 1 ;;
esac
done
shift $((OPTIND - 1))
if [ -z "$yn" ];then
yn="Y"
fi
if [ -z "${1}" ];then
echo -e "\033[1mYou must specific a package name!\033[0m"
usage
exit 1
fi
case $yn in
*[Nn]* ) exit;;
*[Yya]* ) if $isroot; then
echo -e "\033[1mUpdating apt sources...\033[0m"
apt -qqq update
echo -e "\033[1mSearching for apt packages...\033[0m"
dpkg-query --show --showformat='${Package;-35}\t${Version;-15}\t${binary:Synopsis}\n' *"${1}"*
echo -e "\033[1mApt packages can be installed with \`\033[0m${suggestsudo}apt install [Package Name]\033[1m\`. A package's name can be found in the left column\033[0m"
fi;;&
*[Yyf]* ) echo -e "\033[1mSearching for flatpak packages...\033[0m"
flatpak search --columns=application,version,description ${1}
echo -e "\033[1mFlatpak packages can be installed with \`\033[0m${suggestsudo}flatpak install [Application ID]\033[1m\'. A package's Application ID can be found in the left column.\033[0m";;&
*[p]* ) echo -e "\033[1mUnable to search for pipx packages\033[0m";;&
*[Yyafp]* ) exit 0;;
* ) echo "bad search options";exit 1;;
esac

57
usr/bin/spm_upgrade Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
isroot=false
issudo=false
if [ "$EUID" -eq 0 ];then isroot=true;fi
if [ -n "$SUDO_USER" ]; then issudo=true;fi
usage(){
echo -n "spm "
cat ./usr/share/doc/spm/spm_upgrade
}
yn=""
while getopts 'hYyNnafp' flag; do
case "${flag}" in
[YyNnafp] ) yn="${yn}${flag}" ;;
h|* ) usage
exit 1 ;;
esac
done
if $isroot; then
echo -e "\033[1mUpdating apt sources...\033[0m"
apt -qqq update
echo -e "\033[1mapt upgrade summary:\033[0m"
apt -qq upgrade --dry-run
fi
echo -e "\033[1mWill check and install updates for the following pipx packages:\033[0m"
if $issudo;then
sudo -u $SUDO_USER pipx list --short
else
pipx list --short
fi
echo -e "\033[1mFlatpak update summary:\033[0m"
if $issudo;then
sudo -u $SUDO_USER flatpak remote-ls --updates
else
flatpak remote-ls --updates
fi
while true; do
if [ -z "$yn" ];then
echo "Yy: Update All"
echo "Nn: Update nothing"
if $isroot; then echo "a: Upgrade apt packages";fi
echo "f: Update flatpak packages"
echo "p: Update pipx packages"
read -p "Install updates? " yn
fi
case $yn in
*[Nn]* ) exit;;
*[Yya]* ) if $isroot; then echo -e "\033[1mUpgrading apt packages...\033[0m";apt -y upgrade;fi;;&
*[Yyf]* ) if $issudo; then echo -e "\033[1mUpdating flatpak packages...\033[0m";sudo -u $SUDO_USER flatpak update -y;else flatpak update -y;fi;;&
*[Yyp]* ) if $issudo; then echo -e "\033[1mUpgrading pipx packages...\033[0m";sudo -u $SUDO_USER pipx upgrade-all;else pipx upgrade-all;fi;;&
*[Yyafp]* ) break;;
* ) yn=""; echo "Please select a valid option.";;
esac
done

6
usr/share/doc/spm/spm Normal file
View file

@ -0,0 +1,6 @@
Usage: spm command [options]
Sapphic Package Manager is not a package manager- it is a congregate frontend for apt, flatpak, and pipx intended for use on Sapphian Linux
Commands:
usage: Print this dialogue

View file

@ -0,0 +1,9 @@
clean: Remove unused packages that were previously installed via apt and flatpak
usage:
spm clean -[h|Nn|Yyaf]
options:
-Yy: Skip confirmation and approve all cleanup
-Nn: Skip confirmation and approve no cleanup
-a: Requires root, skip confirmation and approve apt cleanup. Redundant when used with -Yy
-f: Skip confirmation and approve flatpak cleanup. Redundant when used with -Yy
-h: Print usage dialogue

View file

@ -0,0 +1,7 @@
search: Search for packages available via apt or flatpak
usage:
spm search -[h|af] query
options:
-a: Disable default search-all behavior and whitelist apt for search
-f: Disable default search-all behavior and whitelist flatpak for search
-h: Print usage dialogue

View file

@ -0,0 +1,10 @@
upgrade: Update packages installed via apt, flatpak, and pipx
usage:
spm upgrade -[h|Nn|Yyafp]
options:
-Yy: Skip confirmation and approve all upgrades
-Nn: Skip confirmation and approve no upgrades
-a: Requires root, skip confirmation and approve apt upgrades. Redundant when used with -Yy
-f: Skip confirmation and approve flatpak updates. Redundant when used with -Yy
-p: Skip confirmation and approve pipx updates. Redundant when used with -Yy
-h: Print usage dialogue