-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·166 lines (113 loc) · 3.07 KB
/
build.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/env bash
################################################################################
### Head: Init
##
set -e ## for Exit immediately if a command exits with a non-zero status.
THE_BASE_DIR_PATH="$(cd -- "$(dirname -- "$0")" ; pwd)"
THE_CMD_FILE_NAME="$(basename "$0")"
THE_TMP_DIR_PATH="${THE_BASE_DIR_PATH}/tmp"
THE_BUD_DIR_PATH="${THE_TMP_DIR_PATH}/compiz"
THE_REPO_DIR_PATH="${THE_BASE_DIR_PATH}/../../../../../../ezarcher-adjustment-repository/repo/main"
THE_PACK_DIR_PATH="${THE_BASE_DIR_PATH}/package"
##
### Tail: Init
################################################################################
################################################################################
### Head: Util / Debug
##
util_error_echo () {
echo "$@" 1>&2
}
##
### Head: Util / Debug
################################################################################
################################################################################
### Head: Signal
##
exit_on_signal_interrupted () {
util_error_echo
util_error_echo "## Script interrupted."
util_error_echo
mod_package_clean
exit 0
}
exit_on_signal_terminated () {
util_error_echo
util_error_echo "## Script terminated."
util_error_echo
mod_package_clean
exit 0
}
mod_signal_bind () {
trap exit_on_signal_interrupted SIGINT
trap exit_on_signal_terminated SIGTERM
}
##
### Tail: Signal
################################################################################
################################################################################
### Head: Model / Build Package
##
mod_package_clean () {
util_error_echo
util_error_echo "## Cleaning Old Package"
util_error_echo
rm -rf "${THE_PACK_DIR_PATH}"
rm -rf "${THE_TMP_DIR_PATH}"
}
mod_package_clean_on_finish () {
util_error_echo
util_error_echo "## Cleaning On Finish"
util_error_echo
}
mod_aur_download () {
mkdir -p "${THE_TMP_DIR_PATH}"
cd "${THE_TMP_DIR_PATH}"
wget -c 'https://aur.archlinux.org/cgit/aur.git/snapshot/compiz.tar.gz'
tar xf compiz.tar.gz
cd "${OLDPWD}"
}
mod_package_make_prepare () {
mod_package_clean
mod_aur_download
}
mod_package_make () {
util_error_echo
util_error_echo "## Building New Package"
util_error_echo
cd "${THE_BUD_DIR_PATH}"
makepkg -sf
#makepkg -sf -d
cd "${OLDPWD}"
}
mod_package_make_finish () {
mkdir -p "${THE_PACK_DIR_PATH}"
mv "${THE_BUD_DIR_PATH}/"*.zst "${THE_PACK_DIR_PATH}/"
mod_package_make_copy_to_repository
mod_package_clean_on_finish
}
mod_package_make_copy_to_repository () {
if ! [ -d "${THE_REPO_DIR_PATH}" ]; then
return
fi
cp -a "${THE_PACK_DIR_PATH}/"*.zst "${THE_REPO_DIR_PATH}/"
}
mod_package_build () {
mod_package_make_prepare
mod_package_make
mod_package_make_finish
}
##
### Tail: Model / Build Package
################################################################################
################################################################################
### Head: Main
##
__main__ () {
mod_signal_bind
mod_package_build
}
__main__
##
### Tail: Main
################################################################################