Fixes update script
This commit is contained in:
79
update.sh
79
update.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
65;6800;1c65;6800;1c
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
function print_help() {
|
function print_help() {
|
||||||
@@ -8,9 +8,11 @@ function print_help() {
|
|||||||
Installs and updates shared configuration on a system. Options are:
|
Installs and updates shared configuration on a system. Options are:
|
||||||
|
|
||||||
-h/--help : print this help
|
-h/--help : print this help
|
||||||
|
--reinstall : force reinstallation
|
||||||
-g/--gnome : system is intended to run in a GNOME environement, and
|
-g/--gnome : system is intended to run in a GNOME environement, and
|
||||||
will setup gnome-terminal accordingly. Do not
|
will setup gnome-terminal accordingly. Do not
|
||||||
activate on headless system.
|
activate on headless system.
|
||||||
|
--font : Installs font for gnome environment (selected if --gnome)
|
||||||
-v/--verbose : prints command before running them
|
-v/--verbose : prints command before running them
|
||||||
-n/--dry : dry run, do not execute commands. Implies --verbose.
|
-n/--dry : dry run, do not execute commands. Implies --verbose.
|
||||||
"
|
"
|
||||||
@@ -21,14 +23,25 @@ function exit_error() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GNOME=false
|
GNOME=false
|
||||||
|
FONT=false
|
||||||
VERBOSE=false
|
VERBOSE=false
|
||||||
DRY=false
|
DRY=false
|
||||||
|
REINSTALL=false
|
||||||
|
|
||||||
|
function set_reinstall_on() {
|
||||||
|
REINSTALL=true
|
||||||
|
}
|
||||||
|
|
||||||
function set_gnome_on() {
|
function set_gnome_on() {
|
||||||
GNOME=true
|
GNOME=true
|
||||||
|
FONT=true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_font_on() {
|
||||||
|
FONT=true
|
||||||
|
}
|
||||||
|
|
||||||
function set_verbose_on() {
|
function set_verbose_on() {
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
}
|
}
|
||||||
@@ -43,12 +56,18 @@ do
|
|||||||
case "${optchar}" in
|
case "${optchar}" in
|
||||||
-)
|
-)
|
||||||
case "${OPTARG}" in
|
case "${OPTARG}" in
|
||||||
|
reinstall)
|
||||||
|
set_reinstall_on
|
||||||
|
;;
|
||||||
gnome)
|
gnome)
|
||||||
set_gnome_on
|
set_gnome_on
|
||||||
;;
|
;;
|
||||||
verbose)
|
verbose)
|
||||||
set_verbose_on
|
set_verbose_on
|
||||||
;;
|
;;
|
||||||
|
font)
|
||||||
|
set_font_on
|
||||||
|
;;
|
||||||
dry)
|
dry)
|
||||||
set_dry_on
|
set_dry_on
|
||||||
;;
|
;;
|
||||||
@@ -162,44 +181,62 @@ function use_direnv() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function use_starship() {
|
function use_starship() {
|
||||||
echo "--- Ensuring starship is installed"
|
echo "--- Ensuring starship is installed"
|
||||||
if ! which starship 1>/dev/null
|
if which starship 1>/dev/null
|
||||||
then
|
then
|
||||||
echo "+++ Installing starship"
|
|
||||||
run curl -sS https://starship.rs/install.sh | sh
|
|
||||||
else
|
|
||||||
echo "+++ Starship is installed"
|
echo "+++ Starship is installed"
|
||||||
fi
|
if ! $REINSTALL
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "+++ Reinstalling starship"
|
||||||
|
fi
|
||||||
|
echo "+++ Installing starship"
|
||||||
|
if $VERBOSE
|
||||||
|
then
|
||||||
|
echo "[curl -sS https://starship.rs/install.sh | sh -s -- --yes]"
|
||||||
|
fi
|
||||||
|
if ! $DRY
|
||||||
|
then
|
||||||
|
curl -sS https://starship.rs/install.sh | sh -s -- --yes
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_ubuntu_mono_nerd() {
|
function install_ubuntu_mono_nerd() {
|
||||||
echo "--- Ensuring Ubuntu Mono Nerd font is present"
|
echo "--- Ensuring Ubuntu Mono Nerd font is present"
|
||||||
if ! fc-list | grep "UbuntuMono Nerd Font" 1>/dev/null
|
|
||||||
then
|
|
||||||
run mkdir -p ~/.local/share/fonts
|
|
||||||
pushd ~/.local/share/fonts
|
|
||||||
echo "Fetching UbuntuMono Nerd Font"
|
|
||||||
curl -fL -o "Ubuntu Mono Nerd Font Complete Mono.ttf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/UbuntuMono/Regular/complete/Ubuntu%20Mono%20Nerd%20Font%20Complete%20Mono.ttf
|
|
||||||
popd
|
|
||||||
run fc-cache -f
|
|
||||||
else
|
|
||||||
echo "+++ UbuntuMono Nerd font is installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e /usr/share/terminfo/x/xterm-direct ]
|
if [ ! -e /usr/share/terminfo/x/xterm-direct ]
|
||||||
then
|
then
|
||||||
run sudo apt-get install -y ncurses-term
|
run sudo apt-get install -y ncurses-term
|
||||||
else
|
else
|
||||||
echo "+++ xterm-direct is in terminfo database"
|
echo "+++ xterm-direct is in terminfo database"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if fc-list | grep "UbuntuMono Nerd Font" 1>/dev/null
|
||||||
|
then
|
||||||
|
echo "+++ UbuntuMono Nerd font is installed"
|
||||||
|
if ! $REINSTALL
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "+++ Reinstalling UbuntuMono Nerd font"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "+++ Fetching UbuntuMono Nerd Font"
|
||||||
|
run mkdir -p ~/.local/share/fonts
|
||||||
|
pushd ~/.local/share/fonts
|
||||||
|
run curl -fL -o Ubuntu_Mono_Nerd_Font_Complete_Mono.ttf https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/UbuntuMono/Regular/complete/Ubuntu%20Mono%20Nerd%20Font%20Complete%20Mono.ttf
|
||||||
|
popd
|
||||||
|
run fc-cache -f
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_deps() {
|
function install_deps() {
|
||||||
use_fish
|
use_fish
|
||||||
use_direnv
|
use_direnv
|
||||||
use_starship
|
use_starship
|
||||||
if $GNOME
|
if $FONT
|
||||||
then
|
then
|
||||||
install_ubuntu_mono_nerd
|
install_ubuntu_mono_nerd
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user