infra-nextcloud/copy.sh

53 lines
1.2 KiB
Bash
Raw Normal View History

2025-01-23 16:26:06 +01:00
#!/bin/ash
_source644="
etc/apk/world
etc/caddy/Caddyfile
etc/conf.d/dnscrypt-proxy
etc/conf.d/nextcloud
etc/dnscrypt-proxy/dnscrypt-proxy.toml
etc/php83/conf.d/50-nextcloud.ini
etc/ssh/sshd_config.d/listen.conf
etc/ssh/sshd_config.d/no-forward.conf
etc/ssh/sshd_config.d/no-password.conf
"
# /home/jane400/sources/cuties/j4ne-nextcloud/rootfs-etc-php83-php-fpm.d-override_nextcloud.toml
_source750="
root/post-install.sh
"
# Avoid filename based checksum conflicts by including the whole path:
# https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10013
flatpath() {
local i
for i in $@; do
echo "rootfs-$i" | sed s./.-.g
done
}
startdir="$(dirname $(realpath $0))"
srcdir="$startdir"
pkgdir="$startdir/pkg"
result="$startdir/files.tar.gz"
[ -d "$pkgdir" ] && rm -R "$pkgdir"
[ -f "$result" ] && rm "$result"
mkdir "$pkgdir"
for i in $_source644; do
install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
done
for i in $_source750; do
install -Dm750 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
done
cd "$pkgdir"
tar -czf "$result" *
cd "$startdir"
scp "$result" root@prod.cloud.j4ne.de:/root/files.tar.gz
ssh root@prod.cloud.j4ne.de tar -xf '~/files.tar.gz' --no-same-owner -C /