-
Notifications
You must be signed in to change notification settings - Fork 0
/
davos_build.sh
executable file
·67 lines (49 loc) · 1.71 KB
/
davos_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
#!/bin/bash
set -e
# Edit these line to update clonezilla version
version="20240108-mantic"
arch="amd64"
base_url="http://free.nchc.org.tw/clonezilla-live/alternative/testing/$version/"
# =============================================================
# Don't edit anything below these lines
# =============================================================
file_name=clonezilla-live-$version-$arch.zip
#Uncomment this URL when not using stable folder.
#full_url=$base_url/$version/$file_name
full_url=$base_url/$file_name
old_pwd=$(pwd)
tempdir=$(mktemp -d)
echo "Downloading Clonezilla ..."
[ ! -f $file_name ] && echo "Downloading Clonezilla" && wget $full_url
# Sometimes we get html instead of real file
if [[ ! -f "$file_name" || $(stat -c%s "$file_name") -lt 1048576 ]]; then
echo "Failed to download the right file, check URLs"
exit 1
fi
# Entering temp directory
cp $file_name $tempdir
cd $tempdir
mkdir clonezilla build
# Unzip clonezilla zipfile
unzip "$file_name" -d clonezilla/
# Move needed files to build dir
for file in {filesystem.squashfs,initrd.img,vmlinuz}; do
mv clonezilla/live/$file build/
done
cd build
# Decompressing the squashfs
unsquashfs filesystem.squashfs && rm filesystem.squashfs
cd squashfs-root
#sed 's/MULTICAST_ALL_ADDR="224.0.0.1"/MULTICAST_ALL_ADDR="239.254.1.255"/' -i etc/drbl/drbl-ocs.conf
# Run deploy script to patch the filesystem
$old_pwd/deploy_filesystem.sh $old_pwd/
cd ..
# Recompress the new squashfs
mksquashfs squashfs-root/ fs.squashfs -noappend -always-use-fragments
rm -r squashfs-root/
cd ..
# Move builded files to their final dir
mv -f build/* $old_pwd/var/lib/pulse2/imaging/davos/
# Remove temp dir
rm -r $tempdir
echo "Davos diskless environment built successfuly"