locale, move old dovecot conf with *
authorZeljko Boros <Zeljko.Boros@carnet.hr>
Sat, 8 May 2021 12:03:47 +0000 (14:03 +0200)
committerZeljko Boros <Zeljko.Boros@carnet.hr>
Sat, 8 May 2021 12:03:47 +0000 (14:03 +0200)
debian/control
debian/postinst
src/functions.sh

index 39fa38b..7b6b889 100644 (file)
@@ -9,7 +9,7 @@ Standards-Version: 3.9.8
 
 Package: carnet-upgrade
 Architecture: all
-Depends: dialog, wget, ${misc:Depends}
+Depends: dialog, wget, ${misc:Depends}, locales, carnet-tools-cn
 Description: CARNet distribution upgrade script
  This package provides carnet-upgrade, a helper script
  to facilitate upgrades between different versions
index 6413868..dd536da 100644 (file)
@@ -3,12 +3,49 @@
 set -e
 
 [ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
+
+# Load CARNET Tools
+. /usr/share/carnet-tools/functions.sh
 
 # clear old cached values
 if dpkg --compare-versions "$2" lt 6.0; then
     export CN_POSTINST=1
 fi
 
+# perl se buni ako nema postavljen defaultni locale
+# stavit cemo en_US.UTF-8
+
+if [ ! grep -q "^en_US.UTF-8 UTF-8" /etc/locale.gen ]; then
+       # generirat cemo najpotrebnije locale (HR, EN, te HR.UTF i EN.UTF8)
+       cp_check_and_sed '# en_US.UTF-8 UTF-8' \
+       's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' \
+       /etc/locale.gen || true
+                                  
+       cp_check_and_sed '# en_US ISO-8859-1' \
+       's/# en_US ISO-8859-1/en_US ISO-8859-1/g' \
+       /etc/locale.gen || true
+
+       cp_check_and_sed '# hr_HR ISO-8859-2' \
+       's/# hr_HR ISO-8859-2/hr_HR ISO-8859-2/g' \
+       /etc/locale.gen || true
+                                                                                                      
+       cp_check_and_sed '# hr_HR.UTF-8 UTF-8' \
+       's/# hr_HR.UTF-8 UTF-8/hr_HR.UTF-8 UTF-8/g' \
+       /etc/locale.gen || true
+
+       locale-gen      
+fi
+
+# Ako ima već neki default ne diramo ga
+if [ ! -f /etc/default/locale ]; then
+       cat > /etc/default/locale <<EOF
+LANG=en_US.UTF-8
+LANGUAGE="en_US:en"
+EOF
+       update-locale
+fi
+
 # Load debconf
 . /usr/share/debconf/confmodule
 db_version 2.0
index 95dc343..98fe327 100644 (file)
@@ -988,10 +988,10 @@ upgrade_dovecot() {
  # Funkcija koju je dodao Valentin da popravi propuste u dovecot-cn
  # Mičem zaostale konfiguracije iz conf.d i izlazim prije njegovih akcija jer ubiju certifikate
 
- echo "CN: Prebacujem stare konfiguracije za dovecot 95-cn\*-backup.conf u /var/backups..."
- test -f /etc/dovecot/conf.d/95-cn6-upgrade.conf && mv /etc/dovecot/conf.d/95-cn6-upgrade.conf /var/backups || true
- test -f /etc/dovecot/conf.d/95-cn7-upgrade.conf && mv /etc/dovecot/conf.d/95-cn7-upgrade.conf /var/backups || true
- test -f /etc/dovecot/conf.d/95-cn8-upgrade.conf && mv /etc/dovecot/conf.d/95-cn8-upgrade.conf /var/backups || true
+ test -f /etc/dovecot/conf.d/95-cn6-upgrade.conf && mv /etc/dovecot/conf.d/95-cn6-upgrade.conf* /var/backups || true
+ test -f /etc/dovecot/conf.d/95-cn7-upgrade.conf && mv /etc/dovecot/conf.d/95-cn7-upgrade.conf* /var/backups || true
+ test -f /etc/dovecot/conf.d/95-cn8-upgrade.conf && mv /etc/dovecot/conf.d/95-cn8-upgrade.conf* /var/backups || true
+ test -f /etc/dovecot/conf.d/95-cn9-upgrade.conf && mv /etc/dovecot/conf.d/95-cn9-upgrade.conf* /var/backups || true
    
  return 0