This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build-yunohost
executable file
·82 lines (61 loc) · 2.26 KB
/
build-yunohost
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
#!/bin/bash
# Usage ./build-yunohost [ARCH [DIST [DEB_DIST]]]
# ARCH amd64|i386
# DIST stable|testing
# DEB_DIST bullseye
readonly DEFAULT_DEB_DIST="bullseye"
readonly REPO_URL="http://forge.yunohost.org/debian/"
readonly ARCH_CHOICE=$1
readonly DIST="${2:-stable}"
readonly DEB_DIST="${3:-$DEFAULT_DEB_DIST}"
source ./common.sh
# Build Yunohost iso for amd64 or i386 arch
# Usage: build ARCH
function build
{
local ARCH="$1"
info "Starting build for arch $ARCH ..."
if [ "$DIST" = "testing" ] ; then
sed -i "s#$REPO_URL bullseye stable#$REPO_URL $DEB_DIST stable testing#" profiles/*.preseed
else
sed -i "s#$REPO_URL bullseye stable testing#$REPO_URL $DEB_DIST stable#" profiles/*.preseed
fi
rm -rf $(pwd)/tmp
rm -rf $(pwd)/images/debian*
# Build a simple/regular debian CD image ?
sudo -u yunohost build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf
# Find the release version of debian
local DEBNUM="$(grep "Version:" tmp/${DEB_DIST}_Release | awk '{print $2;}')"
# Find the release version of YunoHost
info "Finding out current YunoHost's stable vesion number"
wget -q ${REPO_URL}dists/${DEB_DIST}/${DIST}/binary-i386/Packages.gz
gunzip Packages.gz
YNH_VERSION=$(grep "^Package: yunohost$" --after-context=1 Packages | grep "Version" | awk '{print $2;}')
rm -f Packages
local CD_STUFF="images/debian-$DEBNUM-$ARCH-CD"
# build-simple-cdd is stupid and doesn't name its output correctly -.- ...
mv images/debian-*-$ARCH-CD-1.iso $CD_STUFF.iso
mv images/debian-*-$ARCH-CD-1.list.gz $CD_STUFF.list.gz
local OUTPUT="images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso"
[ -e "$CD_STUFF.iso" ] \
|| critical "Expected to find $CD_STUFF.iso but it's not here ?"
rm -f $OUTPUT
$(pwd)/add-firmware-to $CD_STUFF.iso $OUTPUT $DEB_DIST
rm -f $CD_STUFF.iso
rm -f $CD_STUFF.list.gz
[ -e $OUTPUT ] \
&& success "The image should now be available in $OUTPUT" \
|| critical "Something wrong happened when build the image :|"
}
function main
{
if [ -z "$ARCH_CHOICE" ]
then
info "No arch chosen, will build both i396 and amd64"
build i386
build amd64
else
build $ARCH_CHOICE
fi
}
main