mirror of
https://github.com/scopatz/nanorc
synced 2024-11-27 20:35:53 +01:00
Fix broken install script
This commit is contained in:
parent
59441c7f5a
commit
3fe0e54a36
29
install.sh
29
install.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
function _fetch_sources() {
|
|
||||||
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
||||||
if [ ! -d ~/.nano/ ]
|
if [ ! -d ~/.nano/ ]
|
||||||
then
|
then
|
||||||
|
@ -13,40 +13,17 @@ function _fetch_sources() {
|
||||||
mv nanorc-master/* ./
|
mv nanorc-master/* ./
|
||||||
rm -rf nanorc-master
|
rm -rf nanorc-master
|
||||||
rm /tmp/nanorc.zip
|
rm /tmp/nanorc.zip
|
||||||
}
|
|
||||||
|
|
||||||
function _update_nanorc() {
|
|
||||||
if [ ! -f ~/.nanorc ]
|
if [ ! -f ~/.nanorc ]
|
||||||
then
|
then
|
||||||
touch ~/.nanorc
|
touch ~/.nanorc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add all includes from ~/.nano/nanorc if they're not already there
|
# add all includes from ~/.nano/nanorc if they're not already there
|
||||||
|
NANORC_FILE=~/.nanorc
|
||||||
while read inc; do
|
while read inc; do
|
||||||
if ! grep -q "$inc" "${NANORC_FILE}"; then
|
if ! grep -q "$inc" "${NANORC_FILE}"; then
|
||||||
echo "$inc" >> $NANORC_FILE
|
echo "$inc" >> $NANORC_FILE
|
||||||
fi
|
fi
|
||||||
done < ~/.nano/nanorc
|
done < ~/.nano/nanorc
|
||||||
}
|
|
||||||
|
|
||||||
function _update_nanorc_lite() {
|
|
||||||
sed -i '/include "\/usr\/share\/nano\/\*\.nanorc"/i include "~\/.nano\/*.nanorc"' "${NANORC_FILE}"
|
|
||||||
}
|
|
||||||
|
|
||||||
NANORC_FILE=~/.nanorc
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
-l|--lite)
|
|
||||||
UPDATE_LITE=1;;
|
|
||||||
-h|--help)
|
|
||||||
echo "Install script for nanorc syntax highlights"
|
|
||||||
echo "Call with -l or --lite to update .nanorc with secondary precedence to existing .nanorc includes"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
_fetch_sources;
|
|
||||||
if [[ $UPDATE_LITE ]]; then
|
|
||||||
_update_nanorc_lite;
|
|
||||||
else
|
|
||||||
_update_nanorc;
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user