2023-09-03 00:36:15 +02:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
function update-homes -d "Update homes configuration"
|
2023-09-10 01:48:28 +02:00
|
|
|
argparse 'h/help' 'g/git' 'd/desktop' 'r/root' 'R/remove' 'i/install' 'D/fix-debian' -- $argv
|
2023-09-03 00:36:15 +02:00
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
set -f homes_path ~/homes
|
|
|
|
set -f homes_private_path ~/homes-private
|
|
|
|
|
|
|
|
if set -q HOMES_PATH
|
|
|
|
set -f homes_path $HOMES_PATH
|
|
|
|
end
|
|
|
|
|
|
|
|
if set -q HOMES_PRIVATE_PATH
|
|
|
|
set -f homes_private_path $HOMES_PRIVATE_PATH
|
|
|
|
end
|
|
|
|
|
|
|
|
if not test -d $homes_path
|
|
|
|
echo (set_color c94f6d)"*** ERROR ***"(set_color normal)
|
|
|
|
echo "*** $homes_path does not exists"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if not test -n homes_path
|
|
|
|
echo (set_color c94f6d)"*** ERROR ***"(set_color normal)
|
|
|
|
echo "*** HOMES_PATH variable is empty"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if not test -n homes_private_path
|
|
|
|
echo (set_color c94f6d)"*** ERROR ***"(set_color normal)
|
|
|
|
echo "*** HOMES_PRIVATE_PATH is empty, unset or change it"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if not test -d $homes_private_path
|
|
|
|
echo (set_color f4a261)"*** WARNING ***"(set_color normal)
|
|
|
|
echo "*** $homes_private_path does not exist"
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if not functions -q update-homes-secrets
|
|
|
|
echo (set_color f4a261)"*** WARNING ***"(set_color normal)
|
|
|
|
echo "*** update-homes-secrets is not defined"
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if set -q _flag_help
|
2023-09-03 00:36:15 +02:00
|
|
|
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 " -g --git"
|
|
|
|
echo " Pull-rebase before launch script"
|
|
|
|
echo
|
|
|
|
echo " -d --desktop"
|
|
|
|
echo " Update desktop part"
|
|
|
|
echo
|
|
|
|
echo " -r --root"
|
|
|
|
echo " Update root part"
|
|
|
|
echo
|
|
|
|
echo " -R --remove"
|
|
|
|
echo " Remove old configuration"
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
echo " -i --install"
|
|
|
|
echo " Install user packages and softwares"
|
|
|
|
echo
|
2023-09-10 01:48:28 +02:00
|
|
|
echo " -D --fix-debian"
|
|
|
|
echo " Install missing packages in debian into user path"
|
|
|
|
echo
|
2023-09-03 00:36:15 +02:00
|
|
|
echo " -h --help"
|
|
|
|
echo " Show this screen"
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-09-10 01:48:28 +02:00
|
|
|
if set -q _flag_fix_debian
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 81b29a)"*** Install user softwares ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install nvimpager ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
mkdir -p ~/.cache
|
|
|
|
rm -rf ~/.cache/nvimpager-git
|
|
|
|
git clone --depth 1 https://github.com/lucc/nvimpager ~/.cache/nvimpager-git
|
|
|
|
pushd ~/.cache/nvimpager-git
|
|
|
|
make PREFIX=$HOME/.local install
|
|
|
|
popd
|
|
|
|
rm -rf ~/.cache/nvimpager-git
|
2023-09-07 17:55:16 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install virtualfish ***"(set_color normal)
|
|
|
|
echo
|
2023-09-08 15:52:05 +02:00
|
|
|
pip install --user --upgrade --break-system-packages virtualfish
|
2023-09-27 03:29:50 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install pyright ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install --user --upgrade --break-system-packages -U pyright
|
2023-10-02 00:57:35 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install broot ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install broot
|
|
|
|
|
2023-10-18 00:45:39 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install starship ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install starship
|
|
|
|
|
2023-10-02 00:57:35 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install onefetch ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install onefetch
|
2023-09-03 00:36:15 +02:00
|
|
|
end
|
2023-09-04 16:14:08 +02:00
|
|
|
|
2023-09-10 01:48:28 +02:00
|
|
|
if set -q _flag_desktop && set -q _flag_fix_debian
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install lazydocker ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
go install github.com/jesseduffield/lazydocker@latest
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install lazygit ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
go install github.com/jesseduffield/lazygit@latest
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install bluetuith ***"(set_color normal)
|
|
|
|
go install github.com/darkhz/bluetuith@latest
|
|
|
|
|
2023-09-08 20:05:10 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install pms ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
go install github.com/ambientsound/pms@latest
|
|
|
|
|
2023-10-18 00:45:39 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install pastel ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install pastel
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install cargo-espflash, espflash and espup ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install espflash espup cargo-espflash
|
|
|
|
|
2023-10-18 03:56:07 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install wthrr ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install wthrr
|
|
|
|
|
2024-01-23 02:59:56 +01:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install bitwarden-keyring ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install --user --upgrade --break-system-packages -U bitwarden-keyring
|
|
|
|
|
2023-10-19 03:47:28 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install offpunk ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install --user --upgrade --break-system-packages -U offpunk
|
|
|
|
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
2023-10-24 03:54:53 +02:00
|
|
|
echo (set_color 719cd6)"*** Install poezio-omemo and epy ***"(set_color normal)
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
2023-10-24 03:54:53 +02:00
|
|
|
pip install --user --upgrade --break-system-packages -U poezio-omemo epy-reader
|
2023-09-04 16:14:08 +02:00
|
|
|
|
2023-10-19 03:47:28 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install todoman ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install --user --upgrade --break-system-packages -U todoman click-repl
|
|
|
|
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install poezio plugins ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
rm -rf ~/.local/share/poezio/plugins
|
2023-09-08 15:52:05 +02:00
|
|
|
mkdir -p ~/.local/share/poezio/logs
|
2023-09-04 16:14:08 +02:00
|
|
|
|
|
|
|
set -l poezio_version $(poezio --version | cut -d " " -f 2)
|
|
|
|
rm -rf ~/.cache/poezio-git
|
2023-09-06 02:22:26 +02:00
|
|
|
git clone --depth 1 -b $poezio_version https://codeberg.org/poezio/poezio ~/.cache/poezio-git
|
2023-09-04 16:14:08 +02:00
|
|
|
pushd ~/.cache/poezio-git
|
|
|
|
popd
|
|
|
|
cp -r ~/.cache/poezio-git/plugins ~/.local/share/poezio
|
|
|
|
rm -rf ~/.cache/poezio-git
|
2023-09-03 00:36:15 +02:00
|
|
|
end
|
2023-09-04 16:14:08 +02:00
|
|
|
|
2023-09-10 01:48:28 +02:00
|
|
|
if set -q _flag_install
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install virtualfish ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
vf install auto_activation compat_aliases global_requirements projects environment
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install fundle plugins ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
fundle install
|
|
|
|
fundle update
|
2023-09-27 03:29:50 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install pygments style ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install "git+https://procrastinator.nerv-project.eu/kujiu/pygments_nightfox_style" --user --break-system-packages
|
2023-10-02 00:57:35 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install xonsh plugins ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
echo "xpip install -U xontrib-commands xontrib-gitinfo \
|
|
|
|
xontrib-broot xontrib-hist-navigator xontrib-prompt-vi-mode \
|
|
|
|
xontrib-vox xontrib-abbrevs xontrib-argcomplete xontrib-django \
|
|
|
|
xonsh-docker-tabcomplete xontrib-fish-completer xontrib-jedi\
|
|
|
|
xontrib-makefile-complete --break-system-packages; exit(1)" | xonsh
|
2023-10-18 00:45:39 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install hgrep ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
cargo install hgrep
|
2023-09-10 01:48:28 +02:00
|
|
|
end
|
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
if set -q _flag_remove
|
2023-09-06 02:22:26 +02:00
|
|
|
echo (set_color 81b29a)"**** Remove old config ***"(set_color normal)
|
2023-09-04 16:14:08 +02:00
|
|
|
|
|
|
|
# Remove zsh
|
|
|
|
rm ~/.zcompdump
|
|
|
|
rm -rf ~/.zsh* ~/.local/share/zsh
|
|
|
|
|
|
|
|
# Remove old tmux files
|
|
|
|
rm -f ~/.tmux.conf ~/.tmux-theme
|
|
|
|
|
|
|
|
rm -rf ~/.config/aerc
|
2024-02-04 02:08:02 +01:00
|
|
|
rm -rf ~/.local/share/aerc
|
2023-09-04 16:14:08 +02:00
|
|
|
rm -rf ~/.config/fish
|
|
|
|
rm -rf ~/.config/khal
|
|
|
|
rm -rf ~/.config/khard
|
|
|
|
rm -rf ~/.config/lvim
|
|
|
|
rm -rf ~/.config/neomutt
|
|
|
|
rm -rf ~/.config/newsboat
|
|
|
|
rm -rf ~/.config/nvim
|
|
|
|
rm -rf ~/.config/poezio
|
|
|
|
rm -rf ~/.config/tmux
|
2023-09-10 18:26:09 +02:00
|
|
|
rm -rf ~/.config/tmuxinator
|
2023-09-04 16:14:08 +02:00
|
|
|
rm -rf ~/.config/toot
|
|
|
|
rm -rf ~/.config/vdirsyncer
|
2023-09-27 03:29:50 +02:00
|
|
|
rm -rf ~/.local/share/json-fortune
|
|
|
|
rm ~/.fortunes.json
|
|
|
|
rm ~/.wikiquote-sources.json
|
2023-09-03 00:36:15 +02:00
|
|
|
end
|
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
if set -q _flag_git
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 81b29a)"*** Update homes configuration directories ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
pushd $homes_path
|
|
|
|
gitpr
|
|
|
|
popd
|
|
|
|
|
|
|
|
if test -d $homes_private_path
|
|
|
|
pushd $homes_private_path
|
2023-09-03 00:44:13 +02:00
|
|
|
gitpr
|
2023-09-04 16:14:08 +02:00
|
|
|
popd
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 81b29a)"*** Synchronize files ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Copying common part ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
if test -d $homes_path/common
|
|
|
|
pushd $homes_path
|
|
|
|
rsync --exclude=".*.swp" -av ./common/ ~/
|
|
|
|
popd
|
2023-09-08 15:52:05 +02:00
|
|
|
set_nightfox_vars
|
2023-10-29 02:44:09 +01:00
|
|
|
sed -i "s:REPLACEHOME:$HOME:g" ~/.config/nvim/init.lua
|
2023-10-29 02:48:55 +01:00
|
|
|
sed -i "s:REPLACEHOME:$HOME:g" ~/.config/nvimpager/init.lua
|
2023-10-29 02:44:09 +01:00
|
|
|
sed -i "s:REPLACEHOME:$HOME:g" ~/.config/lvim/config.lua
|
2023-09-04 16:14:08 +02:00
|
|
|
end
|
|
|
|
if test -d $homes_private_path/common
|
|
|
|
pushd $homes_private_path
|
|
|
|
rsync --exclude=".*.swp" -av ./common/ ~/
|
|
|
|
popd
|
|
|
|
end
|
|
|
|
|
2023-09-27 03:29:50 +02:00
|
|
|
if set -q _flag_install
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Install json-fortune deps ***"(set_color normal)
|
|
|
|
echo
|
|
|
|
pip install --user --upgrade --break-system-packages wikiquote
|
|
|
|
if not test -f ~/.local/share/json-fortune/fortunes.json
|
|
|
|
update-quotes
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
if set -q _flag_root
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Copying root part ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
if test -d $homes_path/root
|
|
|
|
pushd $homes_path
|
|
|
|
rsync --exclude=".*.swp" -av ./root/ ~/
|
|
|
|
popd
|
|
|
|
end
|
|
|
|
if test -d $homes_private_path/root
|
|
|
|
pushd $homes_private_path
|
|
|
|
rsync --exclude=".*.swp" -av ./root/ ~/
|
|
|
|
popd
|
2023-09-03 00:44:13 +02:00
|
|
|
end
|
2023-09-04 16:14:08 +02:00
|
|
|
end
|
2023-09-03 00:36:15 +02:00
|
|
|
|
2023-09-04 16:14:08 +02:00
|
|
|
if set -q _flag_desktop
|
2023-09-10 01:48:28 +02:00
|
|
|
mkdir -p ~/.local/share/poezio2/logs
|
2023-09-06 02:22:26 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo (set_color 719cd6)"*** Copying desktop part ***"(set_color normal)
|
|
|
|
echo
|
2023-09-04 16:14:08 +02:00
|
|
|
if test -d $homes_path/desktop
|
|
|
|
pushd $homes_path
|
|
|
|
rsync --exclude=".*.swp" -av ./desktop/ ~/
|
|
|
|
popd
|
2023-09-03 00:44:13 +02:00
|
|
|
end
|
2023-09-04 16:14:08 +02:00
|
|
|
if test -d $homes_private_path/desktop
|
|
|
|
pushd $homes_private_path
|
|
|
|
rsync --exclude=".*.swp" -av ./desktop/ ~/
|
|
|
|
popd
|
2023-09-03 00:44:13 +02:00
|
|
|
end
|
2023-12-23 02:25:04 +01:00
|
|
|
sed -i "s:REPLACEHOME:$HOME:g" ~/.config/neomutt/neomuttrc
|
2023-09-04 16:14:08 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if functions -q update-homes-secrets
|
2023-09-10 01:48:28 +02:00
|
|
|
update-homes-secrets $_flag_desktop $_flag_root $_flag_fix_debian
|
2023-09-03 00:36:15 +02:00
|
|
|
end
|
|
|
|
end
|