This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_build.sh
executable file
·111 lines (87 loc) · 2.67 KB
/
run_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
#!/bin/bash
# Script for building full AgiliaLinux ISO images
#
# Available environment options:
# ARCH: target architecture (x86_64 or x86, default: host arch)
# ISOBUILD: isobuild used to build image (default: openbox)
# USE_TESTING: enables testing packages. Values: 1, 0; default: not set
set -e
# Getting current directory, date and host arch
CWD=`pwd`
date=`date -u +%Y%m%d`
hostarch=${ARCH:-`uname -m`}
ISOBUILD=${ISOBUILD:-openbox}
if [ "$hostarch" = "x86_64" ] ; then
arch=x86_64
bits=64
else
arch=x86
bits=32
fi
TREE=$CWD/RSYNC/$arch
TESTING_TREE=$CWD/RSYNC/${arch}-testing
LIVECONT=$CWD/BUILD
NAME=agilia_live
LIVEROOT=$LIVECONT/$NAME-$arch
ISODIR=$CWD/iso
ISONAME=AgiliaLinux-core-$arch-$date.iso
if [ "$USE_TESTING" = "1" ] ; then
ISONAME=AgiliaLinux-testing-$arch-$date.iso
fi
REPO=file:///$TREE/repository/
if [ "$USE_TESTING" = "1" ] ; then
REPO="$REPO file:///$TESTING_TREE/repository"
fi
# First of all, rsync please
# Check if directory exists, if not - create it and download rsync script
if [ ! -f $TREE/rsync-update.sh ] ; then
echo "No RSYNC script, creating it"
mkdir -p $TREE
( cd $TREE && wget http://packages.agilialinux.ru/core/8.0/$arch/rsync-update.sh )
fi
if [ "$USE_TESTING" = "1" ] ; then
echo "RSyncing testing repo, wait please"
if [ ! -f $TESTING_TREE/rsync-update.sh ] ; then
mkdir -p $TESTING_TREE
( cd $TESTING_TREE && wget http://packages.agilialinux.ru/testing/8.0/$arch/rsync-update.sh )
fi
fi
# Do the sync
( cd $TREE && sh ./rsync-update.sh )
if [ "$USE_TESTING" = "1" ] ; then
( cd $TESTING_TREE && sh ./rsync-update.sh)
fi
# Check package tree for integrity (to prevent MD5 checksum errors)
( cd $TREE/repository
echo "Checking MD5 checksums..."
RESULT="$(mpkg checklist | grep BAD || true)"
if [ "$RESULT" != "" ] ; then
echo "Bad MD5 sums found, build stopped"
exit 1
fi
)
# Clean previous builds
echo "Cleaning previous build directory: $LIVEROOT"
rm -rf $LIVEROOT
# Now, build rootfs
echo "Building live system"
( cd ISOBUILDS/${ISOBUILD}
iso_name=$NAME arch=$arch REPO="$REPO" mklivecd -l $LIVECONT -a
)
# Copy new files to original tree
rm -f $TREE/boot/initrd${bits}.img
rm -f $TREE/boot/vmlinuz${bits}
rm -f $TREE/fs${bits}/rootfs.sfs
cp -v $LIVEROOT/boot/initrd${bits}.img $TREE/boot/
cp -v $LIVEROOT/boot/vmlinuz${bits} $TREE/boot/
cp -v $LIVEROOT/fs${bits}/rootfs.sfs $TREE/fs${bits}/
# If testing is used, copy testing package tree and re-generate index
if [ "$USE_TESTING" = "1" ] ; then
mkdir -p $TREE/repository/_testing
rsync -arvh --progress $TESTING_TREE/repository $TREE/repository/_testing
( cd $TREE ; mpkg-index )
fi
# Create final ISO
mkdir -p $ISODIR
( cd $TREE ; ISO_FILE=$ISODIR/$ISONAME ./makeiso.sh )
set +e