[update.sh]: refactory 2/2

This commit is contained in:
Jesús 2021-12-28 22:18:00 -05:00
parent b44c1de16b
commit 2f64548611
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766
2 changed files with 59 additions and 59 deletions

View File

@ -80,37 +80,38 @@ function updbashrc() {
"Get your HyperTerm copy on: https://hgit.conocimientoslibres.ga/software/hyperterm.git"
printf '%b\n' "$RESET"
else
if [[ $(_url_exists "$URL") -eq 0 ]]; then
# clone '--depth=1' not support cgit
(git clone $URL /tmp/hyperterm/ --depth=1 &> /dev/null)
printf '%s\r' "##### (33%)"
sleep 1
# core
for i in autocomplete.sh colors.sh git.sh languages.sh status.sh update.sh; do
install -m644 /tmp/hyperterm/hyperterm/core/$i "$HOME/.hyperterm/core/$i"
done
# themes
for i in default.sh joy.sh light_theme.sh minterm.sh pure.sh simple.sh special.sh; do
install -m644 /tmp/hyperterm/hyperterm/themes/$i "$HOME/.hyperterm/themes/$i"
done
# tools
(cp -f /tmp/hyperterm/hyperterm/tools/* "$HOME/.hyperterm/tools/" &> /dev/null)
case $(_url_exists "$URL") in
200)
# clone '--depth=1' not support cgit
(git clone $URL /tmp/hyperterm/ --depth=1 &> /dev/null)
printf '%s\r' "##### (33%)"
sleep 1
# core
for i in autocomplete.sh colors.sh git.sh languages.sh status.sh update.sh; do
install -m644 /tmp/hyperterm/hyperterm/core/$i "$HOME/.hyperterm/core/$i"
done
# themes
for i in default.sh joy.sh light_theme.sh minterm.sh pure.sh simple.sh special.sh; do
install -m644 /tmp/hyperterm/hyperterm/themes/$i "$HOME/.hyperterm/themes/$i"
done
# tools
(cp -f /tmp/hyperterm/hyperterm/tools/* "$HOME/.hyperterm/tools/" &> /dev/null)
for i in hyperterm.sh hyperterm.sha512; do
install -m644 /tmp/hyperterm/hyperterm/$i "$HOME/.hyperterm/$i"
done
(cp -f /tmp/hyperterm/.bash_profile "$HOME/" &> /dev/null)
printf '%s\r' "############# (66%)"
(ifexists_custom git &> /dev/null)
sleep 1
(rm -fr /tmp/hyperterm/)
printf '%s\n' "####################### (100%) done!"
source "$HOME/.bashrc"
else
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
"The repo is disabled or connection failed"
return 1
fi
for i in hyperterm.sh hyperterm.sha512; do
install -m644 /tmp/hyperterm/hyperterm/$i "$HOME/.hyperterm/$i"
done
(cp -f /tmp/hyperterm/.bash_profile "$HOME/" &> /dev/null)
printf '%s\r' "############# (66%)"
(ifexists_custom git &> /dev/null)
sleep 1
(rm -fr /tmp/hyperterm/)
printf '%s\n' "####################### (100%) done!"
source "$HOME/.bashrc" ;;
*)
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
"The repo is disabled or connection failed"
return 1 ;;
esac
fi
else
msg_err "No hay curl y git. Por favor, instale los programas para actualizar HyperTerm" \
@ -120,33 +121,32 @@ function updbashrc() {
}
function updbashrc_custom() {
_urls "$@"
if [[ $(_url_exists "$URL") -eq 0 ]]; then
while true
do
function _copy_c() {
if _which wget; then
wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
elif _which curl; then
curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
fi
}
question=$(msg "¿Estás seguro de sobre-escribir _custom.sh? [s/N]: " \
"Are you sure to overwrite _custom.sh? [y/N]: ")
read -r -p "$question" input
case $input in
[sS]|[yY]) _copy_c "$@"; break ;;
[nN]|"") break ;;
*) msg "Por favor responde sí o no" \
"Please answer yes or no.";;
esac
done
else
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
"The repo is disabled or connection failed"
return 1
fi
case $(_url_exists "$URL") in
200)
while true
do
function _copy_c() {
if _which wget; then
wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
elif _which curl; then
curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
fi
}
question=$(msg "¿Estás seguro de sobre-escribir _custom.sh? [s/N]: " \
"Are you sure to overwrite _custom.sh? [y/N]: ")
read -r -p "$question" input
case $input in
[sS]|[yY]) _copy_c "$@"; break ;;
[nN]|"") break ;;
*) msg "Por favor responde sí o no" \
"Please answer yes or no.";;
esac
done ;;
*)
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
"The repo is disabled or connection failed"
return 1
;;
esac
}

View File

@ -14,7 +14,7 @@ fab9d339a99c7d2e1809d1c44f533523c6bfcdcc8d63c62b335ce7d4c666c8bdd7ac319316bf71f0
7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh
065cfa39f1b4312ed275ad1039827a24f703176c653a8d27303d145f9d389a60ec5b3a9eb167e060cc6fd093b9c03cfb1a8b70254d444fbc6e62e2297d88b310 ./core/status.sh
7a832bc25b458eff5ac8d8e41fd8758f7405f7754e619cb2584f411c8819f37f04a65e1ffb9f061c7caa37ba61ef0818f8f6dbb4d05fd7374b1e38e5739a9c6c ./core/git.sh
8396521dc738545c1b412ed7a50723c3a816f1aa950795ff3bcdc05503e9545b99b4b6e9f6c872a493c258a652c15624b7eb76f2e6d3a0fe97ad3100a5e561f1 ./core/update.sh
dc94ae993a9cc982a790c9efca6ddfbc188595852291630be1fc0924a6c8d80acc35dfa58ea51c9893ef6ba26f0c91f79e1d70edab4d649e6521567dcf3f4135 ./core/update.sh
f3e00b2aa8ab9f3ab44570adaa2520408ed66fd00f551654d60b64a4be3546ec781b7efa39bcd774937e654b6ffb4c7af3f21eeb36caf9c01f82f85cf28e2b4d ./core/languages.sh
1cfba599047d84a17ff92b695ebf527a505a30acc9ec21a2b9f410a7ea6dde4b23b5cf62e557d82f2fe9a8980649942424b879ca53baae4d4cb3057681baa7b6 ./core/colors.sh
ab3089453e35cc38544dffe672d532cbd559634937893a053937b599175688aecc5f3caad3064e818b883b027f27713194e3909dc3ab0246922cea00557c595a ./hyperterm.sh