summaryrefslogtreecommitdiff
path: root/configs/mate/root-image/root/.scriptsInstallation/language/en/install.sh
blob: 8ddead8c3443bd727bfbb9bc00ce39b399dab124 (plain)
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/bin/bash
#Temporal is a file that contains parameters to use when access to chroot

pacman -Sy parabola-keyring --noconfirm
pacman-key --populate parabola
pacman-key --refresh-keys

partition(){
	
	#Search and show the Hard Disks to select
	aux=$(ls /dev/sd?)
	index=0
	for i in $aux; do
		hdds[$index]="${i} ${i#/*/} off"
		index=$((index+1))	
	done

	hdd=$(dialog --stdout --radiolist "Select Hard Disk" 20 70 50 ${hdds[@]})
        
	#If exist the line delete
	if (cat ~/.scriptsInstallation/temporal | grep "hdd=") &>/dev/null
	then
 		sed -i -e '/hdd=*/d' ~/.scriptsInstallation/temporal
	fi

	#And add the new line with new parameter
	echo "hdd=$hdd" >> ~/.scriptsInstallation/temporal
	
	selection=$(dialog --stdout --menu "Partitioning method"  20 70 50 \
			1 "Use all disk with swap (1GB) and /" \
			2 "Use gparted to customize" )

	case $selection in
		1)
			umount /mnt &> /dev/null
			#Create msdos partition table
			parted -s $hdd -- mklabel msdos

			#Create partition swap and /
			parted -s $hdd -- mkpart primary 1MiB 1000MiB mkpart primary 1000MiB -1s
                        
                        #Boot option partition /
                        parted -s $hdd -- set 2 boot on

			#Format and partitions and mount /
			(echo t; echo 1; echo 82; echo w) | fdisk $hdd
			mkswap ${hdd}1
			mkfs.ext4 ${hdd}2
			mount ${hdd}2 /mnt
			;;
		2)	
			gparted $hdd

			#Search and show the partitions that select before.
			aux=$(ls $hdd?)
			index=0;
			for i in $aux; do
				partitions[$index]="${i} ${i#/*/} off"
				index=$((index+1))
			done

			partition=$(dialog --stdout --radiolist "Mount / Partition" 20 70 50 ${partitions[@]})
	
			#Mount partition /
			umount /mnt &> /dev/null
			mount $partition /mnt

			#Ask if you want mount other partitions
			other=0
			while [ $other != 3 ]; do
				other=$(dialog --stdout --menu "Mount other partition?" 20 70 50 1 "/home" 2 "/boot" 3 "No")
	
				case $other in
				1)
					umount /mnt/home &> /dev/null
					mkdir /mnt/home &> /dev/null
					mount $(dialog --stdout --radiolist "Mount /home Partition" 20 70 50 ${partitions[@]}) /mnt/home
					;;
				2)
					umount /mnt/boot &> /dev/null	
					mkdir /mnt/boot &> /dev/null
					mount $(dialog --stdout --radiolist "Mount /boot Partition" 20 70 50 ${partitions[@]}) /mnt/boot
					;;
				*)	
					other=3
					;;
				esac
			done
			;;
		esac	
}


option=0
while [ option != 7 ]; do
	option=$(dialog --stdout --menu "Parabola Installation CLI"  20 70 50 \
			1 "Format and Mount Partitions" \
			2 "Install Base System" \
			3 "Install GRUB" \
			4 "System Configure" \
			5 "Create User Account" \
			6 "(Optional) Install Live DVD Desktop/Applications" \
			7 "Exit" )

	case $option in
		1)
			partition
			;;
		2)	
			#Install base system
			pacstrap /mnt
			pacstrap /mnt dialog
			;;
		3)
			#Install grub
			pacstrap /mnt grub
			;;
		4)
			#Generate fstab and acces to chroot to do System Config
			genfstab -p /mnt >> /mnt/etc/fstab
			cp ~/.scriptsInstallation/temporal /mnt
			cp ~/.scriptsInstallation/systemConfig.sh /mnt
			chmod +x /mnt/systemConfig.sh
			arch-chroot /mnt /systemConfig.sh	
			rm -r /mnt/systemConfig.sh  
			;;
		5)	
			#Create a new username and save in temporal, to use after
			if (cat ~/.scriptsInstallation/temporal | grep "userName=") &>/dev/null
			then	
				sed -i -e '/userName=*/d' ~/.scriptsInstallation/temporal
			fi

			echo "userName=$(dialog --stdout --inputbox "Enter an User Name" 8 40)" >> ~/.scriptsInstallation/temporal
			cp ~/.scriptsInstallation/temporal /mnt
			cp ~/.scriptsInstallation/userAccount.sh /mnt
			chmod +x /mnt/userAccount.sh
			arch-chroot /mnt /userAccount.sh
			rm -r /mnt/userAccount.sh 
			;;
		6)
			#Packages to the X11 live
			packages=(	"xorg-server"
					"xf86-input-evdev"
					"xf86-input-synaptics"
					"xf86-video-vesa"
					"xf86-video-intel"
					"xf86-video-nouveau"
					"xf86-video-ati"
					"xf86-video-apm"
					"xf86-video-ark"
					"xf86-video-chips"
					"xf86-video-dummy"
					"xf86-video-fbdev"
					"xf86-video-glint"
					"xf86-video-i128"
					"xf86-video-i740"
					"xf86-video-intel"
					"xf86-video-mach64"
					"xf86-video-neomagic"
					"xf86-video-nv"
					"xf86-video-openchrome"
					"xf86-video-r128"
					"xf86-video-rendition"
					"xf86-video-s3"
					"xf86-video-s3virge"
					"xf86-video-savage"
					"xf86-video-siliconmotion"
					"xf86-video-sis"
					"xf86-video-sisusb"
					"xf86-video-tdfx"
					"xf86-video-trident"
					"xf86-video-tseng"
					"xf86-video-vmware"
					"xf86-video-voodoo"
					"xorg-xinit"
					"gst-plugins-good"
					"gst-libav"
					"mate"
					"mate-extra"
					"caja"
					"volumeicon"
					"zenity"
					"octopi"
					"ambiance-radiance-colors-suite"
					"rave-x-colors"
					"pulseaudio-alsa"
					"alsa-utils"
					"networkmanager"
					"network-manager-applet"
					"ath9k-htc-firmware"
					"gnome-keyring"
					"iceweasel"
					"icedove"
					"pidgin"
					"linphone"
					"qtox"
					"gparted"
					"smplayer"
					"epdfview"
					"gpicview"
					"abiword"
					"gnumeric"
					"leafpad"
					"galculator-gtk2"
					"xarchiver"
					)
			
			#Install packages			
			pacstrap /mnt ${packages[@]}
			user=$(cat ~/.scriptsInstallation/temporal | grep "userName" )
			
			#Copy skel in the new system and desktop's background
			cp -a /etc/skel/ /mnt/etc/
			cp -a /etc/wallpaper.png /mnt/etc/wallpaper.png

			#Puts the XKBMAP, start X11 automatically and icewm desktop
			echo "setxkbmap $(cat ~/.codecheck | grep XKBMAP= | cut -d '=' -f 2)" > /mnt/etc/skel/.xinitrc
			echo "exec mate-session" >> /mnt/etc/skel/.xinitrc
			echo "startx" >> /mnt/etc/skel/.bash_profile
			chmod +x /mnt/etc/skel/.xinitrc
			cp -a /mnt/etc/skel/.[a-z]* /mnt/home/${user#*=}/
			chmod -R 1000.100 /mnt/home/${user#*=}/
			cp -a ~/.scriptsInstallation/x11.sh /mnt

			#Enable services with systemd
			chmod +x /mnt/x11.sh
			arch-chroot /mnt /x11.sh 
			rm /mnt/x11.sh
			;;
		*)
			#Delete temporal file and umount partitions
			rm -r /mnt/temporal
			umount /mnt/boot &> /dev/null
			umount /mnt/home &> /dev/null
			umount /mnt &> /dev/null		
			exit
			;;
	esac
done