-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·202 lines (183 loc) · 5.91 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·202 lines (183 loc) · 5.91 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
#!/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.2 |
# | 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="${cdir}/${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="src/notice-setup.txt"
backupdir="${HOME}/Backup.X11files.$$"
cdir="$(dirname "$(readlink -f "${0}")")"
make="/bin/make -j 4"
cmake="/bin/cmake"
declare -a config_Directories=(
"tmp"
".config"
".config/dwm"
".config/dunst"
".config/password_store"
".local/bin"
".local/lib"
".local/lib64"
".local/share/man/man1"
"Downloads"
"Notes"
"Pictures"
"Pictures/Collect"
"Pictures/Screenshots"
"Music/Youtube/MP3"
"Music/Youtube/Source"
)
declare -a X11files=(
".Xresources"
".xinitrc"
".xsession"
".slocktext"
)
declare -a applist=(
"dmenu"
"dwm"
"dwm-helper"
"farbfeld"
"feh"
"lsw"
"rotwall"
"sent"
"slock"
"sselp"
"st"
"stw"
"surf"
"sxiv"
"tabbed"
"xdotool"
"xclickroot"
"xmenu"
"xmerge"
"xssstate"
)
# +----- Functions ------------------------------------------------------------+
create_Backup_Directory() {
__echo_Left "Creating Backup Directory:"
mkdir -p ${backupdir}
__echo_Result
}
create_Config_Directories() {
__echo_Left "Config Directories:"
if [[ "${get_Config_Directories}" = "yes" ]]; then
for i in "${config_Directories[@]}"; do
__echo_Left "Preparing Directory: ${i}"
if [[ $(__check_File_Name ${HOME}/${i}) = 1 ]]; then
__echo_Right "Already in Place"
elif [[ $(__check_File_Name ${HOME}/${i}) = 3 ]]; then
mkdir -p ${HOME}/${i} >> ${logfile} 2>&1
__echo_Result
else
__echo_Failed
fi
done
else
__echo_Skipped
fi
}
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}/src/X.org.files/${i} ${HOME}
__echo_Result
done
cp -r ${cdir}/src/.local/share/fonts ${HOME}/.local/share
cp -r ${cdir}/src/.local/share/wallpapers ${HOME}/.local/share
cp -r ${cdir}/src/.local/share/icons ${HOME}/.local/share
cp -r ${cdir}/src/.local/bin/picom ${HOME}/.local/bin
cp -r ${cdir}/src/.config/picom.conf ${HOME}/.config
cp -r ${cdir}/src/.config/dunst/dunstrc ${HOME}/.config/dunst
cp -r ${cdir}/src/X.org.files/.xsession ${HOME}
chmod 755 ${HOME}/.xsession
fc-cache
}
install_suckless() {
for i in "${applist[@]}"
do
echo -ne "\n\n=== ${i} ===\n" >> ${logfile} 2>&1
cd ${cdir}/src/${i}
__echo_Left "Compiling ${i}"
${make} >> ${logfile} 2>&1
__echo_Result
__echo_Left "Installing ${i}"
${make} install >> ${logfile} 2>&1
__echo_Result
done
}
clean_suckless() {
for i in "${applist[@]}"
do
cd ${cdir}/src/${i}
__echo_Left "Cleaning up after intalling ${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
get_Config_Directories="yes"
create_Config_Directories
create_Backup_Directory
install_X11files
install_suckless
clean_suckless
# +----- End ------------------------------------------------------------------+
echo -e "\n\n"
exit 0