summaryrefslogtreecommitdiff
path: root/install
blob: 761894e75d0d4ed9482133d321fca6d39eb74643 (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
#!/bin/sh

#
# Distro dots install list
#

arch()
{
	echo "######################"
	echo "# dotfiles Installer #"
	echo "######################"
	echo "|   for Arch Linux   |"
	echo "**********************"

	# Setting system distro
	sed -i s:REPLACEME:arch:g .zprofile

	# Installing opendoas
	sudo pacman -Syu --needed opendoas

	# Updated doas permissions
	sudo cp -rf ".local/etc/doas.conf" "/etc/"
	doas cp -rf ".local/etc/hosts" "/etc/"

	# Installing Deps
	doas pacman -Rnsc vim
	doas pacman --needed -Syu screenfetch zsh youtube-dl engrampa nmap ncmpcpp xwallpaper newsboat vifm zathura tk maim ffmpeg texlive-most pcmanfm lxappearance ntp redshift numlockx htop xclip imagemagick transmission-gtk neovim mpv mpd mpc sxiv zathura-pdf-mupdf zathura-ps python-pywal r pandoc-citeproc qutebrowser python python-pip python2 python2-pip ccache automake lzop bison gperf zip curl python-networkx squashfs-tools libxml2 pngcrush schedtool make bc android-tools jdk8-openjdk java8-openjfx gimp audacity kdenlive frei0r-plugins breeze-icons vlc inkscape unzip unarchiver arandr shellcheck arc-gtk-theme linux-firmware atom ctags unoconv picom nodejs yarn p7zip gzip tar xz papirus-icon-theme neomutt isync uncrustify lsd valgrind doxygen gdb light

	# Install Computer Science Programs
	printf "Do yo want to install Computer Science Programs? [Y/n]" && read -r CS
	if [ "$CS" != "N" ] && [ "$CS" != "n" ]; then
		doas pacman --needed --noconfirm -Syu jdk11-openjdk java11-openjfx intellij-idea-community-edition valgrind doxygen gdb mysql-workbench octave && clear
	fi

	# Install Extra AUR packages
	printf "Do yo want to setup extra AUR packages? [Y/n]" && read -r AUR
	if [ "$AUR" != "N" ] && [ "$AUR" != "n" ]; then
		yay --needed -Syu lbry-app-bin xorg-transset cordless-git
	fi

	# Cleanup
	doas pacman --noconfirm -Scc
}

gentoo()
{
	echo "######################"
	echo "# dotfiles Installer #"
	echo "######################"
	echo "|  for Gentoo Linux  |"
	echo "**********************"

	# Checking if is root
	if [ "$(id -u)" != "0" ]; then
		# Setting system distro
		sed -i s:REPLACEME:gentoo:g .zprofile
		echo "This script now, must be run as root" 1>&2
		exit 1
	fi

	printf "Do you want to install Base Packages? [Y/n]" && read -r BASE
	if [ "$BASE" != "N" ] && [ "$BASE" != "n" ]; then
		emerge --ask --quiet xwallpaper x11-misc/xclip vifm zathura zathura-pdf-poppler zip wget make bc unar xorg-x11 xinit zsh pm-utils doas sys-fs/dosfstools app-editors/neovim alsa-lib alsa-plugins light
	fi

	printf "Do you want to install Extra Packages? [Y/n]" && read -r EXTRA
	if [ "$EXTRA" != "N" ] && [ "$EXTRA" != "n" ]; then
		FEATURES="splitdebug" emerge --oneshot sys-libs/glibc
		emerge --ask --quiet sxiv mpv youtube-dl ncmpcpp mpc mpd tk ntfs3g redshift numlockx R pandoc-citeproc android-tools shellcheck app-admin/system-config-printer texlive-latex net-libs/nodejs mail-client/neomutt net-mail/isync firefox-bin libreoffice-bin unoconv dev-util/ctags gimp imagemagick lsd transset picom net-misc/ntp maim
	fi

}

openbsd()
{
	echo "######################"
	echo "# dotfiles Installer #"
	echo "######################"
	echo "|    for OpenBSD     |"
	echo "**********************"

	sed -i s:REPLACEME:openbsd:g .zprofile
	pkg_add neovim git neofetch firefox gimp zsh newsboat zathura ffmpeg maim xwallpaper xclip redshift mpv ncmpcpp ImageMagick gdb valgrind doxygen unoconv sxiv mpc ccache ntp htop zip numlockx shellcheck unzip mc node
}

void()
{
	echo "######################"
	echo "# dotfiles Installer #"
	echo "######################"
	echo "|   for Void Linux   |"
	echo "**********************"

	# Setting system distro
	sed -i s:REPLACEME:void:g .zprofile

	# Installing opendoas
	sudo xbps-install opendoas

	# Updated doas permissions
	sudo cp -rf ".local/etc/doas.conf" "/etc/"
	doas cp -rf ".local/etc/hosts" "/etc/"

	# Installing apps
	doas xbps-install xorg git neovim opendoas qutebrowser ncmpcpp neofetch zsh pkg-config xwallpaper picom NetworkManager NetworkManager-devel ImageMagick kdenlive gimp lxappearance ffmpeg mpv vifm make gcc libXft-devel libXinerama-devel libX11-devel webkit2gtk webkit2gtk-devel engrampa zathura zathura-pdf-poppler ctags maim unoconv neomutt isync nodejs curl wget R void-repo-multilib pywal android-tools openjdk8 xz papirus-icon-theme unzip unar p7zip arc-theme numlockx alsa-lib alsa-utils lutris shellcheck redshift ntfs-3g git sxiv mpc mpd tar uncrustify texlive-bin xclip transset lsd light  psmisc void-linux-nonfree void-linux-multilib void-linux-nonfree-multilib

	# Install Computer Science Programs
	printf "Do yo want to install Computer Science Programs? [Y/n]" && read -r CS
	if [ "$CS" != "N" ] && [ "$CS" != "n" ]; then
		doas xbps-install -Su openjdk11 intellij-idea-community-edition valgrind doxygen gdb octave && clear
	fi

	# Removing Old dhcpcd entries from boot
	sudo rm -rf /var/service/dhcp*

	# Adding Services to boot
	sudo ln -s /etc/sv/NetworkManager /var/service/
	sudo ln -s /etc/sv/dbus /var/service
}

baseInstall(){
	# Setting Vars
	CURDIR=$(pwd)

	#Preparing Dirs and Files for dotfiles
	cp -rf .config "$HOME"
	cp -rf .local "$HOME"
	cp -rf .xinitrc "$HOME"
	cp -rf .xprofile "$HOME"
	cp -rf .zprofile "$HOME"
	mkdir -p ~/Documents/PDF
	mkdir -p ~/Documents/Markdown
	mkdir -p ~/Documents/Disks
	mkdir -p ~/Documents/Archives
	mkdir -p ~/Downloads
	mkdir -p ~/Pictures/Screenshots
	mkdir -p ~/Pictures/GIMP
	mkdir -p ~/Videos/Recordings
	mkdir -p ~/Source
	mkdir -p ~/.config/git
	mkdir -p ~/.config/gnupg
	mkdir -p ~/.config/wallpaper

	## Run Suckless Script
	cd ~/.local/src/suck/ || exit
	sh sucklessUpdate
	cd "$CURDIR" || exit

	if [ "$OS" != 3 ]; then
		{
			# Fixing Java Programs on Window Managers
			doas sh -c 'echo "export _JAVA_AWT_WM_NONREPARENTING=1" >>/etc/profile.d/jre.sh'

			# Changing default shell to zsh
			chsh -s /bin/zsh
		}
	fi

	# Setting up Neovim
	## Linking Neovim to Vim
	ln -s /usr/bin/nvim ~/.local/bin/vim

	## Installing Neovim Plugin Manager (Vim Plug)
	curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
		https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

	## Installing Plugins
	nvim -c PlugInstall

	## Installing Spell Checker
	nvim -c setlocal spell spelllang=pt_pt

	# Cleanup
	rm -rf ~/.local/etc ~/.local/usr
}

postInstall()
{
	# Setup Git account
	printf "Do yo want to setup Git account? [Y/n]" && read -r GIT
	if [ "$GIT" != "N" ] && [ "$GIT" != "n" ]; then
		printf "Username: " && read -r USER
		printf "Email: " && read -r EMAIL
		git config --global user.name "$USER"
		git config --global user.email "$EMAIL"
	fi

	# Setup atom
	printf "Do yo want to install Atom packages? [Y/n]" && read -r ATOM
	if [ "$ATOM" != "N" ] && [ "$ATOM" != "n" ]; then
		apm install atom-beautify file-icons pigments teletype atom-doxit highlight-selected platformio-ide-terminal vim-mode-plus
	fi

	# Setup flathub
	printf "Do yo want to install flatpak packages? [Y/n]" && read -r FLAT
	if [ "$FLAT" != "N" ] && [ "$FLAT" != "n" ]; then
		pkg i flatpak
		sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
		fi
	}

#
# Main Script
#

printf "Select a Operating System:\n1) Arch Linux\n2) Gentoo Linux\n3) OpenBSD\n4) Void Linux\n5) None\n-> " && read -r OS && clear

if [ -f /usr/local/bin/dwm ]; then
	{
		postInstall
	}
else
	{
		case "$OS" in
			1)
				arch && baseInstall
				;;
			2)
				gentoo && baseInstall
				;;
			3)
				openbsd && baseInstall
				;;
			4)
				void && baseInstall
				;;
			5)
				echo "None Selected"
				;;
			*)
				baseInstall
		esac
	}
fi