homes/update-homes-secrets-example.fish

74 lines
2.7 KiB
Fish
Executable file

#!/usr/bin/env fish
# Template for update-homes-secrets
# To place in ~/homes-private/common/.config/fish/functions
#
# This example assumes this folder exists:
# - ~/homes-private
#
# Note: you can change path with env variables
# HOMES_PATH and HOMES_PRIVATE_PATH
#
# Please create your own private repository for secrets
function update-homes-secrets -d "Update secrets for configuration of homes"
argparse 'h/help' 'd/desktop' 'r/root' -- $argv
if set -q _flag_help
echo "Update home's configuration"
echo
echo "You need to have homes and homes-private in your home directory."
echo "This function launch the two scripts to update your conf."
echo
echo " -d --desktop"
echo " Update desktop part"
echo
echo " -r --root"
echo " Update root part"
echo
echo " -h --help"
echo " Show this screen"
return
end
if set --query _flag_desktop
echo
echo
echo (set_color 81b29a)"*** Set secrets ***"(set_color normal)
echo
echo
echo (set_color 719cd6)"*** Set poezio ***"(set_color normal)
echo
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/REPLACEDATADIR/.local\/share\/poezio/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACECONFDIR/.config\/poezio/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACECACHEDIR/.cache\/poezio/g" ~/.config/poezio/poezio.cfg
echo
echo
echo (set_color 719cd6)"*** Set newsboat ***"(set_color normal)
echo
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
echo
echo
echo (set_color 719cd6)"*** Set notmuch ***"(set_color normal)
echo
sed -i "s:REPLACE_HOME_USER:$HOME:g" ~/.local/share/systemd/user/notmuch.service
echo
echo
echo (set_color 719cd6)"*** Set git ***"(set_color normal)
echo
sed -i "s/REPLACEUSER/example (@$(hostname))/g" ~/.config/git/config
sed -i "s/REPLACEMAIL/test@example.com/g" ~/.config/git/config
sed -i "s/REPLACEKEY/HEX/g" ~/.config/git/config
end
end