This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_walls.sh
executable file
·63 lines (51 loc) · 1.65 KB
/
build_walls.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
#!/bin/bash
## Copyright (C) Pwnwriter // METIS Linux
## Directories
current_directory="$(pwd)"
directory_name="$(basename "$current_directory")"
last_character="$(basename "$(pwd)")"
package_directories=(`ls -d */ | cut -f1 -d'/'`)
packages_directory="$current_directory/pkgs-$last_character"
## Script Termination
exit_on_signal_SIGINT () {
{ printf "\n\n%s\n" "Script interrupted." 2>&1; echo; }
exit 0
}
exit_on_signal_SIGTERM () {
{ printf "\n\n%s\n" "Script terminated." 2>&1; echo; }
exit 0
}
trap exit_on_signal_SIGINT SIGINT
trap exit_on_signal_SIGTERM SIGTERM
## Build packages
build_packages () {
local package
if [[ ! -d "$packages_directory" ]]; then
mkdir -p "$packages_directory"
fi
echo -e "\nBuilding Packages - \n"
for package in "${package_directories[@]}"; do
echo -e "Building ${package}..."
cd ${package}
makepkg -sc
mv *.pkg.tar.zst "$packages_directory"
# Verify
while true; do
set -- "$packages_directory"/${package}-*
if [[ -e "$1" ]]; then
echo -e "\nPackage '${package}' generated successfully.\n"
break
else
echo -e "\nFailed to build '${package}', Exiting...\n"
exit 1;
fi
done
cd "$current_directory"
done
repository_directory='../pkgs/x86_64'
if [[ -d "$repository_directory" ]]; then
mv -f "$packages_directory"/*.pkg.tar.zst "$repository_directory" && rm -r "$packages_directory"
echo -e "Packages moved to Repository.\n[!] Don't forget to update the database.\n"
fi
}
build_packages