diff options
Diffstat (limited to 'src/etc/installer/pkg')
-rw-r--r-- | src/etc/installer/pkg/Distribution.xml | 88 | ||||
-rwxr-xr-x | src/etc/installer/pkg/postinstall | 26 |
2 files changed, 114 insertions, 0 deletions
diff --git a/src/etc/installer/pkg/Distribution.xml b/src/etc/installer/pkg/Distribution.xml new file mode 100644 index 000000000..077ee1751 --- /dev/null +++ b/src/etc/installer/pkg/Distribution.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<installer-gui-script minSpecVersion="2"> + <title>The Rust Compiler</title> + <license file="LICENSE.txt" mime-type="text/plain"/> + <pkg-ref id="org.rust-lang.rust"/> + <options customize="always" require-scripts="false" hostArchitectures="i386,x86_64"/> + <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true" /> + <volume-check> + <allowed-os-versions> + <os-version min="10.7"/> + </allowed-os-versions> + </volume-check> + <choices-outline> + <line choice="install"> + <line choice="rustc"/> + <line choice="rust-std"/> + <line choice="cargo"/> + <line choice="rust-docs"/> + <!-- tool-rls-start --> + <line choice="rls"/> + <!-- tool-rls-end --> + </line> + <line choice="uninstall" /> + </choices-outline> + <!-- + These 'selected' scripts ensure that install and uninstall can never be selected at + the same time. Exectly how they work is pretty mysterious, tied to the unspecified algorithm + the installer uses to traverse the options after one is toggled. + --> + <choice id="install" visible="true" + title="Install Rust" description="Install the Rust compiler, package manager and documentation." + customLocation="/usr/local" + selected="!choices.uninstall.selected" + /> + <choice id="uninstall" visible="true" + title="Uninstall Rust" description="Select this option to uninstall an existing Rust installation." + customLocation="/usr/local" + selected="!(choices.install.selected || choices.rustc.selected || choices.cargo.selected || choices['rust-docs'].selected)" + start_selected="false" + > + <pkg-ref id="org.rust-lang.uninstall"/> + </choice> + <choice id="rustc" visible="true" + title="Compiler" description="rustc, the Rust compiler, and rustdoc, the API documentation tool." + selected="(!choices.uninstall.selected && choices.rustc.selected) || (choices.uninstall.selected && choices.install.selected)" + > + <pkg-ref id="org.rust-lang.rustc"/> + </choice> + <choice id="cargo" visible="true" + title="Cargo" description="cargo, the Rust package manager." + selected="(!choices.uninstall.selected && choices.cargo.selected) || (choices.uninstall.selected && choices.install.selected)" + > + <pkg-ref id="org.rust-lang.cargo"/> + </choice> + <choice id="rust-std" visible="true" + title="Standard Library" description="The Rust standard library." + selected="(!choices.uninstall.selected && choices['rust-std'].selected) || (choices.uninstall.selected && choices.install.selected)" + > + <pkg-ref id="org.rust-lang.rust-std"/> + </choice> + <choice id="rust-docs" visible="true" + title="Documentation" description="HTML documentation." + selected="(!choices.uninstall.selected && choices['rust-docs'].selected) || (choices.uninstall.selected && choices.install.selected)" + > + <pkg-ref id="org.rust-lang.rust-docs"/> + </choice> + <!-- tool-rls-start --> + <choice id="rls" visible="true" + title="RLS" description="RLS, the Rust Language Server" + selected="(!choices.uninstall.selected && choices['rls'].selected) || (choices.uninstall.selected && choices.install.selected)" + start_selected="false" + > + <pkg-ref id="org.rust-lang.rls"/> + <pkg-ref id="org.rust-lang.rust-analysis"/> + </choice> + <!-- tool-rls-end --> + <pkg-ref id="org.rust-lang.rustc" version="0" onConclusion="none">rustc.pkg</pkg-ref> + <pkg-ref id="org.rust-lang.cargo" version="0" onConclusion="none">cargo.pkg</pkg-ref> + <pkg-ref id="org.rust-lang.rust-docs" version="0" onConclusion="none">rust-docs.pkg</pkg-ref> + <pkg-ref id="org.rust-lang.rust-std" version="0" onConclusion="none">rust-std.pkg</pkg-ref> + <!-- tool-rls-start --> + <pkg-ref id="org.rust-lang.rls" version="0" onConclusion="none">rls.pkg</pkg-ref> + <!-- tool-rls-end --> + <pkg-ref id="org.rust-lang.rust-analysis" version="0" onConclusion="none">rust-analysis.pkg</pkg-ref> + <pkg-ref id="org.rust-lang.uninstall" version="0" onConclusion="none">uninstall.pkg</pkg-ref> + <background file="rust-logo.png" mime-type="image/png" + alignment="bottomleft"/> +</installer-gui-script> 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 |