aboutsummaryrefslogtreecommitdiff
path: root/distro/devuan.sh
blob: 8348ecf838825082a96991894353fbea67866798 (plain) (blame)
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
#!/bin/sh
# distro/devuan.sh
echo "This script is designed to be run twice, once as root ( e.g. 'su -' )"
echo "Then again as your normal user without sudo, it will call sudo as needed"
if [ "$(id -u)" -eq 0 ] ; then
  if ! grep -q 'EDITOR=' ~/.bashrc ; then
	echo "EDITOR=vi" >> ~/.bashrc
  fi
 echo '%sudo   ALL=(ALL:ALL) ALL' > /etc/sudoers.d/sudo_enable
 printf "Enter username to add to sudo group (enter to skip): "
 read -r _un
 if ! [ -z "$_un" ] ; then
   gpasswd -a "$_un" sudo
 else
  echo skipping...
 fi 
 touch /etc/.sudo_configured 
 echo "now run as a regular user"
 exit 0
else
	if ! [ -r /etc/.sudo_configured ] ; then
	  echo "Run as root first, then as a regular user"
	  exit 1
	fi
fi
set -ex

codedir="$HOME/scm/pub"
nvimdir="${codedir}/neovim-nvim"
_nvim_msg=0
okshdir="${codedir}/ibara-oksh"

dwmdir="${codedir}/x/dwm"
dwmStdir="${codedir}/x/st"
dwmDmenudir="${codedir}/x/dmenu"
dwmSesdir="${codedir}/x/session"

BRAVE="${BRAVE:-yes}"
NVIM="${NVIM:-yes}"
OKSH="${OKSH:-yes}"
PACKAGES="${PACKAGES:-yes}"
FONTS="${FONTS:-yes}"
DWM="${DWM:-no}"
RUSTICL="${RUSTICL:-yes}"
THUNDERBOLT="${THUNDERBOLT:-yes}"



if [ "$PACKAGES" = yes ] ; then
# Get rid of the CDROM source, lol
sudo sed -i '/cdrom:/d' /etc/apt/sources.list
 
sudo apt update

sudo apt install -y git curl \
	tmux \
	htop \
	neofetch \
	oathtool \
	pavucontrol \
	scdaemon \
	vim \
	evemu-tools \
	evtest \
	libarchive-tools \
	evolution \
	gimp \
	git-lfs \
	ncdu \
	nload \
	pv \
	pwgen \
	ripgrep \
	wireguard-tools \
	zstd \
	dunst \
	xclip \
	restic \
	tree \
	feh \

fi

if [ "$THUNDERBOLT" = "yes" ] ; then
cat > /etc/udev/rules.d/99-removable.rules <<EOF
# /etc/udev/rules.d/99-removable.rules
ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{authorized}=="0", ATTR{authorized}="1"
EOF
fi

if [ "$RUSTICL" = "yes" ] ; then
	sudo apt install -y \
		mesa-opencl-icd

	printf "\033[1;32m"
	echo "Note, for GPU accelerated darktable with RustiCL you may need to:"
	echo "export RUSTICL_ENABLE=radeonsi; darktable -d opencl"
	echo "or similar, for intel change radeonsi to 'iris'"
	printf "\033[0m"
fi

if [ "$NVIM" = yes ] ; then
	sudo apt build-dep -y neovim

	if ! [ -d "$nvimdir" ] ; then
		git clone https://github.com/neovim/neovim "$nvimdir"
	fi
	cd "$nvimdir"
	git fetch --force --tags
	git checkout v0.11.2
	rm -rf build || echo ""
	make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local" -j"$(nproc)"
	make install
	cd -

	_paq_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim
	if ! [ -d "$_paq_dir" ] ; then
		git clone --depth=1 https://github.com/savq/paq-nvim.git "$_paq_dir"
		_nvim_msg=1
	fi
fi

if [ "$OKSH" = yes ] ; then
	if ! [ -d "$okshdir" ] ; then
		git clone https://github.com/ibara/oksh "$okshdir"
	fi
	cd "$okshdir"
	git checkout oksh-7.6
	./configure
	make
	sudo make install
	cd -

	if ! grep /usr/local/bin/oksh /etc/shells ; then
		sudo sh -c 'echo /usr/local/bin/oksh >> /etc/shells'
	fi

	if ! grep -qF 'export ENV=$HOME/.kshrc' ~/.profile; then
		echo 'export ENV=$HOME/.kshrc' >> ~/.profile
    fi

	set +x
	if ! grep ^$(id -un) /etc/passwd | grep /usr/local/bin/oksh ; then
		printf "Change shell to oksh? [y]es/[n]o: "
		read -r resp
		if [ "$resp" = "y" ] ; then
			chsh -s /usr/local/bin/oksh
		fi
	fi
	set -x


fi

if [ "$BRAVE" = yes ] ; then
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg \
       	https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg

sudo curl -fsSLo /etc/apt/sources.list.d/brave-browser-release.sources \
	https://brave-browser-apt-release.s3.brave.com/brave-browser.sources

sudo apt update

sudo apt install -y brave-browser

fi

if [ "$FONTS" = yes ] ; then
	if ! [ -d ~/.fonts ]; then
		git clone https://git.riedstra.dev/mitch/fonts ~/.fonts
	fi
	sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf || echo ""
fi

if [ "$DWM" = yes ] ; then
	sudo apt -y install compton
	sudo apt -y build-dep dwm st

	if ! [ -d "$dwmdir" ] ; then
		git clone https://git.riedstra.dev/x/dwm "$dwmdir"
	fi
	cd "$dwmdir"
	make
	sudo make clean install
	cd -

	if ! [ -d "$dwmStdir" ] ; then
		git clone https://git.riedstra.dev/x/st "$dwmStdir"
	fi
	cd "$dwmStdir"
	make
	sudo make clean install
	cd -

	if ! [ -d "$dwmDmenudir" ] ; then
		git clone https://git.riedstra.dev/x/dmenu "$dwmDmenudir"
	fi
	cd "$dwmDmenudir"
	make
	sudo make clean install
	cd -

	if ! [ -d "$dwmSesdir" ] ; then
		git clone https://git.riedstra.dev/x/session "$dwmSesdir"
	fi
	cd "$dwmSesdir"
	sudo make install
	cd -

	if ! [ -f ~/.xinitrc ] ; then
cat > ~/.xinitrc <<EOF
export ENV=\$HOME/.kshrc
dwm
EOF
	chmod +x ~/.xinitrc
	fi

fi

if [ $_nvim_msg -eq 1 ] ; then
	printf "\033[1;31m%s\033[0m\n" "You will need to run ':PacSync' in neovim"
fi