-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
39 lines (30 loc) · 1.06 KB
/
install.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Deprecation return
printf "This script is deprecated until migration to pyinstaller is completed\n use install-alias.sh instead\n"
exit 0
# mkdir user bin folder and move script in
[ -d ~/bin/ ] || mkdir ~/bin/
cp previewer.pyz ~/bin/preview
# give execution permissions
chmod +x ~/bin/preview
status_msg="was installed correctly"
#if grep -Fxq "$FILENAME" ~/.bashrc
if grep -Fxq "export PATH=\"\$PATH:\$HOME/bin\"" ~/.bashrc || grep -Fxq "export PATH=\"\$HOME/bin:\$PATH\"" ~/.bashrc
then
# code if found
echo "\$HOME/bin found in \$PATH, leaving as is"
else
printf '$HOME/bin not found in $PATH. Would you like to add it (in .bashrc) (y/n)? '
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;
then
echo "Adding PATH export to ~/.bashrc"
echo "export PATH=\"\$PATH:\$HOME/bin\"" >> ~/.bashrc
else
status_msg="may not be installed correctly"
fi
fi
echo "previewer $status_msg, check it with command preview"
#source "$HOME/.bashrc"
exec bash # workaround to reload bashrc, source command not work from inside script
exit 0