-
Notifications
You must be signed in to change notification settings - Fork 2
/
portz_uninstall
executable file
·51 lines (41 loc) · 1.33 KB
/
portz_uninstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
#
# This file is part of 'portz'
#
# Copyright (C) Zbigniew Zagorski <[email protected]> and others,
# licensed to the public under the terms of the GNU GPL (>= 2)
# see the file COPYING for details
#
# I.e., do what you like, but keep copyright and there's NO WARRANTY.
#
PNAME=portz-uninstall
set -e
portz_libdir=${portz_libdir-`pwd`}
. ${portz_libdir}/scripts/runtime.sh
. ${portz_scripts}/functions.sh
log_quiet=1
. ${portz_scripts}/build_defs.sh
log_quiet=0
. ${portz_scripts}/package_defs.sh
package_name=$1
if [ -z ${package_name} ] ; then
fail "need package name"
fi
setup_package_build_defs
if [ ! -f ${manifest_file} ] ; then
fail "package '$package_name' not installed (failed to read ${manifest_file})"
fi
# move manifest to temp file, so we don't remove
# file that is currently read
readonly temp_manifest=/tmp/.portz_uninstall-$$-$USER
cp ${manifest_file} $temp_manifest
prefix="$(realpath $(dirname ${manifest_file})/../..)"
# TBD, protect against spaces !!!
portz_list_files_from_manifest "${temp_manifest}" "${prefix}" | xargs -n 20 rm -rvf
# hack:
# some old manifest files doesn't contain PKGINFO
if [ -f "$prefix/lib/portz/$package_name.PKGINFO" ] ; then
rm -v "$prefix/lib/portz/$package_name.PKGINFO"
fi
rm $temp_manifest
# jedit: :tabSize=8:indentSize=4:noTabs=true:mode=shellscript: