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

View File

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