Update script from sh to fish

This commit is contained in:
Kujiu 2023-09-02 21:48:52 +02:00
parent 7c7aac6f73
commit 8436344542
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
3 changed files with 58 additions and 57 deletions

View file

@ -40,3 +40,4 @@ You need to install:
- toot - toot
- unoconv - unoconv
- vdirsyncer - vdirsyncer
- vlock

57
update-home.fish Executable file
View file

@ -0,0 +1,57 @@
#!/usr/bin/env fish
argparse 'R/remove' 'r/root' 'd/desktop' 'h/help' -- $argv
if set --query _flag_help
echo "Update home with config files"
echo "WARNING: ERASE YOUR ACTUAL CONFIG"
echo
echo "Usage:"
echo "-d : copy desktop files"
echo "-r : copy root files"
echo "-R : remove old homes config"
echo "-h : this help"
echo
echo "You have to launch an other script to override secrets after"
exit
end
if set --query _flag_desktop
# Copy the desktop part
echo "**** Copying desktop part"
rsync -av ./desktop/ ~/
pip install --user --break-system-packages -U poezio-omemo epr-reader
sed -i "s/REPLACEDEVICEHOSTNAME/`hostname`/g" ~/.config/poezio/poezio.cfg
end
if set --query _flag_remove
echo "**** Remove old config"
# Remove zsh
rm ~/.zcompdump
rm -rf ~/.zsh* ~/.local/share/zsh
# Remove old tmux files
rm -f ~/.tmux.conf ~/.tmux-theme
rm -f ~/.config/fish/cd.fish
end
if set --query _flag_root
echo "**** Copying root part"
rsync -av ./root/ ~/
end
go install github.com/jesseduffield/lazydocker@latest
go install github.com/jesseduffield/lazygit@latest
rm -rf ~/.cache/nvimpager-git
mkdir -p ~/.cache
git clone https://github.com/lucc/nvimpager ~/.cache/nvimpager-git
pushd ~/.cache/nvimpager-git
make PREFIX=$HOME/.local install
popd
rm -rf ~/.cache/nvimpager-git
# Copy the common part
rsync -av ./common/ ~/

View file

@ -1,57 +0,0 @@
#!/usr/bin/env bash
optstring="Rrdh"
while getopts ${optstring} arg; do
case ${arg} in
h)
echo "Update home with config files"
echo "WARNING: ERASE YOUR ACTUAL CONFIG"
echo
echo "Usage:"
echo "-d : copy desktop files"
echo "-r : copy root files"
echo "-R : remove old homes config"
echo "-h : this help"
echo
echo "You have to launch an other script to override secrets after"
exit
;;
d)
# Copy the desktop part
echo "**** Copying desktop part"
rsync -av ./desktop/ ~/
pip install --user --break-system-packages -U poezio-omemo epr-reader
sed -i "s/REPLACEDEVICEHOSTNAME/`hostname`/g" ~/.config/poezio/poezio.cfg
;;
R)
echo "**** Remove old config"
# Remove zsh
rm ~/.zcompdump
rm -rf ~/.zsh*
# Remove old tmux files
rm -f ~/.tmux.conf ~/.tmux-theme
rm -f ~/.config/fish/cd.fish
;;
r)
echo "**** Copying root part"
rsync -av ./root/ ~/
esac
done
go install github.com/jesseduffield/lazydocker@latest
go install github.com/jesseduffield/lazygit@latest
rm -rf ~/.cache/nvimpager-git
mkdir -p ~/.cache
git clone https://github.com/lucc/nvimpager ~/.cache/nvimpager-git
pushd ~/.cache/nvimpager-git
make PREFIX=$HOME/.local install
popd
rm -rf ~/.cache/nvimpager-git
# Copy the common part
rsync -av ./common/ ~/