From bd6e63dd7803fb0eed748605a2bd3aeb20d7040b Mon Sep 17 00:00:00 2001
From: Valentin Vidic
Date: Fri, 30 Sep 2011 15:42:31 +0200
Subject: [PATCH] Remove obsolete code.
---
doc/carnet-upgrade-src.sgml | 42 +--------
src/actions/main.queue | 13 +--
src/functions.sh | 211 +------------------------------------------
3 files changed, 7 insertions(+), 259 deletions(-)
diff --git a/doc/carnet-upgrade-src.sgml b/doc/carnet-upgrade-src.sgml
index 54d3c74..413aedf 100644
--- a/doc/carnet-upgrade-src.sgml
+++ b/doc/carnet-upgrade-src.sgml
@@ -104,7 +104,7 @@
Za više informacija o backupu MySQL baze pogledajte
.
+ id="http://dev.mysql.com/doc/refman/5.1/en/backup-and-recovery.html">.
@@ -122,7 +122,7 @@
Za više informacija o backupu PostgreSQL baze podataka pogledajte
.
+ id="http://www.postgresql.org/docs/8.4/static/backup.html">.
@@ -220,38 +220,6 @@ CN: run_actions (main) started...
-
- Prije nadogradnje na squeeze, potrebno je izvršiti
- prijelaz sa PHP inaÄice 4 na PHP 5. Ukoliko je na
- sustavu joÅ¡ uvijek instaliran PHP 4 pojavit Äe se
- poruka:
-
-
-+-----------------------------------------------------------------+
-| Nadogradnja CARNet Debian Lenny->Squeeze |
-+-----------------------------------------------------------------+
-| |
-| Prije prelaska na Debian Squeeze potrebno je napraviti |
-| nadogradnju sa PHP 4 na PHP 5. |
-| |
-| Pokrenite: |
-| # apt-get update |
-| # apt-get install php5-cn |
-| |
-| Nakon sto provjerite da sve web aplikacije rade ispravno, |
-| ponovno pozovite ovu skriptu. |
-| |
-+-----------------------------------------------------------------+
-| < U redu > |
-+-----------------------------------------------------------------+
-
-
- Lokalne izmjene u PHP 4 konfiguraciji treba ruÄno prenijeti
- u PHP 5 konfiguraciju. TakoÄer je potrebno instalirati PHP 5 inaÄice
- dodataka koji se koriste u web aplikacijama
- (npr. php5-mysql, php5-ldap).
-
-
U sljedeÄem koraku biti Äe izvrÅ¡ena provjera dali su najvažniji
servisi nadograÄeni na najnovije inaÄice u lenny
@@ -346,7 +314,7 @@ CN: run_actions (main) started...
+-----------------------------------------------------------------+
| Nadogradnja CARNet Debian Lenny->Squeeze |
+-----------------------------------------------------------------+
-| Prethodna inacica distribucije, CARNet Debian 2, donosila je |
+| Prethodna inacica distribucije, CARNet Debian 5, donosila je |
| neke pakete koji nisu nuzni za normalan rad posluzitelja. |
| Uklanjanje ovih aplikacija ubrzat ce proceduru nadogradnje i |
| smanjiti zauzece diskovnog prostora. Ukoliko zelite zadrzati |
@@ -529,7 +497,7 @@ CN: run_actions (main) started...
- /etc/mysql/my.cnf
- /etc/ntp.conf
- /etc/pam.d/*
-
- /etc/php4/*
+
- /etc/php5/*
- /etc/postgresql/postmaster.conf
- /etc/postgresql/postgresql.conf
- /etc/proftpd.conf
@@ -717,7 +685,7 @@ CN: run_actions (main) started...
- /etc/mysql/my.cnf
- /etc/ntp.conf
- /etc/pam.d/*
-
- /etc/php4/*
+
- /etc/php5/*
- /etc/postgresql/postmaster.conf
- /etc/postgresql/postgresql.conf
- /etc/proftpd.conf
diff --git a/src/actions/main.queue b/src/actions/main.queue
index d481e18..a9a408b 100644
--- a/src/actions/main.queue
+++ b/src/actions/main.queue
@@ -3,15 +3,12 @@ true first_warning
true check_my_version
true hold_carnet_upgrade
true install_keyrings # update current keys
-true check_php_version
true check_upgrade
-true check_grsec_kernel
true check_reboot
pkg x11-common 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
# instaliranih servisa za koje cemo na kraju provjeriti da li rade.
! check_services check check_services preupgrade
@@ -27,13 +24,8 @@ true apt_download # skini pakete
pkg monit disable_monit
true upgrade_libc
true install_keyrings # install new keys
-pkg udev upgrade_udev
# popravi konfiguracije koje stvaraju probleme
true restore_configs
-pkg skey-cn remove_skey
-# mrtg je zamjenjen sa munin
-pkg mrtg-cn post_upgrade pkgadd munin-cn
-pkg mrtg-cn pkgrm mrtg-cn
pkg munin-cn upgrade_munin
# konacno, instalacija novih paketa
#pkg openldap-aai prepare_openldap
@@ -43,18 +35,15 @@ pkg amavisd-new upgrade_amavis
pkg apache2-cn upgrade_apache2
pkg postfix-cn upgrade_postfix
pkg bind9-cn upgrade_bind
-# ntp i ntpdate se ne pokrenu ispravno bez lockanja
-pkg ntp && pkg ntpdate pkgadd lockfile-progs
true upgrade_postgresql
true upgrade first # neki paketi moraju rucno
true upgrade second # neke pakete zelimo ranije
-true remove_orphaned # ocisti stare libove nakon sto su cn paketi nadogradjeni
true dist_upgrade # instaliraj ostatak
true install_new # instaliraj nove
+true remove_orphaned # ocisti stare libove nakon sto su cn paketi nadogradjeni
# i ostatak
true add_group_proc # za oidentd
true pkgadd monit-cn
-true remove_php4
pkg kernel-2.6-cn dpkg-reconfigure kernel-2.6-cn
# ovo bi trebalo biti predzadnje na popisu
# - izvrsi sve uvjetne post_upgrade akcije
diff --git a/src/functions.sh b/src/functions.sh
index 5ea115d..90eed9d 100644
--- a/src/functions.sh
+++ b/src/functions.sh
@@ -35,24 +35,6 @@ log() {
chmod og= $logfile
}
-# find first free uid/gid in range
-# find_id passwd 100 999
-find_id() {
- local i db first last ids
- db=$1
- first=$2
- last=$3
- ids=$(getent $db | awk -F: "\$3 >= $first && \$3 <= $last {print \$3}")
- for i in $(seq $first $last)
- do
- if ! echo $ids | grep -q $i; then
- echo $i
- return 0
- fi
- done
- return 1
-}
-
# safe in-place s///
check_and_sed() {
[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
@@ -79,27 +61,6 @@ check_and_sed() {
return $ret
}
-#
-# Update uid for user from reserved system range (0-99) to dynamic system
-# range (100-999). Optionally update ownerships of given directories.
-# $0 user [directory ...]
-#
-check_and_update_ugid() {
- local user newgid newuid
- user=$1
- if [ "$(getent passwd $user | awk -F: '$3 >= 100 {print "ok"; exit 0}')" ]; then
- return 0
- fi
- shift
- newgid=$(find_id group 100 999)
- newuid=$(find_id passwd 100 999)
- # other directories/files
- chown -R $newuid:$newgid $*
- groupmod -g $newgid $user
- usermod -u $newuid -g $newgid $user
- log "Fixed $user user uid/gid."
-}
-
pkgadd () {
[ -n "$*" ] || return 0
log "Installing $* ..."
@@ -406,38 +367,6 @@ Nakon toga ponovno pozovite ovu skriptu."
fi
}
-# update sarge urls in sources list
-fix_sarge_sources () {
- local apt_sources='/etc/apt/sources.list'
- local fixed_sources=$(mktemp /var/lib/carnet-upgrade/sources.list.XXXXXX)
-
- # sarge (oldstable) was archived recently -> sources.list needs update
- awk -v archive='http://archive.debian.org/debian' \
- -v security='http://archive.debian.org/debian-security' \
- '$3 == "sarge" && $2 ~ /[/]debian$/ { $2 = archive }
- $3 == "sarge/updates" && $2 ~ /security\.debian\.org$/ { $2 = security }
- { print }' $apt_sources > $fixed_sources
-
- # did anything get updated
- if ! cmp $apt_sources $fixed_sources >/dev/null; then
- log "sources.list fixed to use archive.debian.org"
-
- # backup current version
- if [ ! -f "$apt_sources.$backup_ext.sarge" ]; then
- cp -av $apt_sources "$apt_sources.$backup_ext.sarge"
- fi
-
- # install fixed version
- cp -av $fixed_sources $apt_sources
-
- # update the database
- apt_update
- fi
-
- # delete temporary
- rm -f $fixed_sources
-}
-
# try to check if we are using the latest version of carnet-upgrade script
check_my_version () {
local packages latest_version
@@ -461,79 +390,6 @@ check_my_version () {
rm -f $packages
}
-# if php is installed make sure it's version 5
-check_php_version () {
-
- if pkg php4-cn && ! pkg php5-cn; then
- # prepare for php upgrade by installing php5 extensions
- install_php5_extensions
-
- notice "
-Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju sa PHP 4 na PHP 5.
-
-Pokrenite:
- # apt-get update
- # apt-get install php5-cn
-
-Nakon sto provjerite da sve web aplikacije rade ispravno, ponovno pozovite ovu skriptu."
- log "carnet-upgrade aborted, upgrade to php5-cn needed."
- exit 1
- fi
-}
-
-# install php5 extensions based on installed php4 extensions
-install_php5_extensions () {
- local php4_list php5_pkg
-
- # get a list of installed php4 packages
- php4_list=$(mktemp /var/lib/carnet-upgrade/php4_list.XXXXXX)
- dpkg -l php4-\* | awk '/^ii/ {
- pkg=$2; sub("^php4", "php5", pkg); print pkg }' > $php4_list
-
- # compare it with the list of available php5 packages
- php5_pkg=$(apt-cache search -n ^php5- | cut -d' ' -f 1 \
- | grep -F -x -f $php4_list | grep -F -x -v php5-cn)
-
- # handle special cases
- if pkg php4-xslt; then
- php5_pkg="$php5_pkg php5-xsl"
- fi
-
- # install the required php5 modules
- if [ "$php5_pkg" ]; then
- pkgadd $php5_pkg
- fi
-
- # cleanup
- rm -f $php4_list
-}
-
-# if grsec is installed make sure it is fresh
-check_grsec_kernel () {
- local ver=`uname -r`
-
- log "Kernel version: $ver"
- if [ "$ver" = "${ver%-grsec}" ]; then
- # not grsec variant
- return 0
- fi
-
- if [ "$ver" = "${ver#2.6.2[4-9]}" ]; then
- # kernel too old
- notice "
-Prije prelaska na Debian Squeeze potrebno je napraviti nadogradnju na najnoviji kernel.
-
-Pokrenite:
- # apt-get update
- # apt-get install kernel-2.6-cn
- # reboot
-
-Nakon toga ponovno pozovite ovu skriptu."
- log "carnet-upgrade aborted, kernel upgrade needed."
- exit 1
- fi
-}
-
check_reboot () {
reboot_required || return 0
@@ -745,22 +601,6 @@ backup_etc_dir () {
fi
}
-# fixaj /etc/default/raid2
-fix_etc_default_raid2 () {
- if [ -f /etc/default/raid2 ]; then
- sed "s/^AUTOSTART.*/AUTOSTART=true/g" /etc/default/raid2 > /etc/default/raid2.$backup_ext.$$
- chown --reference=/etc/default/raid2 /etc/default/raid2.$backup_ext.$$
- chmod --reference=/etc/default/raid2 /etc/default/raid2.$backup_ext.$$
-
- if ! cmp -s /etc/default/raid2.$backup_ext.$$ /etc/default/raid2; then
- log "Fixed /etc/default/raid2 AUTOSTART option."
- mv -v /etc/default/raid2.$backup_ext.$$ /etc/default/raid2
- else
- rm -v /etc/default/raid2.$backup_ext.$$
- fi
- fi
-}
-
# restore a configuration file if it contains only CN modifications
restore_file () {
local file file_expect file_restore file_backup
@@ -944,24 +784,6 @@ install_keyrings () {
apt_update
}
-# remove skey (not supported anymore)
-remove_skey () {
- pkgrm skey-cn libpam-skey
-
- if getent group skey > /dev/null; then
- groupdel skey || true
- log "groupdel skey"
- fi
-}
-
-# remove unsupported php version
-# but leave the configuration just in case
-remove_php4 () {
- if pkg php5-cn && pkg php4-common; then
- pkgrm_only php4-common
- fi
-}
-
# check if package is orphaned (nothing depends on it)
is_orphaned () {
local package deps
@@ -1030,7 +852,7 @@ pkgupgrade () {
# make a silent upgrade to new libc6
upgrade_libc () {
- DEBIAN_FRONTEND=noninteractive pkgupgrade libc6 libc6-dev tzdata
+ DEBIAN_FRONTEND=noninteractive pkgupgrade libc6 libc6-dev tzdata udev
}
# upgrade apache2/php5
@@ -1171,37 +993,6 @@ upgrade_munin () {
dpkg-reconfigure munin-cn
}
-# udev.preinst fails if devfs configs still exist
-upgrade_udev () {
- local config
-
- for config in /etc/udev/rules.d/devfs.rules \
- /etc/udev/rules.d/compat-full.rules \
- /etc/udev/rules.d/compat.rules
- do
- if [ -e $config ]; then
- rm -v -f $config
- fi
- done
-
- if [ -f /etc/udev/udev.rules -a ! -f /etc/udev/rules.d/udev.rules ]; then
- ln -sfv ../udev.rules /etc/udev/rules.d/
- fi
-
- pkgadd udev
-}
-
-# fix /etc/dpkg/dpkg.cfg
-comment_force_overwrite () {
- if [ -f /etc/dpkg/dpkg.cfg ]; then
- if check_and_sed '^force-overwrite' \
- 's,\(^force-overwrite\),#\1,' \
- /etc/dpkg/dpkg.cfg; then
- notice "$msg_comment_force_overwrite"
- fi
- fi
-}
-
# try not to overwrite user modified issue files
fix_issue () {
if cmp /etc/issue $cnup/files/etc/issue.expect.new >/dev/null; then
--
1.7.10.4