summaryrefslogtreecommitdiffstats
path: root/src/etc/installer/pkg/postinstall
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/installer/pkg/postinstall')
-rwxr-xr-xsrc/etc/installer/pkg/postinstall26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/etc/installer/pkg/postinstall b/src/etc/installer/pkg/postinstall
new file mode 100755
index 000000000..fb035a486
--- /dev/null
+++ b/src/etc/installer/pkg/postinstall
@@ -0,0 +1,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