Files
start-os/build/registry/resyncRsyncRegistry
J M 5b91b5f436 feat: For ota update using rsyncd (#1938)
* feat: For ota update using rsyncd

* chore: Fix where we rsync to.

* chore: Getting rsync to work

* chore: Add in the is raspberry pi

* chore: Update is raspberry pi
2022-11-29 09:43:54 -07:00

55 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Expecting that the eos files are sitting in ~/resources/eos/*/*.{arch}.squashfs
# and that the arch could be aarm64 or x86_64
# Then we are going to make sure that each of these files is then put on the rsyncd server
# so the embassies can pull them down
cat > /etc/rsyncd.conf << RD
uid = root
gid = root
use chroot = yes
max connections = 4
pid file = /var/run/rsyncd.pid
exclude = lost+found/
transfer logging = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
RD
for dir in ~/resources/eos/*/*.squashfs # list directories in the form "/tmp/dirname/"
do
directory=${dir%/*}
cd $directory
filename=${dir##*/}
version=$(echo $directory | sed -r 's/.*\///')
version_dir="/srv/rsync/$version"
type=$(echo "$filename" | sed -r "s/^.*?\.(\w+)\.squashfs$/\1/")
new_dir="$version_dir/$type"
echo "Making new dir $new_dir"
mkdir -p $new_dir
if ! test -n "$(mount -l | grep $new_dir)"
then
echo "Mounting $filename to $new_dir"
mount $filename $new_dir
fi
cat >> /etc/rsyncd.conf << INSERTING
[$version]
path = $version_dir
read only = yes
INSERTING
done
echo "Created rsyncd.conf file, restarting service"
systemctl restart rsync