-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
63 lines (54 loc) · 1.55 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
echo "\
Hello $(whoami)!
This Dotfiles plugin installation script will do the following for you:
- Setup Git repository in you home folder. You will be asked to enter remote address, username, and email
- Write necessery files:
$ZSH_CUSTOM/plugins/dotfiles/dotfiles.plugin.zsh
~/.gitignore
~/.gitinclude
Should script start installation [y/n]?";
read isInstallationConfirmed
if [ $isInstallationConfirmed = "n" ]
then
echo "Plugin won't be installed"
elif [ $isInstallationConfirmed = "y" ]
then
echo "Installing..."
# curl plugin into oh-my-zsh
mkdir -p $ZSH_CUSTOM/plugins/dotfiles
curl -sL https://raw.githubusercontent.com/vladmyr/dotfiles-plugin/master/dotfiles.plugin.zsh -o $ZSH_CUSTOM/plugins/dotfiles/dotfiles.plugin.zsh
# write .gitignore & .gitinclude
echo "\
.zshrc
$ZSH_CUSTOM/themes/*
$ZSH_CUSTOM/plugins/*" > ~/.gitinclude
echo "\
/*
!.gitignore
!.gitinclude" > ~/.gitignore
# initialize git
git init ~
echo "Enter Git user name:"
read gitUsername
git config -f ~/.git/config user.name "$gitUsername"
echo "Enter Git email:"
read gitEmail
git config -f ~/.git/config user.email "$gitEmail"
echo "\
Installation complete!
Now make sure to enable plugin in .zshrc, eg:
plugins=(... dotfiles)
Afterwards execute
> source ~/.zshrc
> dotfiles -h
To verify plugin is installed correctly.
To uninstall the plugin revert change in .zshrc and execute:
> rm -rf .git .gitignore .gitinclude $ZSH_CUSTOM/plugins/dotfiles
"
else
echo "\
Unrecognised user input: $isInstallationConfirmed
Script terminated.
"
fi