summaryrefslogtreecommitdiffstats
path: root/scripts/install-cfg.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:56:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:56:50 +0000
commit8e9f8f2d0dcdddec35091ddbbdc79650763ec922 (patch)
tree4f88ed317d44fb4e5d9ab77e565bf1d910a8f560 /scripts/install-cfg.sh
parentInitial commit. (diff)
downloadlynx-8e9f8f2d0dcdddec35091ddbbdc79650763ec922.tar.xz
lynx-8e9f8f2d0dcdddec35091ddbbdc79650763ec922.zip
Adding upstream version 2.9.0dev.6.upstream/2.9.0dev.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/install-cfg.sh')
-rwxr-xr-xscripts/install-cfg.sh87
1 files changed, 87 insertions, 0 deletions
diff --git a/scripts/install-cfg.sh b/scripts/install-cfg.sh
new file mode 100755
index 0000000..a4228cd
--- /dev/null
+++ b/scripts/install-cfg.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+# $LynxId: install-cfg.sh,v 1.4 2018/03/21 16:20:42 tom Exp $
+# install lynx.cfg, ensuring the old config-file is saved to a unique file,
+# and prepending customizations to the newly-installed file.
+#
+# $1 = install program
+# $2 = file to install
+# $3 = where to install it
+PRG="$1"
+SRC=$2
+DST=$3
+
+LANG=C; export LANG
+LC_ALL=C; export LC_ALL
+LC_CTYPE=C; export LC_CTYPE
+LANGUAGE=C; export LANGUAGE
+
+if test -f "$DST" ; then
+ echo "** checking if you have customized $DST"
+ OLD=lynx-cfg.old
+ NEW=lynx-cfg.new
+ TST=lynx-cfg.tst
+ TMP=lynx-cfg.tmp
+ trap "rm -f $OLD $NEW $TST $TMP; exit 9" 1 2 5 15
+ rm -f $OLD $NEW $TST $TMP
+
+ # avoid propagating obsolete URLs into new installs
+ echo lynx.isc.org >$TMP
+ echo lynx.browser.org >$TMP
+ echo www.trill-home.com >>$TMP
+ echo www.cc.ukans.edu >>$TMP
+ echo www.ukans.edu >>$TMP
+ echo www.slcc.edu >>$TMP
+ echo sol.slcc.edu >>$TMP
+
+ # Make a list of the settings which are in the original lynx.cfg
+ # Do not keep the user's HELPFILE setting since we modify that in
+ # a different makefile rule.
+ egrep '^[ ]*[A-Za-z]' $SRC |sed -e 's/^[ ]*HELPFILE:.*/HELPFILE:/' >>$TMP
+ egrep '^[ ]*[A-Za-z]' $SRC |fgrep -v -f $TMP >$OLD
+ egrep '^[ ]*[A-Za-z]' $DST |fgrep -v -f $TMP >$TST
+
+ if test -s $TST ; then
+ cat >$TMP <<EOF
+## The following lines were saved from your previous configuration.
+
+EOF
+ cat $TST >>$TMP
+ cat $SRC >$NEW
+ cat $TMP >>$NEW
+
+ # See if we have saved this information before (ignoring the
+ # HELPFILE line).
+ if cmp -s $NEW $OLD
+ then
+ echo "... installed $DST would not be changed"
+ else
+ NUM=1
+ while test -f ${DST}-${NUM}
+ do
+ if cmp -s $NEW ${DST}-${NUM}
+ then
+ break
+ fi
+ NUM=`expr $NUM + 1`
+ done
+ if test ! -f ${DST}-${NUM}
+ then
+ echo "... saving old config as ${DST}-${NUM}"
+ mv $DST ${DST}-${NUM} || exit 1
+ fi
+ echo "** installing $NEW as $DST"
+ eval $PRG $NEW $DST || exit 1
+ fi
+ else
+ echo "... no customizations found"
+ echo "** installing $SRC as $DST"
+ eval $PRG $SRC $DST || exit 1
+ fi
+ rm -f $SKIP $OLD $NEW $TST $TMP
+elif cmp -s $SRC $DST
+then
+ echo "... installed $DST would not be changed"
+else
+ echo "** installing $SRC as $DST"
+ eval $PRG $SRC $DST || exit 1
+fi