#!/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 date >> /var/log/resyncRsyncRegistry.runlog cat > /etc/rsyncd.conf << RD uid = root gid = root use chroot = yes max connections = 4 pid file = /var/run/rsyncd.pid exclude = lost+found/ 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/^.*?\.([a-z0-9_-]+)\.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 umount $new_dir fi echo "Mounting $filename to $new_dir" mount $filename $new_dir cat >> /etc/rsyncd.conf << INSERTING [$version] path = $version_dir read only = yes INSERTING done echo "Created rsyncd.conf file, restarting service" systemctl restart rsync