Major patch

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

12
spkg
View file

@ -10,9 +10,10 @@ setup() {
}
removepkg() {
pkgname=$1
prefix=$2
cd /usr/src/"${pkgname}" || exit 2
make uninstall
sed "s/${pkgname} $(${pkgname} --version)//" /var/cache/spkg.cache
sed "s/${pkgname} $(${pkgname} --version)//" "${prefix}"/var/cache/spkg.cache
}
instpkg() {
pkgname=$1
@ -20,14 +21,15 @@ instpkg() {
mkdir -p "${tmpdir}"/spkg/work/"${1}"-work/
cd "${tmpdir}"/spkg/work/"${1}"-work/ || exit 2
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
export PREFIX="${prefix}"
export PKGNAME="${pkgname}"
make prepare
make
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() {
pkgname=$1
@ -69,7 +71,9 @@ case "${1}" in
*) setup "/" ;;
esac ;;
remove)
removepkg "${2}" ;;
case "${2}" in
--root-dir) removepkg "${3}" "${4}" ;;
*) removepkg "${3}" "/" ;;
install)
case "${2}" in
--root-dir) instpkg "${4}" "${3}" ;;