This repository has been archived by the owner on Feb 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build
executable file
·51 lines (42 loc) · 1.71 KB
/
build
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
#!/bin/bash
version=$1
distributions=('stable')
codenames=('stretch')
architectures=('amd64' 'i386')
package_dir="keepassxc-${version}"
# Check if the script is not run with sudo
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Check if the package directory exists before attempting to build the package
if [ ! -d "$package_dir" ]; then
echo "Build failed"
echo "Directory $package_dir not found"
exit 2
fi
# Enter the package directory and start building
echo "### cd $package_dir"
cd $package_dir
# Create result directory if it does not exist
echo "### mkdir -p ../result"
mkdir -p ../result
# Build for Debian
for arch in "${architectures[@]}"
do
for i in ${!distributions[@]};
do
# Build the package for the current arch and distro
echo "### pbuilder create --distribution ${distributions[$i]} --architecture $arch && pbuilder --update --distribution ${distributions[$i]} --architecture $arch && pdebuild"
pbuilder create --distribution ${distributions[$i]} --architecture $arch && pbuilder --update --distribution ${distributions[$i]} --architecture $arch && pdebuild
# Copy binary package for result directory
if [ -e "/var/cache/pbuilder/result/keepassxc_${version}-1_${arch}.deb" ]
then
echo "### cp /var/cache/pbuilder/result/keepassxc_${version}-1_${arch}.deb ../result/keepassxc_${version}-1_${arch}_${distributions[$i]}_${codenames[$i]}.deb"
cp /var/cache/pbuilder/result/keepassxc_${version}-1_${arch}.deb ../result/keepassxc_${version}-1_${arch}_${distributions[$i]}_${codenames[$i]}.deb
echo "### rm /var/cache/pbuilder/result/keepassxc_${version}-1_${arch}.deb"
rm /var/cache/pbuilder/result/keepassxc_${version}-1_${arch}.deb
fi
echo
done
done