mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
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
This commit is contained in:
54
build/registry/resyncRsyncRegistry
Executable file
54
build/registry/resyncRsyncRegistry
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user