Compare commits

..

No commits in common. "b0d9b00fc3175fc3067c21384d1b3e69d051c990" and "6ecce2688c6b33596e784be3a98ab844b1f3f394" have entirely different histories.

45
spkg
View file

@ -1,49 +1,36 @@
#!/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.
# Correction here in the latest build, you have to run setup to install make, so not that fucked.
source=git.hippoz.xyz/spkg/repos source=git.hippoz.xyz/spkg/repos
# THIS IS UT.BETA
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, just well, uninstalls and removes from cache. remove) pushd && for fname in $@ && cd /usr/src/${2} && make uninstall && cd .. && rm -rf ${2} && sed "s/${2}//" /var/cache/spkg.cache && popd ;;
remove) for fname in $@
do
pushd && cd /usr/src/${2} && sed "s/${2} $(${2} --version)//" && make uninstall && cd .. && rm -rf ${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=) for fname 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 ;;
do *) 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 ;;
$prefix=${4} && export $prefix && pushd && mkdir $prefix/usr/src/${3} 2>/dev/null && wget $source/${3}/Makefile $prefix/usr/src/${3}/Makefile && cd $prefix/usr/src/${3} && make prepare && make && make install && sed a\ "${3} $(${3} --version)" /var/cache/spkg.cache > /var/cache/spkg.cache && popd && done || echo 'Invalid package.' && popd ;;
*) for fname in $@
do
$prefix=/usr && export $prefix && 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 && sed a\ "${3} $(${3} --version)" /var/cache/spkg.cache > /var/cache/spkg.cache && popd && done || echo 'Invalid package.' && popd ;;
esac ;; esac ;;
cache) case ${2} in cache) case ${2} in
#cache clean rm and save are easy thus won't wase time for them clean) rm -rf /usr/src/* ;;
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 lookup local just greps cache database) case ${3} in
# 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;;
list) cat /var/cache/spkg.cache esac ;;
esac ;;
esac ;; esac ;;
esac ;; esac ;;
#update is really complicated. you must know that it compares local and repo version of the package 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) for fname in $@
do
$prefix=/usr && export $prefix && 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 && sed "s/${2} $({$2} --version)//" && sed a\ "${2} $(${2} --version)" /var/cache/spkg.cache > /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.2b' ;; --version) echo 'beta 21.06.29.2a.ut' ;;
esac esac