Repository navigation
Expand file tree
/
Copy pathmake_rootfs.sh
More file actions
executable file
·55 lines (46 loc) · 1.71 KB
/
Copy pathmake_rootfs.sh
File metadata and controls
executable file
·55 lines (46 loc) · 1.71 KB
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
#!/bin/bash
# DEPRECATED DEVICES: raspi3 rock64 rockpi4
# Keep macOS tar from adding AppleDouble (._*) entries for files with extended attributes. Extended
# attributes are also left out with --no-xattrs, since GNU tar warns about macOS's for every file.
export COPYFILE_DISABLE=1
# Build all devices by default, or only those named on the command line
ALL_DEVICES=('raspi4' 'raspi5' 'debian' 'rockpro64')
if [ "$#" -gt 0 ]; then
DEVICES=("$@")
for d in "${DEVICES[@]}"; do
found=0
for a in "${ALL_DEVICES[@]}"; do
if [ "$d" = "$a" ]; then found=1; fi
done
if [ $found -eq 0 ]; then
echo "ERROR: Unknown device '$d'"
echo " Known devices: ${ALL_DEVICES[*]}"
exit 1
fi
done
else
DEVICES=("${ALL_DEVICES[@]}")
fi
# Make each device
for i in "${DEVICES[@]}" ; do
echo "Creating root file system for $i"
mkdir -p out/rootfs_$i/
# Raspi4 and Raspi5 share a rootfs
src_rootfs=$i
if [ "$i" = "raspi5" ]; then
src_rootfs="raspi4"
fi
# Clear out data for old apps
rm -rf out/rootfs_$i/usr/share/mynode_apps
# Make rootfs
rsync -r -u rootfs/standard/* out/rootfs_$i/
rsync -r -u rootfs/$src_rootfs/* out/rootfs_$i/
rsync -r -u CHANGELOG out/rootfs_$i/usr/share/mynode/changelog
cp -f setup/setup_device.sh out/setup_device.sh
#cp -f rootfs/standard/usr/share/mynode/mynode_app_versions.sh out/mynode_app_versions.sh
# Remove Python caches and macOS metadata files
find out/rootfs_$i \( -name __pycache__ -o -name .DS_Store -o -name '._*' \) -prune -exec rm -rf {} +
rm -f out/mynode_rootfs_$i.tar.gz
tar --no-xattrs -zcf out/mynode_rootfs_$i.tar.gz out/rootfs_$i/*
done
echo Done!