From: Valentin Vidic
Date: Fri, 6 Feb 2009 14:48:51 +0000 (+0100)
Subject: Added dialog for CN service removal.
X-Git-Tag: debian/5.0.0~75
X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=52549f701db44118d4691cf59478299fbc1e830a;p=carnet-upgrade.git
Added dialog for CN service removal.
---
diff --git a/doc/carnet-upgrade-src.sgml b/doc/carnet-upgrade-src.sgml
index f12c44f..c8d60bd 100644
--- a/doc/carnet-upgrade-src.sgml
+++ b/doc/carnet-upgrade-src.sgml
@@ -366,6 +366,37 @@ CN: run_actions (main) started...
+ SljedeÄi korak nadogradnje nudi moguÄnost brisanja nekoriÅ¡tenih
+ servisa sa poslužitelja:
+
+
++-----------------------------------------------------------------+
+| Nadogradnja CARNet Debian Sarge->Etch |
++-----------------------------------------------------------------+
+| Standardna instalacija CARNet Debian distribucije donosi |
+| podrsku za veci broj razlicitih servisa. U ovom koraku nudi |
+| se mogucnost uklanjanja nekoristenih servisa sa vaseg |
+| posluzitelja. Uklanjanjem nekoristenih servisa smanjit ce se |
+| mogucnost problema i ubrzati procedura nadogradnje. Ukoliko |
+| zelite ukloniti neki od navedenih servisa ukljucite oznaku |
+| ispred imena odgovarajuceg paketa. |
+| |
+| Sljedeci servisi bit ce UKLONJENI: |
+| +-------------------------------------------------------------+ |
+| | [ ] amavisd-cn | |
+| | [ ] bind9-cn | |
+| | [ ] clamav-cn | |
+| | [ ] dovecot-cn | |
+| | [ ] mailman-cn | |
+| | [ ] munin-cn | |
+| +-------------------.(+)--------------------------------------+ |
++-----------------------------------------------------------------+
+| < U redu > |
++-----------------------------------------------------------------+
+
+
+
+
S obzirom na važnost podataka u LDAP imeniku, skripta radi backup
OpenLDAP (slapd) baze. Nove inaÄice paketa bi trebale
neometano nastaviti raditi sa postojeÄim sadržajem baze, pa ovaj
diff --git a/src/actions/main.queue b/src/actions/main.queue
index 3b93066..6fdc6ac 100644
--- a/src/actions/main.queue
+++ b/src/actions/main.queue
@@ -7,6 +7,7 @@ true check_upgrade
true check_grsec_kernel
pkg xlibs remove_x
true remove_bloat
+true remove_cn_bloat
true apt_listchanges disable
true comment_force_overwrite # ruzna opcija za dpkg
# ovo bi trebao biti zadnji post_upgrade - spremi popis
diff --git a/src/data.sh b/src/data.sh
index 8ee53be..a3457b6 100644
--- a/src/data.sh
+++ b/src/data.sh
@@ -79,6 +79,20 @@ snort snort snort-cn snort-central-cn
stari CN paketi autoconf-cn automake-cn bison-cn bitchx-cn chkrootkit-cn cvs-cn diff-cn elinks-cn expect-cn file-cn flex-cn gawk-cn gdb-cn gettext-cn gnupg-cn grep-cn iptraf-cn jed-cn joe-cn jre-cn less-cn lftp-cn logcheck-cn logrotate-cn lsof-cn ltrace-cn lynx-cn make-cn mutt-cn netcat-cn nmap-cn ntop-cn openssl-cn perl-cn procmail-cn python-cn razor-cn screen-cn slrn-cn strace-cn stunnel-cn sudo-cn sys-mon-cn tcpdump-cn telnet-ssl-cn telnetd-ssl unace-cn vim-cn wget-cn wv-cn ytalk-cn zsh-cn
usbmgr usbmgr
'
+# CN services to offer for removal
+cn_bloats='
+amavisd-cn amavisd-new
+bind9-cn bind9
+clamav-cn clamav-daemon clamav-freshclam clamav
+dovecot-cn dovecot dovecot-imapd dovecot-pop3d dovecot-common
+mailman-cn mailman
+munin-cn munin munin-node
+mysql-cn mysql-client mysql-server
+samba-cn samba smbclient
+squid-cn squid
+vsftpd-cn vsftpd
+xinetd-cn xinetd
+'
# Check if these services are running after upgrade
# package-cn user proces (pazi, regexp) nice name
diff --git a/src/functions.sh b/src/functions.sh
index 970d3db..ccbb79b 100644
--- a/src/functions.sh
+++ b/src/functions.sh
@@ -105,7 +105,7 @@ pkgadd () {
pkgrm () {
[ -n "$*" ] || return 0
- log "Removing $* ..."
+ log "Purging $* ..."
apt-get -y$s --purge remove $* || {
dpkg --configure -a
apt-get -yf install
@@ -113,6 +113,17 @@ pkgrm () {
}
}
+pkgrm_only () {
+ [ -n "$*" ] || return 0
+ log "Removing $* ..."
+ apt-get -y$s remove $* || {
+ dpkg --configure -a
+ apt-get -yf install
+ apt-get -y$s remove $*
+ }
+}
+
+
apt_update() {
log "Running apt-get update ..."
apt-get -y$s update || {
@@ -202,6 +213,57 @@ remove_bloat() {
eval pkgrm $pkgs_to_remove
}
+remove_cn_bloat() {
+ local installed pkg cn_pkgs dialog_list selection cn_del to_del del_pkgs
+
+ # get installed packages
+ installed=$(mktemp /var/lib/carnet-upgrade/pkglist.XXXXXX)
+ COLUMNS=200 dpkg -l | awk '$1 ~ /^.i/ { print $2 }' >$installed
+
+ # detect installed CN packagees
+ for pkg in $(echo "$cn_bloats" | cut -d' ' -f1); do
+ if grep -qx $pkg $installed; then
+ cn_pkgs="$cn_pkgs $pkg"
+ dialog_list="$dialog_list $pkg '' off"
+ fi
+ done
+ rm -f $installed
+
+ # report status or finish if no CN packages found
+ if [ "$cn_pkgs" ]; then
+ log "Found CN packages:$cn_pkgs"
+ else
+ log "No CN packages found."
+ return
+ fi
+
+ # user selects the packages to delete
+ selection=$(mktemp /var/lib/carnet-upgrade/selection.XXXXXX)
+ eval LC_MESSAGES=hr_HR dialog --nocancel --backtitle \""$title"\" \
+ --checklist \""$msg_remove_cn_bloat"\" 20 75 6 $dialog_list 2>$selection
+
+ # expand the package list to include the services
+ for pkg in $(cat $selection); do
+ pkg=${pkg%\"}
+ pkg=${pkg#\"}
+ cn_del="$cn_del $pkg"
+ to_del=$(echo "$cn_bloats" | grep ^$pkg)
+ del_pkgs="$del_pkgs $to_del"
+ done
+ rm -f $selection
+
+ # report selection or finish if no service selected
+ if [ "$cn_del" ]; then
+ log "Removing CN services:$cn_del"
+ else
+ log "No CN services selected for removal."
+ return
+ fi
+
+ # delete the cn packages and relevant services
+ pkgrm_only $del_pkgs
+}
+
post_upgrade() {
touch "$post_upgrade_queuetab"
if ! grep -q "true $*" "$post_upgrade_queuetab"; then
diff --git a/src/messages.sh b/src/messages.sh
index a133b08..e4bd99e 100644
--- a/src/messages.sh
+++ b/src/messages.sh
@@ -4,16 +4,14 @@ title="Nadogradnja CARNet Debian Sarge->Etch"
msg_first_warning="PAZNJA! PAZNJA!
-Pokrenuli ste proceduru nadogradnje CARNet Debian distribucije.
-Podsjecamo Vas da prije ove skripte svakako pokrenete 'apt-get
-dist-upgrade'. Strogo preporucujemo i backup cijelog sustava, s
-posebnim naglaskom na instalirane baze podataka poput MySQL i
-PostgreSQL.
+Pokrenuli ste proceduru nadogradnje CARNet Debian distribucije. Podsjecamo \
+Vas da prije ove skripte svakako pokrenete 'apt-get dist-upgrade'. Strogo \
+preporucujemo i backup cijelog sustava, s posebnim naglaskom na instalirane \
+baze podataka poput MySQL i PostgreSQL.
-Takodjer pazljivo procitajte dokumentaciju za ovu nadogradnju
-koja se nalazi u:
-
- /usr/share/doc/carnet-upgrade/
+Takodjer pazljivo procitajte dokumentaciju koja se nalazi u \
+/usr/share/doc/carnet-upgrade/ ili na web adresi \
+http://sistemac.carnet.hr/system/files/carnet-upgrade.pdf
Zelite li nastaviti?"
@@ -32,6 +30,15 @@ iskljucite oznaku pored njenog imena.
Sljedece aplikacije bit ce UKLONJENE:"
+msg_remove_cn_bloat="Standardna instalacija CARNet Debian distribucije donosi podrsku za veci broj \
+razlicitih servisa. U ovom koraku nudi se mogucnost uklanjanja nekoristenih \
+servisa sa vaseg posluzitelja. Uklanjanjem nekoristenih servisa smanjit ce \
+se mogucnost problema i ubrzati procedura nadogradnje. Ukoliko zelite ukloniti \
+neki od navedenih servisa ukljucite oznaku ispred imena odgovarajuceg paketa.
+
+Sljedeci servisi bit ce UKLONJENI:
+"
+
msg_comment_force_overwrite="U vasem /etc/dpkg/dpkg.cfg je pronadjena opcija\
force-overwrite koja nije preporucljiva za uobicajen rad. Ukoliko\
zelite, odkomentirajte je nakon zavrsetka rada skripte."