diff --git a/spkg b/spkg index 7bf1307..f0aef00 100755 --- a/spkg +++ b/spkg @@ -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 @@ -68,8 +70,10 @@ case "${1}" in --root-dir) setup "${3}" ;; *) setup "/" ;; esac ;; - remove) - removepkg "${2}" ;; + remove) + case "${2}" in + --root-dir) removepkg "${3}" "${4}" ;; + *) removepkg "${3}" "/" ;; install) case "${2}" in --root-dir) instpkg "${4}" "${3}" ;;