Major patch

This commit is contained in:
Ohio2 2021-06-30 23:16:01 +02:00
parent 2355e05562
commit dfe8b548dd

14
spkg
View file

@ -10,9 +10,10 @@ setup() {
} }
removepkg() { removepkg() {
pkgname=$1 pkgname=$1
prefix=$2
cd /usr/src/"${pkgname}" || exit 2 cd /usr/src/"${pkgname}" || exit 2
make uninstall make uninstall
sed "s/${pkgname} $(${pkgname} --version)//" /var/cache/spkg.cache sed "s/${pkgname} $(${pkgname} --version)//" "${prefix}"/var/cache/spkg.cache
} }
instpkg() { instpkg() {
pkgname=$1 pkgname=$1
@ -20,14 +21,15 @@ instpkg() {
mkdir -p "${tmpdir}"/spkg/work/"${1}"-work/ mkdir -p "${tmpdir}"/spkg/work/"${1}"-work/
cd "${tmpdir}"/spkg/work/"${1}"-work/ || exit 2 cd "${tmpdir}"/spkg/work/"${1}"-work/ || exit 2
mkdir -p "${prefix}"/usr/src/"${pkgname}" mkdir -p "${prefix}"/usr/src/"${pkgname}"
wget "${source}"/"${pkgname}"/Makefile "${prefix}"/usr/src/"${pkgname}"/Makefile wget "${source}"/"${pkgname}"/Makefile
mv "${prefix}"/usr/src/"${pkgname}"
cd "${prefix}"/usr/src/"${pkgname}" || exit 2 cd "${prefix}"/usr/src/"${pkgname}" || exit 2
export PREFIX="${prefix}" export PREFIX="${prefix}"
export PKGNAME="${pkgname}" export PKGNAME="${pkgname}"
make prepare make prepare
make make
make install make install
sed a\ "${pkgname} $(${pkgname} --version)" /var/cache/spkg.cache > /var/cache/spkg.cache sed a\ "${pkgname} $(${pkgname} --version)" "${prefix}"/var/cache/spkg.cache > "${prefix}"/var/cache/spkg.cache
} }
update() { update() {
pkgname=$1 pkgname=$1
@ -68,8 +70,10 @@ case "${1}" in
--root-dir) setup "${3}" ;; --root-dir) setup "${3}" ;;
*) setup "/" ;; *) setup "/" ;;
esac ;; esac ;;
remove) remove)
removepkg "${2}" ;; case "${2}" in
--root-dir) removepkg "${3}" "${4}" ;;
*) removepkg "${3}" "/" ;;
install) install)
case "${2}" in case "${2}" in
--root-dir) instpkg "${4}" "${3}" ;; --root-dir) instpkg "${4}" "${3}" ;;