blob: 3f212c61208dcc49fcc9540a1f914e7515f64425 (
plain)
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
|
#!/bin/bash
readonly MODE='wipe' # total wipe of work dir preserving package cache
# readonly MODE='rebuild' # full update rebuild preserving work dir
# readonly MODE='tweak' # chroot customization tweaks only
readonly TARGET='dual' # dual-arch (default)
# readonly TARGET='i686' # i686 target only
# readonly TARGET='x86_64' # x86_64 target only
# readonly EDITION='OpenRC/CLI' # OpenRC/CLI init/WM-DE pair
# readonly EDITION='OpenRC/LXDE' # OpenRC/LXDE init/WM-DE pair
readonly EDITION='SystemD/CLI' # SystemD/CLI init/WM-DE pair (default)
# readonly EDITION='SystemD/LXDE' # SystemD/LXDE init/WM-DE pair
readonly CACHE='' # net-install (default)
# readonly CACHE='-O' # offline install
readonly VERSION="`date +%Y.%m.%d-%H.%M`-alpha" # ISO filename like: parabola-<EDITION>-<TARGET>-<VERSION>.iso
((`id -u`)) && echo "This script must be run with root privileges." && exit
# cleanup in case of previous aborted run
while pids=$(pidof ./rebuild.sh || pidof sudo ./rebuild.sh) && pids=${pids/$PPID/} && [ "$pids" ]
do for pid in ${pids/$PPID/} ; do sudo kill -9 $pid ; done ; sleep 1 ;
done
for work_dir in "$PWD/work/i686" "$PWD/work/x86_64"
do declare -a mountpoints=()
for mnt in dev/pts dev/shm dev proc run sys tmp; do
mountpoint=$(findmnt --noheadings --output="TARGET" "${work_dir}/root-image/${mnt}" || true)
if [[ "${mountpoint}" != "" ]] ; then mountpoints=( ${mountpoints[@]} "${mountpoint}" ) ; fi ;
done
for mountpoint in ${mountpoints[@]} ; do umount "${mountpoint}" ; done ;
done
if [ "$MODE" == 'wipe' ]
then for arch in i686 x86_64
do isorepo=./work/${arch}/root-image/isorepo
[ -d $isorepo -a ! -d ./isorepo-${arch} ] && mv $isorepo ./isorepo-${arch} 2> /dev/null
done
rm -rf ./work/ 2> /dev/null
for arch in i686 x86_64
do if [ -d ./isorepo-${arch} ] && [ "$TARGET" == 'dual' -o "$TARGET" == "${arch}" ]
then mkdir -p ./work/${arch}/root-image
mv ./isorepo-${arch} ./work/${arch}/root-image/isorepo
fi
done
elif [ "$MODE" == 'rebuild' ]
then rm -v ./work/build.make_*
elif [ "$MODE" == 'tweak' ]
then rm work/build.make_customize_root_image_$TARGET \
work/build.make_prepare_$TARGET \
work/build.make_iso* 2> /dev/null
fi
CMD="./build.sh -v -E $EDITION -T $TARGET $CACHE -V $VERSION"
if ${CMD}
then echo "success" ; rm ./continue.sh 2> /dev/null
else echo -e "failure - continue with: ./continue.sh"
echo -e "#!/bin/bash\n${CMD}" > ./continue.sh
chmod a+x ./continue.sh
fi
|