diff -Naur old/install-font.sh new/install-font.sh --- old/install-font.sh 2020-04-01 16:11:12.000000000 -0400 +++ new/install-font.sh 2020-04-27 22:27:09.204599228 -0400 @@ -33,7 +33,7 @@ printf < /dev/null 2>&1 || { @@ -471,7 +465,7 @@ : } -while getopts ":C:cdDF:f:hHlps" opt +while getopts ":C:cndDF:f:hHlpP:s" opt do case "$opt" in c) @@ -484,6 +478,9 @@ copy_dir=${OPTARG} [ -d ${copy_dir} ] || error no_dir ;; + n) + dont_copy=yes + ;; d) install_in_devpdf=yes ;; @@ -520,6 +517,11 @@ l) loc_or_sysdir=/usr/local/share/groff ;; + P) + option=P + check_optarg + loc_or_sysdir=${OPTARG} + ;; p) alias mv='mv -i' alias ln='ln -i' @@ -550,6 +552,19 @@ exit 1 } +if [ ! -w "$loc_or_sysdir" ] ; then + # need write access to $loc_or_sysdir + + scriptname=`basename $0` + printf \ +"You don't have write access to ${loc_or_sysdir} +Superuser priviledges required.\nRerun as \ +'\033[33msudo ${scriptname} \033[4margs\033[0m' \ +or \ +'\033[33msu root -c \"${scriptname} \033[4margs\033[0m\033[33m\"\033[0m'\n" + exit 126 +fi + devps=${loc_or_sysdir}/${version}/font/devps devpdf=${loc_or_sysdir}/${version}/font/devpdf site_font_devps=${loc_or_sysdir}/site-font/devps @@ -629,24 +644,25 @@ # copy input file to a system or named directory - if [ ! "$copy_orig" ] ; then - printf \ -"Copy \033[36m${file}\033[0m to ${copy_dir}/${family}/?\n (y/n; default = n) " - read copy_file + if [ ! "$dont_copy" ] ; then + if [ ! "$copy_orig" ] ; then + printf \ + "Copy \033[36m${file}\033[0m to ${copy_dir}/${family}/?\n (y/n; default = n) " + read copy_file - case "$copy_file" in - Y | y | YES | Yes | yes) - copy_file - ;; - * ) - printf \ -"Install \033[36m${file}\033[0m manually to make it available system-wide.\n" - ;; - esac - else - copy_file + case "$copy_file" in + Y | y | YES | Yes | yes) + copy_file + ;; + * ) + printf \ + "Install \033[36m${file}\033[0m manually to make it available system-wide.\n" + ;; + esac + else + copy_file + fi fi - unset append_style unset ext unset font