From 3cdbc8e423b7c9324327919773c257f4fefaeeba Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Sun, 4 Apr 2021 17:38:38 +0200 Subject: [PATCH] code overhaul, manual page, and plans for this to become alnux default --- man | 18 ++++++++++++++++++ spkg | 25 +++++++++++++++---------- 2 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 man mode change 100644 => 100755 spkg diff --git a/man b/man new file mode 100644 index 0000000..3ca9b1d --- /dev/null +++ b/man @@ -0,0 +1,18 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.2. +.TH NOT "1" "April 2021" "not done yet lol" "User Commands" +.SH NAME +not \- manual page for not done yet lol +.SH DESCRIPTION +sPKG via WGET, to cache, just type in (doas or sudo) spkg cache save +.SH "SEE ALSO" +The full documentation for +.B not +is maintained as a Texinfo manual. If the +.B info +and +.B not +programs are properly installed at your site, the command +.IP +.B info not +.PP +should give you access to the complete manual. diff --git a/spkg b/spkg old mode 100644 new mode 100755 index 3726a72..603c352 --- a/spkg +++ b/spkg @@ -1,24 +1,29 @@ #!/usr/bin/env sh #sPKG via wget #fuck spaghetti code -#mkay +#mkay. gonna do a massive code overhaul! + source=git.hippoz.xyz/spkg/repo case ${1} in - remove) dirstack=$(pwd) && cd /usr/src/${2} && make uninstall && popd ;; + remove) pushd && cd /usr/src/${2} && make uninstall && popd ;; install) case ${2} in - --root-dir=) dirstack=$(pwd) && mkdir -P /usr/src/${2} && wget $source/${2}/Makefile /usr/src/${2}/Makefile && cd /usr/src/${2} && make prepare && PREFIX=${3} make && make install && cat ${2} > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; - *) dirstack=$(pwd) && mkdir -P /usr/src/${2} && wget $source/${2}/Makefile /usr/src/${2}/Makefile && cd /usr/src/${2} && make prepare && make && make install && cat ${2} > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; - cache) case ${2} in + --root-dir=) pushd && mkdir /usr/src/${2} 2>/dev/null && wget $source/${2}/Makefile /usr/src/${2}/Makefile && cd /usr/src/${2} && make prepare && PREFIX=${3} make && make install && cat ${2} > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; + *) pushd && mkdir /usr/src/${2} 2>/dev/null && wget $source/${2}/Makefile /usr/src/${2}/Makefile && cd /usr/src/${2} && make prepare && make && make install && cat ${2} > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; + esac ;; + cache) case ${2} in rm) rm -rf /usr/src/* ;; clean) rm -rf /usr/src/${3} ;; save) case ${3} in to) cp /usr/src/ ${4} ;; - *) cp /usr/src/ /etc/spkg/cache || mkdir -P /etc/spkg && mkdir -P /etc/spkg/cache && echo 'Made a caching directory, rerun:' && echo 'spkg cache' ;; + *) cp /usr/src/ /etc/spkg/cache || mkdir /etc/spkg 2>/dev/null && mkdir /etc/spkg/cache 2>/dev/null && cp /usr/src/ /etc/spkg/cache ;; esac ;; database) case ${3} in lookup) case ${4} in local) grep ${5} /var/cache/spkg.cache ;; - query) wget $source/spkg.cache /tmp/spkg/ && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache || mkdir -P /tmp/spkg ;; - esac - esac - esac + query) wget $source/spkg.cache /tmp/spkg/ && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache || mkdir -P /tmp/spkg && wget $source/spkg.cache /tmp/spkg/ && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache;; + esac ;; + esac ;; + esac ;; + --help) echo 'sPKG via WGET, to cache, just type in (doas or sudo) spkg cache save' ;; + --version) echo 'not done yet lol' ;; +esac