comparison packaging/linux-installer.inc.in @ 1040:43734932e2ea

(issue100) Fall back to system wide deinstallation when no local installation is found
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 04 Sep 2014 15:55:31 +0200
parents f5306f8c02f3
children 7bd1d723414d
comparison
equal deleted inserted replaced
1039:069f5e5344f6 1040:43734932e2ea
173 inst_default_prefix="$DEFAULT_PREFIX" 173 inst_default_prefix="$DEFAULT_PREFIX"
174 instcfg_path="${CFGPATH}" 174 instcfg_path="${CFGPATH}"
175 instdata_path="${DATAPATH}" 175 instdata_path="${DATAPATH}"
176 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart} 176 autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
177 startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications} 177 startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
178 if [ $DEINSTALL -eq 1 ] ; then
179 if [ ! -r ${instcfg_path}/${INSTCFGNAME} ]; then
180 if [ -r ${SYSCFGPATH}/${INSTCFGNAME} ]; then
181 # Fall back to system uninstallation if no user config found
182 SYSINST=1
183 init_vars
184 check_priv
185 fi
186 fi
187 fi
178 fi 188 fi
179 instcfg_file="${instcfg_path}/${INSTCFGNAME}" 189 instcfg_file="${instcfg_path}/${INSTCFGNAME}"
180 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX` 190 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX`
181 HOST_ARCH=$(uname -m) 191 HOST_ARCH=$(uname -m)
182 } 192 }
215 } 225 }
216 226
217 check_priv() 227 check_priv()
218 { 228 {
219 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then 229 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then
220 fatal "System wide installation requires root privileges!\n" 230 fatal "System wide installation or deinstallation requires root privileges!\n"
221 fi 231 fi
222 } 232 }
223 233
224 rm_empty_dirs() 234 rm_empty_dirs()
225 { 235 {
493 #====================================================================== 503 #======================================================================
494 # main() 504 # main()
495 trap cleanup EXIT 505 trap cleanup EXIT
496 506
497 parse_args "$@" 507 parse_args "$@"
508 check_priv
498 init_vars 509 init_vars
499 check_priv
500 read_oldinstcfg 510 read_oldinstcfg
501 511
502 cat <<EOF 512 cat <<EOF
503 ------------------------------------------------------------------------ 513 ------------------------------------------------------------------------
504 514

http://wald.intevation.org/projects/trustbridge/