#!/usr/bin/env nu $env.BORG_PASSPHRASE = (cat ~/.borg-sub2) /etc/profiles/per-user/ch/bin/borg mount --last 1 ssh://u242757-sub2@u242757.your-storagebox.de:23/./borg ~/borg /home/ch/img do -i { # ensure that borg is unmounted to enable backups let img_dir = ls ~/borg/*/home/ch/img | first | get name let pub_dir = '/srv/media/pictures' cd $pub_dir let published = (ls | get name) cd $img_dir # TODO overwrite modified images # TODO add description let all = (open motivs.json | where rating == 3 | get stack | each {|s| $s.0}) let new = ($all | filter {|id| not ($id in $published) }) print $new cd backup $new | each {|img| let public = $'($pub_dir)/($img)' echo $public cp -uv $img $public chmod u+w $public # TODO add description /etc/profiles/per-user/ch/bin/exiv2 rm $public /etc/profiles/per-user/ch/bin/exiv2 -M "set Xmp.dc.creator pdp8@pdp8.info" -M "set Xmp.dc.rights © pdp8@pdp8.info" -M "set Xmp.dc.license http://creativecommons.org/licenses/by-sa/4.0/" -M "set Xmp.xmpRights.UsageTerms Creative Commons Attribution-ShareAlike 4.0 International License" -M "set Xmp.xmpRights.Marked True" -M "set Xmp.dc.description Original artwork available from pdp8@pdp8.info" $public } cd /home/ch/src/publish/ /home/ch/.nix-profile/bin/make www-pictures } /run/wrappers/bin/umount ~/borg