mirror of
https://github.com/scopatz/nanorc
synced 2025-06-20 13:40:07 +02:00
Ended the lite instalation.
This commit is contained in:
parent
9d02e947b2
commit
00d9adafdd
71
install.sh
71
install.sh
@ -31,6 +31,8 @@ G_DEPS="unzip sed"
|
|||||||
G_FILE="${HOME}/.nanorc"
|
G_FILE="${HOME}/.nanorc"
|
||||||
G_REPO_MASTER="https://github.com/scopatz/nanorc/archive/master.zip"
|
G_REPO_MASTER="https://github.com/scopatz/nanorc/archive/master.zip"
|
||||||
G_REPO_RELEASE="https://github.com/scopatz/nanorc/archive/${G_VERSION}.zip"
|
G_REPO_RELEASE="https://github.com/scopatz/nanorc/archive/${G_VERSION}.zip"
|
||||||
|
G_NANO_VERSION="4.5"
|
||||||
|
G_NANO_NRC_DIR=""
|
||||||
unset G_LITE G_UNSTABLE G_VERBOSE G_DIR G_THEME
|
unset G_LITE G_UNSTABLE G_VERBOSE G_DIR G_THEME
|
||||||
|
|
||||||
# Exit Values Help
|
# Exit Values Help
|
||||||
@ -60,7 +62,7 @@ f_menu_usage(){
|
|||||||
printf "\n -t THEME"
|
printf "\n -t THEME"
|
||||||
printf "\n Give other theme for installation."
|
printf "\n Give other theme for installation."
|
||||||
printf "\n Default: scopatz"
|
printf "\n Default: scopatz"
|
||||||
printf "\n Options: nano, tpro"
|
printf "\n Options: nano, scopatz, tpro"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -133,28 +135,34 @@ f_set_variable(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get Nanorc's
|
||||||
|
# Get the not installed Nano's files.
|
||||||
|
# This function is only called in lite installation.
|
||||||
|
# Sources:
|
||||||
|
# http://mywiki.wooledge.org/ParsingLs
|
||||||
|
# https://unix.stackexchange.com/questions/70614/how-to-output-only-file-names-with-spaces-in-ls-al
|
||||||
|
# https://stackoverflow.com/questions/25156902/how-to-check-if-find-command-didnt-find-anything-bash-opensus
|
||||||
|
# https://stackoverflow.com/questions/59110820/find-operator-cant-go-up-in-directory
|
||||||
|
f_get_nanorcs(){
|
||||||
|
lite=""
|
||||||
|
|
||||||
|
cd nanorc/
|
||||||
|
for file in *; do
|
||||||
|
[ -e "$file" ] || continue
|
||||||
|
|
||||||
_update_nanorc(){
|
if [ -z $(find "../original/" -name "$file") ]; then
|
||||||
touch ~/.nanorc
|
lite=`printf "%s\ninclude %s" "$lite" "$file"`
|
||||||
|
|
||||||
# add all includes from ~/.nano/nanorc if they're not already there
|
|
||||||
while read -r inc; do
|
|
||||||
if ! grep -q "$inc" "${NANORC_FILE}"; then
|
|
||||||
printf "\n %s" "$inc" >> "$NANORC_FILE"
|
|
||||||
fi
|
fi
|
||||||
done < ~/.nano/nanorc
|
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
return "$lite"
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_nanorc_lite(){
|
|
||||||
sed -i '/include "\/usr\/share\/nano\/\*\.nanorc"/i include "~\/.nano\/*.nanorc"' "${NANORC_FILE}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
# Sources: https://www.cyberciti.biz/faq/download-a-file-with-curl-on-linux-unix-command-line/
|
# Sources:
|
||||||
|
# https://www.cyberciti.biz/faq/download-a-file-with-curl-on-linux-unix-command-line/
|
||||||
f_install(){
|
f_install(){
|
||||||
temp="temp.zip"
|
temp="temp.zip"
|
||||||
begin="# BEGIN"
|
begin="# BEGIN"
|
||||||
@ -201,29 +209,32 @@ f_install(){
|
|||||||
|
|
||||||
if [ "$G_LITE" = true ]; then
|
if [ "$G_LITE" = true ]; then
|
||||||
sed -n -i.bkp '/'"$begin"'/,/'"$end"'/ {
|
sed -n -i.bkp '/'"$begin"'/,/'"$end"'/ {
|
||||||
/'"$begin"'/n
|
/'"$begin"'/n # skip over the line that has "$begin" on it
|
||||||
/'"$end"'/ !{
|
/'"$end"'/ !{ # skip over the line that has "$end" on it
|
||||||
s/*//
|
s/*//
|
||||||
r
|
r '"${theme}/config"'
|
||||||
|
r f_get_nanorc
|
||||||
|
d
|
||||||
}
|
}
|
||||||
# r theme
|
|
||||||
# write the includes
|
|
||||||
}' "$G_FILE"
|
}' "$G_FILE"
|
||||||
|
|
||||||
_update_nanorc_lite
|
|
||||||
else
|
else
|
||||||
|
sed -n -i.bkp '/'"$begin"'/,/'"$end"'/ {
|
||||||
|
/'"$begin"'/n # skip over the line that has "$begin" on it
|
||||||
|
/'"$end"'/ !{ # skip over the line that has "$end" on it
|
||||||
|
s/*//
|
||||||
|
r '"${theme}/config"'
|
||||||
|
# TODO: add a line with only "include /nanorc/*"
|
||||||
|
d
|
||||||
|
}
|
||||||
|
}' "$G_FILE"
|
||||||
_update_nanorc
|
_update_nanorc
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# update.
|
# big change: update all nanorc's
|
||||||
# write comments, options, gui, rebindings, includes highlights (according theme)
|
|
||||||
# lite = maintains the nano nanorc files'
|
|
||||||
# get the list of nano's files and include only ours (exclude).
|
|
||||||
# big change: update all nanorc
|
|
||||||
# big change: install "only" the themed nanorc files and .nanorc
|
# big change: install "only" the themed nanorc files and .nanorc
|
||||||
|
|
||||||
# next: more shellcheck and get file and write it
|
# next:
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user