changes to code from $<num> to ${<num>}

This commit is contained in:
Ohio2 2021-01-31 02:05:37 +01:00
parent 39b7a2a7fc
commit 62304ea878

32
spkg
View file

@ -1,26 +1,24 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#sPKG via wget #sPKG via wget
#fuck spaghetti code #fuck spaghetti code
#maky #mkay
source=git.hippoz.xyz/spkg/repo source=git.hippoz.xyz/spkg/repo
case $1 in case ${1} in
remove) dirstack=$(pwd) && cd /usr/src/$2 && make uninstall && popd ;; remove) dirstack=$(pwd) && cd /usr/src/${2} && make uninstall && popd ;;
install) case $2 in 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 && make && make install && cat $2 > /var/cache/spkg.cache && popd || echo 'Invalid package.' && popd ;; --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 ;; *) 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 cache) case ${2} in
rm) rm -rf /usr/src/* ;; rm) rm -rf /usr/src/* ;;
clean) rm -rf /usr/src/$3 ;; clean) 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 -P /etc/spkg && mkdir -P /etc/spkg/cache && echo 'Made a caching directory, rerun:' && echo 'spkg cache' ;; *) cp /usr/src/ /etc/spkg/cache || mkdir -P /etc/spkg && mkdir -P /etc/spkg/cache && echo 'Made a caching directory, rerun:' && echo 'spkg cache' ;;
esac ;; esac ;;
database) case $3 in database) case ${3} in
lookup) case $4 in lookup) case ${4} in
local) grep $5 /var/cache/spkg.cache ;; local) grep ${5} /var/cache/spkg.cache ;;
query) wget $source/web.spkg.cache /tmp/spkg/ && grep $5 /tmp/spkg/web.spkg.cache && rm /tmp/spkg/cache || mkdir -P /tmp/spkg ;; 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 esac
esac esac