about summary refs log tree commit diff
path: root/src/etc/installer/pkg/postinstall
blob: fb035a48690b0781bc6482911b7d83be6abd6e65 (plain)
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
#!/bin/sh

source_dir="$(dirname "$0")"
dest_dir="$2"
package_id="$INSTALL_PKG_SESSION_ID"

if [ -z "$source_dir" ]; then
    exit 1
fi
if [ -z "$dest_dir" ]; then
    exit 1
fi
if [ -z "$package_id" ]; then
    exit 1
fi

if [ "$package_id" = "org.rust-lang.uninstall" ]; then
    if [ ! -e "$dest_dir/lib/rustlib/uninstall.sh" ]; then
	exit 1
    fi
    sh "$dest_dir/lib/rustlib/uninstall.sh"
else
    sh "$source_dir/install.sh" --prefix="$dest_dir"
fi

exit 0