X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=blobdiff_plain;f=src%2Ffunctions.sh;h=2b557d75d91cabe837dc12e7162255a5139fde7c;hb=1f6237172592f804666f42f4d0596e3b5ac4c5de;hp=2d3df43a0b08075189cb085a4bf0995634714c83;hpb=2220806fde634c565bbc2b1ca0be78cccacf0df6;p=carnet-upgrade.git diff --git a/src/functions.sh b/src/functions.sh index 2d3df43..2b557d7 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -933,7 +933,7 @@ remove_skey () { # remove unsupported php version remove_php4 () { # leave the configuration just in case - pkgrm_only php4-common + pkgrm_only php4-common || true } # check if package is orphaned (nothing depends on it) @@ -1039,7 +1039,7 @@ upgrade_amavis () { # handle freerdius config files upgrade upgrade_freeradius () { - local template config_new password realm + local template config_new password realm hostname basedn pkg freeradius-aai lt 2.1.3-0lenny0 || return 0 @@ -1047,10 +1047,24 @@ upgrade_freeradius () { restore_config freeradius-aai freeradius 2.1.3-0lenny0 \ /etc/freeradius/clients.conf \ /etc/freeradius/hints \ - /etc/freeradius/ldap.attrmap \ - /etc/freeradius/radiusd.conf + /etc/freeradius/ldap.attrmap # handle template based configs + template=/usr/share/carnet-upgrade/files/etc/freeradius/radiusd.conf.template + config_new=$(mktemp /var/lib/carnet-upgrade/radiusd.conf.XXXXXX) + basedn=$(sed -n '/^[[:space:]]*suffix[[:space:]]*/ { + s///; s/"//g; p; q }' /etc/ldap/slapd.conf) + hostname=$(hostname -f) + cp $template $config_new + sed -i "s/#HOSTNAME#/$hostname/" $config_new + sed -i "s/#BASEDN#/$basedn/" $config_new + if cmp -s $config_new /etc/freeradius/radiusd.conf >/dev/null; then + log "Restoring config file /etc/freeradius/radiusd.conf" + cp -v /usr/share/carnet-upgrade/files/etc/freeradius/radiusd.conf.restore \ + /etc/freeradius/radiusd.conf + fi + rm -f $config_new + template=/usr/share/carnet-upgrade/files/etc/freeradius/eap.conf.template config_new=$(mktemp /var/lib/carnet-upgrade/eap.conf.XXXXXX) password=$(grep -s '^[[:space:]]*private_key_password[[:space:]]*=' \ @@ -1142,7 +1156,7 @@ upgrade_postgresql () { # upgrade the MTA upgrade_postfix () { - pkgadd postfix-cn + pkgadd sasl2-bin postfix-cn if pkg postgrey; then pkgrm postgrey # not used by postfix-cn anymore