-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·190 lines (172 loc) · 9 KB
/
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
#
#
# `-:/ossyhhhdddhhyyso+:-`
# .:oydNMMMMMMMMMMMMMMMMMMMMMMMMNmyo/.
# `-+hNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNho:`
# .+yNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNh+-
# .+dNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmo-
# :hNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNd/`
# `+mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmo.
# `+mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNs.
# /mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNo`
# -hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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MMMMMM+
# hMMMMMMMMMMMMMMMMMMMMMMMMMy `mMMMMMMMMMMMMMMMMMm`
# .NMMMMMMMMMMMMMMMMMMMMMMMMyyy- `yMMMMMMMMMMMMMMMM:
# /MMMMMMMMMMMMMMMMMMMMMMMMMMMh +yMMMMMMMMMMMMMMMs
# sMMMMMMMMMMMMMMMMMMMMMMMMMMm .mMMMMMMMMMMMMMMd`
# yMMMMMMMMMMMMMMMMMMMMMMMMMd+yo` sMMMMMMMMMMMMMd`
# `yMMMMMMMMMMMMMMMMMMMMMMMMMMMd` mMMMMMMMMMMMMd`
# oMMMMMMMMMMMMMMMMMMMMMMNh+-` /MMMMMMMMMMMMy`
# /NMMMMMMMMMMMMMMMMMNh/` .oyyhMMMMMMMMMMNo
# .hMMMMMMMMMMMMMMNy- ./yNMMMMMMMMMMMMMd-
# `/mMMMMMMMMMMMh- :NMMMMMMMMMMMMMMNo`
# .oNMMMMMMMN+` `:oo+dMMMMMMMMMMMMMNy.
# .smMMMMd- ./ymMMMMMMMMMMMMMMMMNy-
# .odMy` -mMMMMMMMMMMMMMMMMms-
# `-` `.:+hh: -mMMMMMMMMMMMMNh/.
# ``.-:+shdNMMMMNs. .hMMMMMMMMmh+-
# +yhdmmmmmmmmmmmmmh: `+osydds:.
# `.................`
#
#
# D R A G O N H A C K L J U B L J A N A
#
# 2 0 1 5
# Author: Žiga Pirih
#
# Namestitveni skript za punishell / Install script for punishell
#
#
#Jezik: angleški (if stavkovje se nanaša na to)
LANG=en_US.UTF-8
# BARVE/ Colors, courtesy of ArchWiki.
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
#INSTALL DIR
extra_rc=""
echo "#\!/bin/bash" > /tmp/punishell_install_sudoers.sh
echo "echo \"$(whoami) ALL=(ALL) NOPASSWD: /bin/poweroff,/usr/bin/poweroff,/bin/poweroff\" >> /etc/sudoers" >> /tmp/punishell_install_sudoers.sh
chmod +x /tmp/punishell_install_sudoers.sh
printf "At the moment, this can only be installed for single (current) user\n"
printf "\nInstallation will make the following changes:\n"
printf " * create -p new folder in your home dir: $Cyan"
printf ".scripts\n$Color_Off"
printf " * create -p new folder: $Cyan"
printf "~/.config/punishell$Color_Off\n"
printf " * The following lines appended to $Cyan.bashrc$Color_Off and $Cyan.profile$Color_Off:\n"
printf " - '$Yellow"
printf "PATH=\"$PATH:$HOME/.scripts,$HOME/.scripts/punishell\"$Color_Off\n"
printf "\n"
printf "\n$On_Yellow$Black"
printf "OPTIONAL: Do you want punishell to autostart? [Y/n]$Color_Off\n"
read choice
if echo $choice | grep -q -i "n" ; then
echo "Your loss."
else
extra_rc="punishell"
fi
printf "Not enabling this option is considered cheating, but we can let it slide\n"
printf "because enabling it can cause some concerns.\n"
printf "\n$On_Yellow$Black"
printf "\nEnable reboot on game lose? [Y/n]\n$Color_Off$Red"
printf "(NOTE: command 'reboot' needs sudo privileges. Choosing 'Y' will allow your"
printf "account to reboot your PC without password. You will also need to provide"
printf "your sudo password for this)$Color_Off"
if echo $choice | grep -q -i "n" ; then
echo "THE GAME - Your loss."
else
sudo bash /tmp/punishell_install_sudoers.sh
fi
rm /tmp/punishell_install_sudoers.sh
mkdir -p "$HOME/.scripts"
mkdir -p "$HOME/.config/punishell"
echo "PATH=\$PATH:$HOME/.scripts:$HOME/.scripts/punishell" >> $HOME/.bashrc
echo $extra_rc >> $HOME/.bashrc
echo "PATH=\$PATH:$HOME/.scripts:$HOME/.scripts/punishell" >> $HOME/.profile
cp -R config "$HOME/.config/punishell"
cp script "$HOME/.scripts/punishell"