1
1
#! /bin/bash
2
2
set -e
3
3
4
- echo " *** Running post install script for __NAME__ ..."
5
-
6
- cat << EOF
7
- * __PKG_NAME_LOWER__
8
- * __NAME__
9
- * __VERSION__
10
- * __CHANNELS__
11
- * __WRITE_CONDARC__
12
- * __SHORTCUTS__
13
- * __DEFAULT_PREFIX__
14
- * __LICENSE__
15
- * __FIRST_PAYLOAD_SIZE__
16
- * __SECOND_PAYLOAD_SIZE__
17
- * __MD5__
18
- * __INSTALL_COMMANDS__
19
- * __PLAT__
20
- * __NAME_LOWER__
21
- EOF
4
+ echo " *** Running post install script for ${INSTALLER_NAME} ..."
22
5
23
6
echo " Args = $@ "
24
7
echo " $( declare -p) "
25
8
26
- if [[ $OSTYPE == " darwin" * ]]; then
27
- # macOS
28
- ENV_PREFIX=$( cd " ${PREFIX} /envs/__NAME_LOWER__" ; pwd)
29
- shortcut_path=" $( dirname ${DSTROOT} ) /Applications/__NAME__.app"
9
+ name_lower=${INSTALLER_NAME,,}
10
+ _shortcut_path=" $HOME /.local/share/applications/${name_lower} _${name_lower} .desktop"
11
+ shortcut_path=" $( dirname ${_shortcut_path} ) /${name_lower} .desktop"
12
+ if [[ -e ${_shortcut_path} ]]; then
13
+ echo " Renaming ${_shortcut_path} ..."
14
+ mv -f " ${_shortcut_path} " " ${shortcut_path} "
15
+ else
16
+ echo " ${_shortcut_path} does not exist"
17
+ fi
18
+
19
+ case $SHELL in
20
+ (* " zsh" ) shell_init=$HOME /.zshrc ;;
21
+ (* " bash" ) shell_init=$HOME /.bashrc ;;
22
+ esac
23
+ spyder_exe=$( echo ${PREFIX} /envs/* /bin/spyder)
30
24
31
- if [[ -e " $shortcut_path " ]]; then
32
- echo " Creating python symbolic link..."
33
- ln -sf " ${ENV_PREFIX} /bin/python" " $shortcut_path /Contents/MacOS/python"
34
- else
35
- echo " ERROR: $shortcut_path does not exist"
36
- exit 1
37
- fi
38
25
26
+ if [[ ! -e " $spyder_exe " ]]; then
27
+ echo " $spyder_exe not found. Alias not created."
28
+ elif [[ -z " $shell_init " ]]; then
29
+ echo " Aliasing for $SHELL not implemented."
39
30
else
40
- # Linux
41
- name_lower=${INSTALLER_NAME,,}
42
- _shortcut_path=" $HOME /.local/share/applications/${name_lower} _${name_lower} .desktop"
43
- shortcut_path=" $( dirname ${_shortcut_path} ) /${name_lower} .desktop"
44
- if [[ -e ${_shortcut_path} ]]; then
45
- echo " Renaming ${_shortcut_path} ..."
46
- mv -f " ${_shortcut_path} " " ${shortcut_path} "
47
- else
48
- echo " ${_shortcut_path} does not exist"
49
- fi
50
-
51
- spyder_exe=$( echo ${PREFIX} /envs/* /bin/spyder)
52
- if [[ -e " $spyder_exe " ]]; then
53
- case $SHELL in
54
- (* " zsh" ) init_file=$HOME /.zshrc ;;
55
- (* " bash" ) init_file=$HOME /.bashrc ;;
56
- esac
57
- echo " Aliasing Spyder's executable in $init_file ..."
58
- sed -i " /alias spyder=/{h;s|=.*|=${spyder_exe} |};\$ {x;/^$/{s||\nalias spyder=${spyder_exe} |;H};x}" $init_file
59
- else
60
- echo " $spyder_exe not found. Alias not created."
61
- fi
62
-
63
- echo " Creating uninstall script..."
64
- cat << EOF > ${PREFIX} /uninstall.sh
31
+ echo " Aliasing Spyder's executable in $shell_init ..."
32
+ sed -i " /alias spyder=/{h;s|=.*|=${spyder_exe} |};\$ {x;/^$/{s||\nalias spyder=${spyder_exe} |;H};x}" $shell_init
33
+ fi
34
+
35
+ echo " Creating uninstall script..."
36
+ cat << EOF > ${PREFIX} /uninstall.sh
65
37
#!/bin/bash
66
38
rm -rf ${shortcut_path}
67
39
rm -rf ${PREFIX}
68
40
EOF
69
- chmod +x ${PREFIX} /uninstall.sh
41
+ chmod +x ${PREFIX} /uninstall.sh
70
42
71
- cat << EOF
43
+ cat << EOF
72
44
73
45
###############################################################################
74
46
Spyder can be launched by standard methods in Gnome and KDE desktop
@@ -90,6 +62,4 @@ $ ${PREFIX}/uninstall.sh
90
62
91
63
EOF
92
64
93
- fi
94
-
95
- echo " *** Post install script for __NAME__ complete"
65
+ echo " *** Post install script for ${INSTALLER_NAME} complete"
0 commit comments