Compare commits

..

No commits in common. "3487b76b450ffd9715793c5a1ba5a5288abc86a8" and "ad247fa21eb819a52e0f4a75450a9c00246cd11e" have entirely different histories.

35
spkg
View file

@ -1,35 +1,25 @@
#!/usr/bin/env sh
func()
#sPKG via wget
# NOTE: sPKG via wget CAN'T RUN WITHOUT MAKE!!!
source=git.hippoz.xyz/spkg/repos
# THIS IS UT.BETA
# 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/repo
beta=false
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, 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.
remove) pushd && for fname in $@ && cd /usr/src/${2} && make uninstall && popd ;;
install) case ${2} in
--root-dir=) for fname in $@
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 ;;
--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 ;;
esac ;;
cache) case ${2} in
#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 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 ;;
@ -37,13 +27,10 @@ case ${1} in
esac ;;
esac ;;
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 ;;
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 ;;
--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.
to setup (IMPORTANT!!!), just type in sudo spkg setup' ;;
--version) echo 'beta 21.06.29.2a.ut' ;;
--version) echo 'beta 21.06.29.1a' ;;
esac