-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharch-config.sh
More file actions
209 lines (179 loc) · 4.81 KB
/
arch-config.sh
File metadata and controls
209 lines (179 loc) · 4.81 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env bash
# SCRIPT: arch-config.sh
# AUTHOR: Ritchie J Latimore
# DATE: 2015-01-03
# Rev: 0.0.1a
#
# REV LIST: 0.0.2a
# PLATFORM: arch, archbang
# PURPOSE: workstation/server setup on arch & archbang linux
##########################################################
# DEFINE FILES AND VARIABLES HERE
##########################################################
mirlst="/etc/pacman.d/mirrorlist"
mirlst_bk="/etc/pacman.d/mirrorlist.backup"
haskell_core_key="4209170B"
openrc_eudev_key="518B147D"
aur_sh_url="https://github.com/stuartpb/aur.sh/archive/master.zip"
# Set up the correct echo command usage. Many Linux # distributions will execute in Bash even if the
# script specifies Korn shell. Bash shell requires # we use echo -e when we use \n, \c, etc.
case $SHELL in
*/bin/bash) alias echo="echo -e"
;;
esac
##########################################################
# DEFINE FUNCTIONS HERE
##########################################################
function reflector_mirrorlist
{
sudo pacman -Syy
sudo pacman -Syu
sudo pacman -S reflector
sudo cp $mirlst $mirlst_bk
sudo sed -i 's/^#Server/Server/' $mirlst_bk
sudo reflector --verbose --country 'United States' -l 200 -p http --sort rate —-save $mirlst
sudo wait ?!
}
function devenv_init
{
sudo pacman -S --needed base-devel git cvs cvsps perl-libwww perl-term-readkey perl-mime-tools perl-net-smtp-ssl perl-authen-sasl subversion rsync fakeroot net-tools linux-headers
sudo wait ?!
}
function dirmngr_pacman_key_init
{
sudo dirmngr > /dev/null 2>&1 &
sudo wait ?!
sudo pacman-key --init
sudo wait ?!
sudo pacman-key --populate
sudo wait ?!
}
function add_haskell_core_repo
{
sudo sed -i '/\[extra\]/i \
\[haskell\-core\] \
Server\ \=\ http\:\/\/xsounds\.org\/\~haskell\/core\/\$arch\n' /etc/pacman.conf
sudo pacman-key -r $haskell_core_key
sudo wait ?!
sudo pacman-key --lsign-key $haskell_core_key
sudo wait ?!
sudo pacman -Syu
sudo wait ?!
}
function add_openrc_eudev_repo
{
sudo sed -i '/\[extra\]/i \
\[openrc-eudev\] \
SigLevel\ \=\ Optional\ TrustAll \
Server\ \=\ https\:\/\/downloads\.sourceforge\.net\/projects\/mefiles\/Manjaro\/\$repo\/\$arch\n'
sudo pacman-key -r $openrc_eudev_key
sudo wait ?!
sudo pacman-key --lsign-key $openrc_eudev_key
sudo wait ?!
sudo pacman -Syu
sudo wait ?!
}
function aur_sh_init
{
cd /tmp
sudo wget $aursh_url
sudo unzip /tmp/master.zip
cd /tmp/aur.sh-master
if [ ! -x aur.sh ]
then
sudo chmod +x /tmp/aur.sh-master/aur.sh
fi
if [ ! -x alt-aur.sh ]
then
sudo chmod +x /tmp/aur.sh-master/alt-aur.sh
fi
cd `mktemp -d`
cp /tmp/aur.sh-master/aur.sh .
}
function aura_bin_init
{
aura_sh_init
bash <(curl aur.sh) -si aura-bin
}
function aura_src_init
{
aura_sh_init
wait ?!
sudo pacman -S --needed ghc
sudo pacman -S --needed haskell-regex-base haskell-parsec haskell-syb haskell-mtl haskell-json haskell-temporary
bash <(curl aur.sh) -si haskell-regex-pcre-builtin haskell-http-conduit haskell-reflection haskell-lens haskell-lens-aeson haskell-psqueue haskell-wreq haskell-aur aura
}
function openrc_init
{
sudo aura -S openrc-base
sudo aura -S openrc-desktop
sudo aura -S networkmanager-openrc alsa-utils-openrc acpid-openrc
sudo rc-update add acpid default
sudo aura -S pm-utils consolekit-openrc
sudo aura -S eudev-openrc eudev eudev-systemdcompat upower-pm-utils-eudev
}
function rotate_line
{
INTERVAL=1 # Sleep time between "twirls"
TCOUNT=0 # For each TCOUNT the line twirls one increment
while : # Loop forever...until this function is killed
do
TCOUNT=`expr $TCOUNT + 1`
case $TCOUNT in
"1") echo ’-’"\b\c"
sleep $INTERVAL
;;
"2") echo ’\\’"\b\c"
sleep $INTERVAL
;;
"3") echo "\|\b\c"
sleep $INTERVAL
;;
"4") echo "/\b\c"
sleep $INTERVAL
;;
*) TCOUNT="0" ;; # Reset the TCOUNT to "0", zero.
esac
done
}
function trap_exit
{
# Tell the co-process to break out of the loop
BREAK_OUT=’Y’
print -p $BREAK_OUT # Use "print -p" to talk to the co-process
}
function proc_watch
{
# This function is started as a co-process!!!
while : # Loop forever
do
# some stuff to do
read $BREAK_OUT # Do NOT need a "-p" to read!
if [[ $BREAK_OUT = ’Y’ ]]
then
return 0
fi
done
}
##########################################################
# BEGINNING OF MAIN
##########################################################
### Set a Trap ###
#trap ’trap_exit; exit 2’ 1 2 3 15
main() {
#rotate_line & # Run the function in the background
#ROTATE_PID=$! # Capture the PID of the last background process
reflector_mirrorlist
devenv_init
dirmngr_pacman_key_init
add_haskell_core_repo
add_openrc_eudev_repo
aur_sh_init
aura_bin_init
openrc_init
}
main
#BREAK_OUT=’N’
#proc_watch |& # Start proc_watch as a co-process!!!!
#PW_PID=$1 # Process ID of the last background job
# End of script