forked from waldyr/sublime-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sublime_installer.sh
66 lines (51 loc) · 1.84 KB
/
sublime_installer.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
shopt -s nocaseglob
set -e
script_runner=$(whoami)
sublime_installer_path=$(cd && pwd)/sublime_installer
log_file="$sublime_installer_path/install.log"
control_c()
{
echo -en "\n\n*** Exiting ***\n\n"
exit 1
}
trap control_c SIGINT
clear
echo "#######################################"
echo "########## Sublime Installer ##########"
echo "#######################################"
# determine the distro
if [[ $MACHTYPE = *linux* ]] ; then
distro_sig=$(cat /etc/issue)
if [[ $distro_sig =~ ubuntu ]] ; then
distro="ubuntu"
else
echo -e "\nSublime Installer currently only supports Ubuntu\n"
exit 1
fi
fi
# check if user is root
if [ $script_runner == "root" ] ; then
echo -e "\nThis script must be run as a normal user with sudo privileges\n"
exit 1
fi
echo -e "\n\n"
echo "run tail -f $log_file in a new terminal to watch the install"
echo -e "\n"
echo "What this script gets you:"
echo " * Sublime Text Editor"
echo " * Sublime's Custom Icon"
echo " * Package Control"
echo " * Emmet (Old Zen Coding)"
echo -e "\nThis script is always changing."
echo "Make sure you got it from https://github.com/waldyr/Sublime-Installer"
# Check if the user has sudo privileges.
sudo -v >/dev/null 2>&1 || { echo $script_runner has no sudo privileges ; exit 1; }
echo -e "\n=> Creating install dir..."
cd && mkdir -p sublime_installer/src && cd sublime_installer && touch install.log
echo "==> done..."
echo -e "\n=> Downloading and running recipe for $distro...\n"
wget --no-check-certificate -O $sublime_installer_path/src/$distro.sh https://raw.github.com/waldyr/Sublime-Installer/master/recipes/$distro.sh && cd $sublime_installer_path/src && bash $distro.sh $sublime_installer_path $log_file
echo -e "\n#################################"
echo "### Installation is complete! ###"
echo -e "#################################\n"