-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·153 lines (136 loc) · 4.61 KB
/
setup.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
#!/usr/bin/env bash
#
# +----------------------------------------------------------------------------+
# | setup.sh |
# +----------------------------------------------------------------------------+
# | Usage: Executed without any options |
# | Description: Setup script to compile and install suckless.X11 |
# | Requires: bash_framework.sh |
# | Notes: --- |
# | Author: Waldemar Schroeer |
# | Company: Rechenzentrum Amper |
# | Version: 4.1 |
# | Created: 05.12.2023 |
# | Revision: --- |
# | |
# | Copyright © 2023 Waldemar Schroeer |
# | waldemar.schroeer(at)rz-amper.de |
# +----------------------------------------------------------------------------+
# +----- Include bash-framework.sh --------------------------------------------+
# set -o errexit
# set -o pipefail
export BASH_FRMWRK_MINVER=4
export LANG="en_US.UTF-8"
export base_dir="$(dirname "$(readlink -f "$0")")"
export cdir=$(pwd)
export scriptname="${BASH_SOURCE##*/}"
export scriptdir="${BASH_SOURCE%/*}"
export datetime="$(date "+%Y-%m-%d-%H-%M-%S")"
export logfile="${scriptdir}/${datetime}.log"
export framework_width=80
if [[ -f "${scriptdir}"/bash-framework.sh ]]; then
BASH_FRMWRK_FILE="${scriptdir}/bash-framework.sh"
else
test_file=$(which bash-framework.sh 2>/dev/null)
if [[ $? = 0 ]]; then
BASH_FRMWRK_FILE="${test_file}"
unset test_file
else
echo -e "\nNo Bash Framework found.\n"
exit 1
fi
fi
source "${BASH_FRMWRK_FILE}"
if [[ "${BASH_FRMWRK_VER}" -lt "${BASH_FRMWRK_MINVER}" ]]; then
echo -e "\nI've found version ${BASH_FRMWRK_VER} of bash_framework.sh, but I'm in need of version ${BASH_FRMWRK_MINVER}."
echo -e "You may get the newest version from https://github.com/WieWaldi/bash-framework.sh\n"
exit 1
fi
# +----- Variables ------------------------------------------------------------+
notice="notice-setup.txt"
backupdir="${HOME}/Backup.X11files.$$"
cdir="$(dirname "$(readlink -f "${0}")")"
make="/bin/make -j 4"
cmake="/bin/cmake"
declare -a X11files=(
".Xresources"
".xinitrc"
".xsession"
".slocktext"
)
declare -a applist=(
"dmenu"
"dwm"
"dwm-helper"
"farbfeld"
"lsw"
"sent"
"slock"
"sselp"
"st"
"stw"
"surf"
"tabbed"
"xssstate"
"feh"
"compton"
"sxiv"
"xdotool"
"rotwall"
"xclickroot"
"xmenu"
"xmerge"
)
# +----- Functions ------------------------------------------------------------+
install_X11files() {
for i in "${X11files[@]}"
do
if [ -f ${HOME}/${i} ]; then
__echo_Left "Moving ${i} to ${backupdir}"
mv ${HOME}/${i} ${backupdir}
__echo_Result
fi
__echo_Left "Creating ${i}"
/bin/cp -r ${cdir}/X.org.files/${i} ${HOME}
__echo_Result
done
cp -r ${cdir}/.local/share/fonts ${HOME}/.local/share
cp -r ${cdir}/.local/share/wallpapers ${HOME}/.local/share
cp -r ${cdir}/.local/share/icons ${HOME}/.local/share
cp -r ${cdir}/.config/compton.conf ${HOME}/.config
cp -r ${cdir}/.config/picom.conf ${HOME}/.config
cp -r ${cdir}/dunst/dunstrc ${HOME}/.config/dunst
cp -r ${cdir}/X.org.files/.xsession ${HOME}
chmod 755 ${HOME}/.local/bin/.xsession
fc-cache
}
install_suckless() {
for i in "${applist[@]}"
do
__echo_Left "Compiling and installing ${i}"
cd ${cdir}/${i}
${make} >> ${logfile} 2>&1
__echo_Result
done
}
clean_suckless() {
for i in "${applist[@]}"
do
__echo_Left "Cleaning up after intalling ${i}"
cd ${cdir}/${i}
${make} clean >> ${logfile} 2>&1
__echo_Result
done
}
# +----- Main -----------------------------------------------------------------+
__display_Text_File blue ${scriptdir}/${notice}
if [[ "$(__read_Antwoord_YN "Do you want to proceed?")" = "no" ]]; then
__echo_Title "Exit"
exit 0
fi
install_X11files
install_suckless
clean_suckless
# +----- End ------------------------------------------------------------------+
echo -e "\n\n"
exit 0