From 11ef2c4f452ed4316bc7da3c09a415093a04dc78 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Tue, 29 Jun 2021 15:05:48 +0200 Subject: [PATCH] Parser broke --- spkg | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/spkg b/spkg index 4a1eeee..a434faa 100755 --- a/spkg +++ b/spkg @@ -1,33 +1,38 @@ #!/usr/bin/env sh -func() -#sPKG via wget # NOTE: sPKG via wget CAN'T RUN WITHOUT MAKE!!! -# ALNUX might not have MAKE!!! We tried porting it, dependiecies are fucked. -# Correction here in the latest build, you have to run setup to install make, so not that fucked. source=git.hippoz.xyz/spkg/repos # THIS IS UT.BETA case ${1} in + #setup does the important shit like, copy spkg and chmod it, install osrel to etc. setup) cp ./spkg /usr/bin/spkg && chmod +x /usr/bin/spkg && mkdir /etc/ && mv os-release /etc/ ;; - remove) pushd && for fname in $@ && cd /usr/src/${2} && make uninstall && cd .. && rm -rf ${2} && sed "s/${2}//" /var/cache/spkg.cache && popd ;; + #remove, just well, uninstalls and removes from cache. + remove) for fname in $@ && do && pushd && cd /usr/src/${2} && make uninstall && cd .. && rm -rf ${2} && sed "s/${2}//" && popd && done ;; + #install is complicated, root dir just changes the root dir, first install gets the make file that's requested, prepares, makes, installs + #and saves to cache. install) case ${2} in - --root-dir=) pushd && for fname in $@ && mkdir ${4}/usr/src/${3} 2>/dev/null && wget $source/${3}/Makefile ${4}/usr/src/${3}/Makefile && cd ${4}/usr/src/${3} && make prepare && make && make install && cat ${3} > ${4}/var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; - *) pushd && for fname in $@ && mkdir /usr/src/${3} 2>/dev/null && wget $source/${3}/Makefile /usr/src/${3}/Makefile && cd /usr/src/${3} && make prepare && make && make install && cat ${3} > /var/cache/spkg.cache && ${3} --version > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; + --root-dir=) pushd && for fname in $@ && do && mkdir ${4}/usr/src/${3} 2>/dev/null && wget $source/${3}/Makefile ${4}/usr/src/${3}/Makefile && cd ${4}/usr/src/${3} && make prepare && make && make install && cat ${3} > ${4}/var/cache/spkg.cache && ${3} --version && popd && done || echo 'Invalid package.' && popd ;; + *) pushd && for fname in $@ && do && mkdir /usr/src/${3} 2>/dev/null && wget $source/${3}/Makefile /usr/src/${3}/Makefile && cd /usr/src/${3} && make prepare && make && make install && cat ${3} > /var/cache/spkg.cache && popd && done || echo 'Invalid package.' && popd ;; esac ;; cache) case ${2} in - clean) rm -rf /usr/src/* ;; + #cache clean rm and save are easy thus won't wase time for them + clean) rm -rf /usr/src/* ;; rm) rm -rf /usr/src/${3} ;; save) case ${3} in to) cp /usr/src/ ${4} ;; *) 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 + #database lookup local just greps cache + # on the other hand, query is complicated, does the same thing though. + #but for online cache. + database) case ${3} in lookup) case ${4} in - local) grep $@ /var/cache/spkg.cache ;; - query) wget $source/spkg.cache /tmp/spkg/web.spkg.cache && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache || mkdir 2>/dev/null /tmp/spkg && wget $source/spkg.cache /tmp/spkg/ && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache;; + local) grep $@ /var/cache/spkg.cache ;; + query) wget $source/spkg.cache /tmp/spkg/web.spkg.cache && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache || mkdir 2>/dev/null /tmp/spkg && wget $source/spkg.cache /tmp/spkg/ && grep ${5} /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache;; esac ;; esac ;; - esac ;; - update) for fname in $@ && version1=$(wget $source/spkg.cache /tmp/spkg/web.spkg.cache && grep ${2}) && version2=$(wget $source/spkg.cache /tmp/spkg/web.spkg.cache && grep ${2} /tmp/spkg/web.spkg.cache ) && [ version1 = version2] && echo 'Up to date.' || 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 && ${2} --version > /var/cache/spkg.cache && popd ;; + esac ;; + #update is really complicated. you must know that it compares local and repo version of the package + update) for fname in $@ && do && version1=$(grep ${2} /var/cache/spkg.cache) && version2=$(wget $source/spkg.cache /tmp/spkg/web.spkg.cache && grep ${2} /tmp/spkg/web.spkg.cache ) && [ version1 = version2] && echo 'Up to date.' || 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 && ${2} --version > /var/cache/spkg.cache && popd && done ;; --help) echo 'sPKG via WGET, to cache, just type in sudo spkg cache save. to install, just type in sudo spkg install. to update, just type in sudo spkg update.