Compare commits

...

3 commits

Author SHA1 Message Date
Ohio2
3487b76b45 Parser fix 2021-06-29 15:48:20 +02:00
Ohio2
11ef2c4f45 Parser broke 2021-06-29 15:05:48 +02:00
Ohio2
6ecce2688c Upon removing, it removes entries from cache too! (06.29.2a.ut) 2021-06-29 14:18:20 +02:00

45
spkg
View file

@ -1,36 +1,49 @@
#!/usr/bin/env sh #!/usr/bin/env sh
func()
#sPKG via wget
# NOTE: sPKG via wget CAN'T RUN WITHOUT MAKE!!! # NOTE: sPKG via wget CAN'T RUN WITHOUT MAKE!!!
# ALNUX might not have MAKE!!! We tried porting it, dependiecies are fucked. source=git.hippoz.xyz/spkg/repos
# Correction here in the latest build, you have to run setup to install make, so not that fucked. # THIS IS UT.BETA
source=git.hippoz.xyz/spkg/repo
beta=false
case ${1} in 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/ ;; 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 && 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 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 ;; --root-dir=) for fname in $@
*) 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 ;; do
pushd && 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 ;;
*) for fname in $@
do
pushd && 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 ;; esac ;;
cache) case ${2} in 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} ;; rm) rm -rf /usr/src/${3} ;;
save) case ${3} in save) case ${3} in
to) cp /usr/src/ ${4} ;; 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 ;; *) 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 ;; 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 lookup) case ${4} in
local) grep $@ /var/cache/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;; 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 ;; 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 ;; #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. --help) echo 'sPKG via WGET, to cache, just type in sudo spkg cache save.
to install, just type in sudo spkg install. to install, just type in sudo spkg install.
to update, just type in sudo spkg update. to update, just type in sudo spkg update.
to setup (IMPORTANT!!!), just type in sudo spkg setup' ;; to setup (IMPORTANT!!!), just type in sudo spkg setup' ;;
--version) echo 'beta 21.06.29.1a' ;; --version) echo 'beta 21.06.29.2a.ut' ;;
esac esac