Compare commits

..

No commits in common. "5a6750444ef2703efd055e8c91e33ddd2248a39a" and "fa9a7a106403bf47a7632ca989b2892fccfdb403" have entirely different histories.

132
spkg
View file

@ -1,102 +1,36 @@
#!/bin/sh #!/usr/bin/env sh
func()
source="https://git.hippoz.xyz/spkg/repo" #sPKG via wget
# NOTE: sPKG via wget CAN'T RUN WITHOUT MAKE!!!
setup() { # ALNUX might not have MAKE!!! We tried porting it, dependiecies are fucked.
cp ./spkg /usr/bin/spkg # Correction here in the latest build, you have to run setup to install make, so not that fucked.
chmod +x /usr/bin/spkg source=git.hippoz.xyz/spkg/repo
mkdir /etc/ beta=false
mv os-release /etc/ case ${1} in
} setup) cp ./spkg /usr/bin/spkg && chmod +x /usr/bin/spkg && mkdir /etc/ && mv os-release /etc/ ;;
removepkg() { remove) pushd && for fname in $@ && cd /usr/src/${2} && make uninstall && popd ;;
pkgname=$1 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 ;;
cd /usr/src/"${pkgname}" || exit 2 *) 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 ;;
make uninstall esac ;;
} cache) case ${2} in
instpkg() { clean) rm -rf /usr/src/* ;;
pkgname=$1 rm) rm -rf /usr/src/${3} ;;
prefix=$2 save) case ${3} in
to) cp /usr/src/ ${4} ;;
mkdir -p "${prefix}"/usr/src/"${pkgname}" *) 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 ;;
wget "${source}"/"${pkgname}"/Makefile "${prefix}"/usr/src/"${pkgname}"/Makefile esac ;;
cd "${prefix}"/usr/src/"${pkgname}" || exit 2 database) case ${3} in
export PREFIX="${prefix}" lookup) case ${4} in
export PKGNAME="${pkgname}" local) grep $@ /var/cache/spkg.cache ;;
make prepare 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;;
make esac ;;
make install esac ;;
cat "${pkgname}" > "${prefix}"/var/cache/spkg.cache esac ;;
"${pkgname}" --version > "${prefix}"/var/cache/spkg.cache 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.
update() {
pkgname=$1
prefix=$2
version1=$(grep "${pkgname}" /var/cache/spkg.cache)
version2=$(wget "${source}"/spkg.cache /tmp/spkg/web.spkg.cache && grep "${pkgname}" /tmp/spkg/web.spkg.cache )
if [ "$version1" = "${version2}" ]; then
echo 'Up to date.'
else
instpkg "${pkgname}" "${prefix}"
fi
}
dbquery() {
pkgname=$1
wget "${source}"/spkg.cache /tmp/spkg/web.spkg.cache
grep "${pkgname}" /tmp/spkg/web.spkg.cache
rm /tmp/spkg/cache || mkdir 2>/dev/null /tmp/spkg
}
dblocal() {
pkgname=$1
grep "${pkgname}" /var/cache/spkg.cache
}
usage() {
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.1a"
}
case "${1}" in
setup)
setup ;;
remove)
removepkg "${2}" ;;
install)
case "${2}" in
--root-dir) instpkg "${4}" "${3}" ;;
*) instpkg "${3}" "/" ;;
esac ;;
cache)
case "${2}" in
clean)
rm -rf /usr/src/* ;;
rm)
rm -rf /usr/src/"${3}" ;;
save)
case ${3} in
to) cp -rv /usr/src/* "${4}"/ ;;
esac ;;
database)
case "${3}" in
lookup)
case "${4}" in
local)
dblocal "${5}" ;;
query)
dbquery "${5}" ;;
esac ;;
esac ;;
esac ;;
update)
update "${2}" ;;
--help)
usage ;;
--version)
version ;;
esac esac