|
|
@ -6,6 +6,33 @@ BASEDIR=$(dirname $0) |
|
|
|
|
|
|
|
|
## FUNCTIONS |
|
|
## FUNCTIONS |
|
|
|
|
|
|
|
|
|
|
|
function exit { |
|
|
|
|
|
on_exit $1 true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function on_exit { |
|
|
|
|
|
local error_code bypass_last_call stack_lines |
|
|
|
|
|
error_code=$1 |
|
|
|
|
|
|
|
|
|
|
|
bypass_last_call=${2:-false} |
|
|
|
|
|
stack_lines=("${BASH_LINENO[@]}") |
|
|
|
|
|
$bypass_last_call && stack_lines=("${stack_lines[@]:1}") |
|
|
|
|
|
|
|
|
|
|
|
# remove 1 on head list |
|
|
|
|
|
[[ ${#stack_lines[@]} > 0 && ${stack_lines[0]} == 1 ]] && unset stack_lines[0] |
|
|
|
|
|
|
|
|
|
|
|
# remove 0 on tail list |
|
|
|
|
|
[[ ${#stack_lines[@]} > 0 && ${stack_lines[-1]} == 0 ]] && unset stack_lines[-1] |
|
|
|
|
|
|
|
|
|
|
|
if [[ $error_code > 0 ]]; then |
|
|
|
|
|
printf "\nEXIT #${error_code} due to error at line ${stack_lines[*]} : \n-----------------------------------------\n" |
|
|
|
|
|
trap - ERR TERM INT EXIT |
|
|
|
|
|
builtin exit "${error_code}" |
|
|
|
|
|
else |
|
|
|
|
|
echo SUCCESS |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function assert_debian13 { |
|
|
function assert_debian13 { |
|
|
test -f /etc/debian_version && |
|
|
test -f /etc/debian_version && |
|
|
grep --quiet ^13\. /etc/debian_version || |
|
|
grep --quiet ^13\. /etc/debian_version || |
|
|
@ -18,7 +45,6 @@ function assert_gnome_desktop { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_ghostty { |
|
|
function install_ghostty { |
|
|
|
|
|
|
|
|
if ! command -v ghostty >/dev/null; then |
|
|
if ! command -v ghostty >/dev/null; then |
|
|
curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | |
|
|
curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | |
|
|
sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg |
|
|
sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg |
|
|
@ -40,7 +66,12 @@ function install_ghostty { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_homebrew { |
|
|
function install_homebrew { |
|
|
|
|
|
|
|
|
|
|
|
# $nope |
|
|
|
|
|
# exit 11 |
|
|
|
|
|
# echo AAA |
|
|
|
|
|
raise_error 'BBB' |
|
|
|
|
|
false |
|
|
|
|
|
echo BBB |
|
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
|
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -48,7 +79,12 @@ function raise_error { |
|
|
message=${1:-an undefined error has occured!} |
|
|
message=${1:-an undefined error has occured!} |
|
|
code=${2:-1} |
|
|
code=${2:-1} |
|
|
echo "error ${code}: ${message}" >&2 |
|
|
echo "error ${code}: ${message}" >&2 |
|
|
exit "${code}" |
|
|
|
|
|
|
|
|
echo "FUNCNAME: ${FUNCNAME[@]}" >&2 # inner outer main |
|
|
|
|
|
echo "BASH_SOURCE: ${BASH_SOURCE[@]}" script.sh script.sh script.sh >&2 |
|
|
|
|
|
echo "BASH_LINENO: ${BASH_LINENO[@]}" 52 55 0 >&2 |
|
|
|
|
|
trap - ERR TERM INT EXIT |
|
|
|
|
|
# builtin exit "${code}" |
|
|
|
|
|
on_exit $code true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function set_alternative { |
|
|
function set_alternative { |
|
|
@ -73,7 +109,7 @@ function set_alternative { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function configure_default { |
|
|
function configure_default { |
|
|
# CAPS LOCK means ESC() |
|
|
|
|
|
|
|
|
# CAPS LOCK means ESC |
|
|
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" |
|
|
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" |
|
|
|
|
|
|
|
|
set_alternative editor nvim |
|
|
set_alternative editor nvim |
|
|
@ -103,24 +139,23 @@ function install_neovim { |
|
|
local shellrc alias_expr |
|
|
local shellrc alias_expr |
|
|
shellrc="$HOME/.bashrc" |
|
|
shellrc="$HOME/.bashrc" |
|
|
if ! grep -q nvim-vanilla "$shellrc"; then |
|
|
if ! grep -q nvim-vanilla "$shellrc"; then |
|
|
alias_expr="alias nvim-vanilla='NVIM_APPNAME=nvim-vanilla nvim'" |
|
|
|
|
|
echo "$alias_expr" >>"$shellrc" |
|
|
|
|
|
eval "$alias_expr" |
|
|
|
|
|
|
|
|
echo "alias nvim-vanilla='NVIM_APPNAME=nvim-vanilla nvim'" >>"$shellrc" |
|
|
echo 'nvim-vanilla created!' |
|
|
echo 'nvim-vanilla created!' |
|
|
|
|
|
RELOAD_SHELL=true |
|
|
else |
|
|
else |
|
|
echo 'nvim-vanilla ready!' |
|
|
echo 'nvim-vanilla ready!' |
|
|
fi |
|
|
fi |
|
|
|
|
|
exit 3 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
## MAIN |
|
|
## MAIN |
|
|
set -Eue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -TEue |
|
|
|
|
|
trap 'on_exit $?' ERR TERM INT EXIT |
|
|
|
|
|
|
|
|
assert_debian13 |
|
|
assert_debian13 |
|
|
assert_gnome_desktop |
|
|
assert_gnome_desktop |
|
|
|
|
|
|
|
|
echo "MIAOU-DESKTOP installation..." |
|
|
|
|
|
|
|
|
|
|
|
install_ghostty |
|
|
install_ghostty |
|
|
# install_homebrew |
|
|
|
|
|
install_neovim |
|
|
|
|
|
|
|
|
install_homebrew |
|
|
|
|
|
# install_neovim |
|
|
configure_default |
|
|
configure_default |
|
|
echo SUCCESS |
|
|
|