homes/update-private-example.fish
2023-09-03 18:26:58 +02:00

44 lines
1.4 KiB
Fish
Executable file

#!/usr/bin/env fish
# Template for update-private.fish
# To place in ~/homes-private
#
# This example assumes these folders exist:
# - ~/homes-private/private
# - ~/homes-private/root
#
# Please create your own private repository for secrets
argparse 'r/root' 'p/private' 'h/help' -- $argv
if set --query _flag_help
echo "Update home with config files"
echo "WARNING: ERASE YOUR ACTUAL CONFIG"
echo
echo "Usage:"
echo "-p : private files"
echo "-r : copy root files"
echo "-h : this help"
echo
exit
end
if set --query _flag_private
# Copy the private part
echo "**** Copying private part"
rsync --exclude=".*.swp" -av ./private/ ~/
sed -i "s/REPLACE_DEVICE_HOSTNAME/`hostname`/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACE_FINGERPRINT/cert_fingerprint/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACE_JID/template@example.com/g" ~/.config/poezio/poezio.cfg
sed -i "s/KEYRING_ID/xmpp:template@example.com/g" ~/.config/poezio/poezio.cfg
sed -i "s/KEYRING_USER/template@example.com/g" ~/.config/poezio/poezio.cfg
sed -i "s/FRESHRSSLOGIN/example_user/g" ~/.config/newsboat/config
sed -i "s/FRESHRSSKEEPASSXC/rss:freshrss.example.com/g" ~/.config/newsboat/config
sed -i "s/FRESHRSSURL/https:\/\/freshrss.example.com\/api\/greader.php/g" ~/.config/newsboat/config
end
if set --query _flag_root
rsync --exclude=".*.swp" -av ./root/ ~/
end