-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
132 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,72 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "*** Starting post install script for __NAME__.app" | ||
|
||
cat <<EOF | ||
* __PKG_NAME_LOWER__ | ||
* __NAME__ | ||
* __VERSION__ | ||
* __CHANNELS__ | ||
* __WRITE_CONDARC__ | ||
* __SHORTCUTS__ | ||
* __DEFAULT_PREFIX__ | ||
* __LICENSE__ | ||
* __FIRST_PAYLOAD_SIZE__ | ||
* __SECOND_PAYLOAD_SIZE__ | ||
* __MD5__ | ||
* __INSTALL_COMMANDS__ | ||
* __PLAT__ | ||
* __NAME_LOWER__ | ||
EOF | ||
echo "*** Running post install script for ${INSTALLER_NAME} ..." | ||
|
||
echo "Args = $@" | ||
echo "$(declare -p)" | ||
|
||
ENV_PREFIX=$(cd "${PREFIX}/envs/__NAME_LOWER__"; pwd) | ||
app_path="$(dirname ${DSTROOT})/Applications/__NAME__.app" | ||
name_lower=${INSTALLER_NAME,,} | ||
_shortcut_path="$HOME/.local/share/applications/${name_lower}_${name_lower}.desktop" | ||
shortcut_path="$(dirname ${_shortcut_path})/${name_lower}.desktop" | ||
if [[ -e ${_shortcut_path} ]]; then | ||
echo "Renaming ${_shortcut_path}..." | ||
mv -f "${_shortcut_path}" "${shortcut_path}" | ||
else | ||
echo "${_shortcut_path} does not exist" | ||
fi | ||
|
||
case $SHELL in | ||
(*"zsh") shell_init=$HOME/.zshrc ;; | ||
(*"bash") shell_init=$HOME/.bashrc ;; | ||
esac | ||
spy_exe=$(echo ${PREFIX}/envs/*/bin/spyder) | ||
u_spy_exe=${PREFIX}/uninstall-spyder.sh | ||
|
||
if [[ -e "$app_path" ]]; then | ||
echo "Creating python symbolic link..." | ||
ln -sf "${ENV_PREFIX}/bin/python" "$app_path/Contents/MacOS/python" | ||
if [[ ! -e "$spy_exe" ]]; then | ||
echo "$spy_exe not found. Alias not created." | ||
elif [[ -z "$shell_init" ]]; then | ||
echo "Aliasing for $SHELL not implemented." | ||
else | ||
echo "ERROR: $app_path does not exist" | ||
exit 1 | ||
echo "Aliasing Spyder's executable in $shell_init ..." | ||
m1="# <<<< Added by Spyder <<<<" | ||
m2="# >>>> Added by Spyder >>>>" | ||
new_text="$m1\nalias spyder=${spy_exe}\nalias uninstall-spyder=${u_spy_exe}\n$m2" | ||
sed -i "/$m1/,/$m2/{h;/$m2/ s|.*|${new_text}|; t; d};\${x;/^$/{s||\n${new_text}|;H};x}" $shell_init | ||
fi | ||
|
||
echo "*** Post install script for __NAME__.app complete" | ||
echo "Creating uninstall script..." | ||
cat <<EOF > ${u_spy_exe} | ||
#!/bin/bash | ||
rm -rf ${shortcut_path} | ||
rm -rf ${PREFIX} | ||
EOF | ||
if [[ -n "$shell_init" ]]; then | ||
# Remove aliases from shell startup | ||
echo "sed -i '/$m1/,/$m2/d' $shell_init" >> ${u_spy_exe} | ||
fi | ||
chmod +x ${u_spy_exe} | ||
|
||
cat <<EOF | ||
############################################################################### | ||
Spyder can be launched by standard methods in Gnome and KDE desktop | ||
environments. Additionally, Spyder can be launched in Gtk-based desktop | ||
environments (e.g. Xfce) from the command line: | ||
$ gtk-launch spyder | ||
Spyder can also be launched from the command line for all Linux variants | ||
by: | ||
$ spyder | ||
To uninstall Spyder, you need to run from the following from the command line: | ||
$ uninstall-spyder | ||
############################################################################### | ||
EOF | ||
|
||
echo "*** Post install script for ${INSTALLER_NAME} complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters