From: Valentin Vidic Date: Fri, 14 Dec 2007 08:42:26 +0000 (+0100) Subject: Initial version. X-Git-Tag: debian/4.0.1~109 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=c0c7b74b2c994d84c50ec6fa6837a73560c04abf;p=carnet-upgrade.git Initial version. --- c0c7b74b2c994d84c50ec6fa6837a73560c04abf diff --git a/usr/sbin/carnet-upgrade b/usr/sbin/carnet-upgrade new file mode 120000 index 0000000..ba02462 --- /dev/null +++ b/usr/sbin/carnet-upgrade @@ -0,0 +1 @@ +../share/carnet-upgrade/cn-upgrade \ No newline at end of file diff --git a/usr/sbin/cn-upgrade b/usr/sbin/cn-upgrade new file mode 120000 index 0000000..15495f9 --- /dev/null +++ b/usr/sbin/cn-upgrade @@ -0,0 +1 @@ +carnet-upgrade \ No newline at end of file diff --git a/usr/share/carnet-upgrade/actions/apt.queue b/usr/share/carnet-upgrade/actions/apt.queue new file mode 100644 index 0000000..39f9149 --- /dev/null +++ b/usr/share/carnet-upgrade/actions/apt.queue @@ -0,0 +1,6 @@ +# last update: 2005-07-03 +# +# Konfiguracija apt-a +! pkg apt-cn pkgadd apt-cn # 2.1.6 +pkg apt-cn lt 2.1.1 pkgadd apt-cn # 2.1.6 +pkg apt-cn ge 2.1.1 sarge_sources_list # 2.1.7 update diff --git a/usr/share/carnet-upgrade/actions/main.queue b/usr/share/carnet-upgrade/actions/main.queue new file mode 100644 index 0000000..c9560b9 --- /dev/null +++ b/usr/share/carnet-upgrade/actions/main.queue @@ -0,0 +1,49 @@ +# last update: 2005-01-07 +# Ivan 'ico' Rako +# Zoran Dzelajlija +true first_warning +true check_upgrade +true remove_bloat +true comment_force_overwrite # ruzna opcija za dpkg +pkg libpam-skey pkgrm libpam-skey +pkg skey-cn pkgrm skey-cn +pkg getunix pkgrm getunix # obsolete +pkg getunix-cn pkgrm getunix-cn +true fix_xinetd_conf # ima i post-upgrade provjeru +#pkg uw-imapd-ssl-cn post_upgrade pkgrm uw-imapd-ssl +pkg lynx-ssl-cn post_upgrade pkgadd lynx-cn +pkg apache fix_mod_ssl_include +[ -f /etc/webalizer.conf ] fix_webalizer_conf +# 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 +getent group proc remove_group_proc # calls post_upgrade add_group_proc +pkg slapd backup_slapd_db +true backup_etc_dir # etc i drugo +true create_sources_list +true update # apt-get update & download +true check_disk_space +! debconf_priority check debconf_priority set # utisaj debconf +# konacno, instalacija novih paketa +true upgrade first # neki paketi moraju rucno +true upgrade second # neke pakete zelimo ranije +pkg freeradius-cn lt 2:1.0.1-2 install_freeradius # neki su totalno poremeceni # fix 2.1.4 +true dist_upgrade +true pkgadd apt-listchanges apt-listchanges-cn deborphan +# i ostatak +true debconf_priority reset +true add_group_proc # + restart oidentd ako treba +pkg raidtools2 fix_etc_default_raid2 +pkg proftpd fix_proftpd_conf # + restart ako treba +pkg aide-arms-client fix_aidexfer_conf +pkg sendmail-cn ge 2:8.13.1-2 fix_smtp_auth +pkg kernel-cn dpkg-reconfigure kernel-cn +pkg sys-mon-cn dpkg-reconfigure sys-mon-cn +pkg amavisd-cn dpkg-reconfigure amavisd-cn # vise ne treba? +#true post_upgrade_do_deborphan +# ovo bi trebalo biti predzadnje na popisu +# - izvrsi sve uvjetne post_upgrade akcije +true run_post_upgrade +true fix_issue +# i konacno, provjeri da li stvari rade +true check_services postupgrade diff --git a/usr/share/carnet-upgrade/actions/new.queue b/usr/share/carnet-upgrade/actions/new.queue new file mode 100644 index 0000000..1e948aa --- /dev/null +++ b/usr/share/carnet-upgrade/actions/new.queue @@ -0,0 +1,18 @@ +# last update: 2005-07-03 +# Ivan 'ico' Rako +# Zoran Dzelajlija +# +# samo ispravke dodane nakon 2.1-1, bez instalacije nove funckionalnosti +# uglavnom forsirani upgradei +# +pkg carnet-tools-cn lt 2.3.1 pkgadd carnet-tools-cn # 2.1.6 +pkg sendmail-cn ge 2:8.13.1-2 fix_smtp_auth +pkg ntp-cn lt 2:4.2.0a-11 pkgadd ntp-cn # 2.1.4 +pkg apt-cn lt 2.1.1 pkgadd apt-cn # 2.1.6 +pkg apt-cn ge 2.1.1 sarge_sources_list # 2.1.7 update +pkg freeradius ge 2:0 && [ `dpkg --print-architecture` = sparc ] && \ + ! pkg freeradius-cn install_freeradius # 2.1.7 +pkg php4-cn lt 4:4.3.11-1 pkgadd php4-cn # 2.1.6 update +pkg iptables-cn lt 2:1.2.11-3 pkgadd iptables-cn # 2.1.6 +pkg aide-arms-client lt 1.04-1 pkgadd aide-arms-client # 2.1.6 +pkg gnupg lt 1.4.1-1 pkgadd gnupg # 2.1.7 diff --git a/usr/share/carnet-upgrade/actions/post_upgrade.queue b/usr/share/carnet-upgrade/actions/post_upgrade.queue new file mode 100644 index 0000000..d99a71c --- /dev/null +++ b/usr/share/carnet-upgrade/actions/post_upgrade.queue @@ -0,0 +1,35 @@ +# last update: 2005-01-04 +# Ivan 'ico' Rako +# Zoran Dzelajlija +# +# samo akcije za nakon upgradea, moze se slobodno izvrsiti na bilo kojem sargeu. +# +# s obzirom da ne znamo koja verzija paketa je radila upgrade, i ovdje treba +# dodavati naknadne instalacije/upgrade paketa koje mozda nisu upgradeane sa +# 2.1-1, tj. nije ih bilo u packages_first popisu a dist-upgrade ih nije +# instalirao. To se mozda odnosi na ntp-cn, pa je za svaki slucaj dodan. + +pkg getunix pkgrm getunix # obsolete +pkg getunix-cn pkgrm getunix-cn +pkg freeradius-cn lt 2:1.0.1-2 install_freeradius # forsirane verzije # fix 2.1.4 +pkg carnet-tools-cn lt 2.3.1 pkgadd carnet-tools-cn # 2.1.6 +pkg ntp-cn lt 2:4.2.0a-11 pkgadd ntp-cn # 2.1.4 +pkg iptables-cn lt 2:1.2.11-3 pkgadd iptables-cn # 2.1.6 +true pkgadd apt-listchanges apt-listchanges-cn deborphan +# i ostatak +true debconf_priority reset +true add_group_proc # + restart oidentd ako treba +pkg raidtools2 fix_etc_default_raid2 +pkg proftpd fix_proftpd_conf # + restart ako treba +pkg aide-arms-client fix_aidexfer_conf +pkg sendmail-cn ge 2:8.13.1-2 fix_smtp_auth +pkg kernel-cn dpkg-reconfigure kernel-cn +pkg sys-mon-cn dpkg-reconfigure sys-mon-cn +pkg amavisd-cn dpkg-reconfigure amavisd-cn # vise ne treba? +#true post_upgrade_do_deborphan +# ovo bi trebalo biti predzadnje na popisu +# - izvrsi sve uvjetne post_upgrade akcije +true run_post_upgrade +true fix_issue +# i konacno, provjeri da li stvari rade +true check_services postupgrade diff --git a/usr/share/carnet-upgrade/actions/sarge.queue b/usr/share/carnet-upgrade/actions/sarge.queue new file mode 100644 index 0000000..449b80d --- /dev/null +++ b/usr/share/carnet-upgrade/actions/sarge.queue @@ -0,0 +1,32 @@ +# last update: 2005-06-30 +# Ivan 'ico' Rako +# Zoran Dzelajlija +# +# akcije za update sarge instalacije, slicno post_upgrade +# veci broj paketa koji se ne daju upgradeati s obicnim +# apt-get upgrade se forsirano upgradea +true check_services preupgrade # spremi stanje +pkg getunix pkgrm getunix # obsolete +pkg getunix-cn pkgrm getunix-cn +! debconf_priority check debconf_priority set # utisaj debconf +! pkg apt-cn pkgadd apt-cn # 2.1.6 +pkg apt-cn lt 2.1.1 pkgadd apt-cn # 2.1.6 +pkg apt-cn ge 2.1.1 sarge_sources_list # 2.1.7 update +pkg freeradius ge 2:0 && [ `dpkg --print-architecture` = sparc ] && \ + ! pkg freeradius-cn install_freeradius # 2.1.7 +pkg freeradius-cn lt 2:1.0.1-2 install_freeradius # forsirane verzije # fix 2.1.4 +pkg bind9-cn lt 2:9.2.3-2 pkgadd bind9-cn +pkg carnet-tools-cn lt 2.3.1 pkgadd carnet-tools-cn # 2.1.7 update +pkg php4-cn lt 4:4.3.11-1 pkgadd php4-cn # 2.1.6 update +pkg gcc-cn lt 2:3.3.3-1 pkgadd gcc-cn +pkg ntp-cn lt 2:4.2.0a-11 pkgadd ntp-cn # 2.1.4 +pkg iptables-cn lt 2:1.2.11-3 pkgadd iptables-cn # 2.1.6 +pkg aide-arms-client lt 1.04-1 pkgadd aide-arms-client # 2.1.6 +pkg gnupg lt 1.4.1-1 pkgadd gnupg # 2.1.7 +true pkgadd apt-listchanges apt-listchanges-cn deborphan # 2.1.4 +true debconf_priority reset # vrati debconf +pkg raidtools2 fix_etc_default_raid2 +pkg proftpd fix_proftpd_conf # + restart ako treba +pkg aide-arms-client fix_aidexfer_conf +pkg sendmail-cn ge 2:8.13.1-2 fix_smtp_auth +true check_services postupgrade # za svaki slucaj diff --git a/usr/share/carnet-upgrade/cn-upgrade b/usr/share/carnet-upgrade/cn-upgrade new file mode 100755 index 0000000..40aa767 --- /dev/null +++ b/usr/share/carnet-upgrade/cn-upgrade @@ -0,0 +1,83 @@ +#!/bin/sh +# last update: 2005-01-07 +# Zoran 'jelly' Dzelajlija +# Ivan 'ico' Rako +version="carnet-upgrade v2.1.4" + +set -e + +if [ "$DEBUG" ]; then + set -x + #ROOT=/home/jelly/work/src/carnet-upgrade + # make apt-get simulate-only for debug + s=s +else + ROOT="" +fi + +cnup="/usr/share/carnet-upgrade" + +. ${ROOT}${cnup}/messages.sh +. ${ROOT}${cnup}/functions.sh +. ${ROOT}${cnup}/data.sh + +main_queuetab="${cnup}/actions/main.queue" +post_upgrade_queuetab="/var/lib/carnet-upgrade/post_upgrade.queue" + +# logika kako slijedi: +# imamo popis testova i akcija koje ce se izvrsiti svakog testa +# ("queuetab" datoteka) +# +# akcije se izvrsavaju redoslijedom iz popisa +# +# neke akcije imaju dio koji se izvrsava prije i dio koji se izvrsava nakon +# upgradea, svaka takva akcija dodaje svoj post-upgrade dio akcije u +# zasebni red akcija, i onda se to izvrsava nakon upgradea na isti nacin +# kao glavni red akcija. + +# queuetab file format: +# test action +# +# eg. "pkg xinetd-cn lt 2:0 do_xinetd" means: +# if there is a version of xinetd-cn lower than 2:0 installed, +# invoke do_xinetd function +# generic tests: +# pkg tests if a package is installed, optional arguments like +# dpkg --compare-versions + +# Sanitize environment +umask 022 +cd / +LANG=C +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/carnet-upgrade/scripts +unset LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC || true +export PATH LANG cnup + +if [ -z "$1" ]; then + queuetab="$main_queuetab" + queuename="main" +elif [ -f "${cnup}/actions/$1.queue" ]; then + queuetab="${cnup}/actions/$1.queue" + queuename="$1" + shift +elif [ -f "$1" ]; then + queuetab="$1" + queuename="$1" + shift +elif [ "x$1" = "x-h" -o "x$1" = "x--help" ]; then + echo "$version" + echo "$usage" + exit 0 +else + echo "Nepoznati argumenti: $*" 1>&2 + echo "$usage" + exit 1 +fi + +# need this to get custom msg_finished for "sarge" run +export queuename + +# Do your worst +run_actions "$queuename" "$queuetab" + +exit 0 diff --git a/usr/share/carnet-upgrade/data.sh b/usr/share/carnet-upgrade/data.sh new file mode 100644 index 0000000..f063868 --- /dev/null +++ b/usr/share/carnet-upgrade/data.sh @@ -0,0 +1,76 @@ +# Minimum free space on /var after the download, in MB +min_var_space=250 + +# carnet-upgrade aborts if these packages are not up to date +# name wanted version +needed_woody_versions=' +amavisd-cn 20030616p10-2 +nessus-cn 2.0.7-1cn0 +bind9-cn 1:9.2.4-0cn1 +clamav-cn 0.80-2 +' + +# Packages to forcibly install before installing the rest with dist-upgrade, +# because dist-upgrade would rather remove them. +packages_first=' +dpkg +apt +php4-cn +apache-cn +squirrelmail-cn +amavisd-cn +amavisd-new +aide-arms-client +raidtools2 +openldap-cn +sweep-cn +' + +# Packages that provide crucial services, upgrade them before the rest +packages_second=' +bind9-cn +clamav-cn +mysql-cn +sendmail-cn +oidentd-cn +openssh-cn +postgresql-cn +proftpd-cn +spamassassin-cn +xinetd-cn +ntp-cn +' + +# We want to remove these packages, used in remove_bloat() +# nice name packages to remove +bloats=' +Abiword abiword-common +Emacs i XEmacs emacsen-common +Gimp gimp1.2 +Gnome gnome-common libgnome2-common libgnome32 +KDE kdelibs3 kdelibs4 kdebase-doc kdelibs3-doc kdevelop-doc +Wine libwine wine-doc +' +# php4-gd -> libgd1 -> xlibs -> xfree86-common -> suxx +#X Window System xfree86-common + +# Check if these services are running after upgrade +# package-cn user proces (pazi, regexp) nice name +services_to_check=' +amavisd-cn amavis amavisd \(master\) Amavis +amavisd-new-milter amavis /usr/sbin/amavis-milter Amavis-milter +apache-cn www-data /usr/sbin/apache Apache +bind9-cn bind /usr/sbin/named Bind +clamav-cn clamav /usr/sbin/clamd ClamAV +freeradius-cn freerad /usr/sbin/freeradius FreeRADIUS +mysql-cn mysql /usr/sbin/mysqld MySQL +sendmail-cn root sendmail: MTA: accepting connections Sendmail +openldap-cn root /usr/sbin/slapd OpenLDAP +oidentd-cn nobody /usr/sbin/oidentd oidentd +openssh-cn root /usr/sbin/sshd OpenSSH +postgresql-cn postgres /usr/lib/postgresql/bin/postmaster PostgreSQL +proftpd-cn nobody proftpd: \(accepting connections\) ProFTPD (mozda se pokrece iz (x)inetd-a) +spamassassin-cn root /usr/sbin/spamd SpamAssassin +xinetd-cn root /usr/sbin/xinetd xinetd +ntp-cn root /usr/sbin/ntpd ntpd +' diff --git a/usr/share/carnet-upgrade/functions.sh b/usr/share/carnet-upgrade/functions.sh new file mode 100644 index 0000000..4c89f36 --- /dev/null +++ b/usr/share/carnet-upgrade/functions.sh @@ -0,0 +1,528 @@ +# last update: 2005-07-03 +# Ivan 'ico' Rako +# Zoran 'jelly' Dzelajlija + +notice () { + dialog --backtitle "$title" --msgbox "$*" 18 75 +} + +first_warning () { + dialog --backtitle "$title" --yesno "$msg_first_warning" 18 75 +} + +pkg() { + local version + dpkg -l "$1" 2> /dev/null | egrep -q "^.i" || return 1 + [ -z "$2" ] && return 0 + version=$(dpkg -s "$1" | awk '/^Version:/ {print $2}') + dpkg --compare-versions "$version" "$2" "$3" 2>&1 > /dev/null +} + +log() { + logfile=${logfile:=/var/log/carnet-upgrade.log} + touch $logfile + echo "$(date +'%Y-%m-%d %H:%M:%S') $*" >> $logfile + echo "CN: $*" +} + +# find first free uid/gid in range +# find_id passwd 100 999 +find_id() { + local 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 + local s sedcmd ret i + s="$1" + shift + sedcmd="$1" + shift + ret=2 + for i in $* + do + [ -e "$i" ] || continue + egrep -q "$s" "$i" || continue + [ -h "$i" ] && i=$(readlink -f "$i") + sed "$sedcmd" "$i" > "$i.dpkg-tmp" + chown --reference "$i" "$i.dpkg-tmp" + chmod --reference "$i" "$i.dpkg-tmp" + mv "$i.dpkg-tmp" "$i" + ret=0 + done + if [ "$ret" -eq 0 ]; then + log "Done \"$sedcmd\" to $*" + fi + 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 $* ..." + apt-get -y$s install $* || { + dpkg --configure -a + apt-get -yf install + apt-get -y$s install $* + } +} + +pkgrm () { + [ -n "$*" ] || return 0 + log "Removing $* ..." + apt-get -y$s --purge remove $* || { + dpkg --configure -a + apt-get -yf install + apt-get -y$s --purge remove $* + } +} + +update() { + log "Running apt-get update ..." + apt-get -y$s update || { + apt-get -yf install + apt-get -y$s update + } + apt-get autoclean + apt-get -dy$s dist-upgrade +} + +dist_upgrade () { + log "Running dist-upgrade ..." + apt-get -y$s dist-upgrade || { + dpkg --configure -a + apt-get -y$s dist-upgrade + } +} + +remove_bloat() { + local to_remove add_this i j n text to_show cmd tmpfile installed + local update_selections pkgs_to_deselect oldifs + text="$msg_remove_bloat" + + [ "$DEBUG" ] && set -x + n=0 + for i in $(echo "$bloats" | sed 's/ */ /g'| awk -F' ' '{print $2}') + do + if pkg $i; then + installed="$installed $i" + add_this="$(echo "$bloats" | egrep " .*\b${i}\b" | sed 's/ */ /g'| awk -F' ' '{print $1}')" + if ! echo "$to_show" | grep -q "$add_this"; then + to_show="$to_show \"$add_this\" \"\" on" + n=$(($n+1)) + fi + fi + done + [ -z "$to_show" ] && return 0 + tmpfile=$(mktemp /var/lib/carnet-upgrade/dialog-tmp.XXXXXX) + cmd="dialog --nocancel --backtitle \""$title"\" --checklist \""$text"\" 20 75 $n $to_show" + [ "$DEBUG" ] && set +x + eval $cmd 2> $tmpfile + [ "$DEBUG" ] && set -x + to_remove="$(cat $tmpfile | sed 's/\"\ \"/ /g; s/\"\ *//g; s/\\//g')" + [ "$DEBUG" ] || rm -f $tmpfile + [ "$DEBUG" ] && echo "DEBUG: to_remove=$to_remove" 1>&2 + oldifs="$IFS" + IFS=" " # tab + for i in $(echo "$to_remove") + do + IFS="$oldifs" + for j in $(echo "$bloats" | grep "^$i" | sed 's/ */ /g'| awk -F' ' '{print $2}') + do + # hopefully this will tell apt not to reinstall them at upgrade time + update_selections="${update_selections} + $j deinstall" + pkgs_to_deselect="$pkgs_to_deselect $j" + # only remove those that really are installed + if echo "$installed" | grep -q "$j"; then + pkgs_to_remove="$pkgs_to_remove $j" + fi + done + done + [ "$DEBUG" ] && echo "DEBUG: pkgs_to_remove=$pkgs_to_remove" 1>&2 + # Finally, remove those + if [ -n "$update_selections" ]; then + echo "$update_selections" | dpkg --set-selections + log "Deselected:${pkgs_to_deselect}" + fi + eval pkgrm $pkgs_to_remove +} + +post_upgrade() { + touch "$post_upgrade_queuetab" + if ! grep -q "true $*" "$post_upgrade_queuetab"; then + echo "true $*" >> "$post_upgrade_queuetab" + fi +} + +run_post_upgrade() { + if [ -f "$post_upgrade_queuetab" ]; then + run_actions post_upgrade "$post_upgrade_queuetab" + mv "$post_upgrade_queuetab" "${post_upgrade_queuetab}.done.$(date '+%Y-%m-%d.%H:%M:%S')" + fi +} + +### + +run_actions() { + local line lineno lineno2 f n name action + [ "$DEBUG" ] && set -vx + name="$1" + f="$2" + [ -f "$f" ] || return 2 # no such file + n=$(wc -l "$f" | awk '{print $1}') + [ "$n" -lt 1 ] && return 1 # no lines to process + log "run_actions ($name) started, processing $n lines from \"$f\"." + log "-----" + lineno=0 + lineno2=0 + while [ "$lineno" -lt "$n" ] + do + lineno=$(($lineno+1)) + lineno2=$lineno + line=$(head -$lineno "$f" | tail -1) + if echo $line | grep -q '^#'; then # comment + continue + fi + while echo "$line" | egrep -q '\\$' # continuation + do + lineno2=$(($lineno2+1)) + line=$(echo -n "$line"| sed 's/\\$//'; head -$lineno2 "$f" | tail -1) + done + test=$(echo "$line" | sed 's/ */ /g'| awk -F' ' '{print $1}') + action=$(echo "$line" | sed 's/ */ /g'| awk -F' ' '{print $2}') + if eval $test; then + log "$(printf '%02d' $lineno) starting ${action}(), (test $test passed)" + eval $action + log "$(printf '%02d' $lineno) finished ${action}()" + else + log "$(printf '%02d' $lineno) skipping ${action}(), (test $test failed)" + fi + [ "$lineno2" -gt "$lineno" ] && lineno=$lineno2 + done + log "run_actions ($1) finished" + log "-----" +} + +# funkcija vraca popis paketa koje treba upgradeati +what_upgrade () { + local IFSOLD name version package + + for package in `echo "$needed_woody_versions" | awk '{print $1}'| grep -v ^$`; do + IFSOLD="$IFS" + IFS=" " # tab + read name version <<-EOPTS + $(echo "$needed_woody_versions" | sed 's/ */ /g' | grep ^$package) + EOPTS + IFS="$IFSOLD" + if pkg "$name" lt "$version"; then + echo -n " $name" + fi + done +} + +# funkcija za ispis paketa koje treba upgradeati +check_upgrade () { + local upgrade + upgrade="`what_upgrade`" + + if [ "$upgrade" ]; then + notice " +Prije prelaska na Debian Sarge potrebno je napraviti upgrade ovih paketa: + $upgrade + +Pokrenite: + 'apt-get dist-upgrade' +ili: + 'apt-get install${upgrade}' + +Nakon toga ponovno pozovite ovu skriptu." + log "carnet-upgrade aborted, upgrade of$upgrade needed." + exit 1 + fi +} + +upgrade () { + local to_install packages + case "$1" in + first) + packages="$packages_first" + ;; + second) + packages="$packages_second" + ;; + *) + return 1 + esac + + for i in $packages + do + pkg $i && to_install="$to_install $i" + done + + if [ -n "$to_install" ];then + eval pkgadd $to_install + else + return 0 + fi +} + +# funkcija utrpa ispravan sources.list +create_sources_list () { + [ -f /etc/apt/sources.list -a ! -f /etc/apt/sources.list.cn-upgrade ] && mv /etc/apt/sources.list /etc/apt/sources.list.cn-upgrade + cp /usr/share/carnet-upgrade/sources.list /etc/apt + notice "Novi sadrzaj datoteke /etc/apt/sources.list: + +`cat /etc/apt/sources.list`" +} + + +# funkcija koja brise grupu proc +remove_group_proc () { + if getent group proc > /dev/null; then + groupdel proc || true + log "groupdel proc (temporarily)" + post_upgrade add_group_proc + fi +} + +add_group_proc () { + if ! getent group proc > /dev/null; then + groupadd -g 99 proc + log "groupadd -g 99 proc" + if [ -x /etc/init.d/oidentd -a -f /etc/default/oidentd ] && \ + egrep -q 'OIDENT_GROUP.*proc' /etc/default/oidentd; then + /etc/init.d/oidentd restart || true + fi + fi +} + +# backup_slapd_db +backup_slapd_db () { + if [ ! -f /var/backups/slapcat.cn-upgrade ]; then + [ -x /etc/init.d/freeradius ] && /etc/init.d/freeradius stop || true + + if [ -x /etc/init.d/slapd -a -d /var/lib/ldap ]; then + /etc/init.d/slapd stop || true + if slapcat -l /var/backups/slapcat.cn-upgrade; then + log "/var/backups/slapcat.cn-upgrade created" + notice "Napravljen backup slapd baze u /var/backups/slapcat.cn-upgrade." + fi + /etc/init.d/slapd start || true + fi + + [ -x /etc/init.d/freeradius ] && /etc/init.d/freeradius start || true + else + log "slapd backup already at /var/backups/slapcat.cn-upgrade, skipping" + notice "Backup slapd baze u /var/backups/slapcat.cn-upgrade vec postoji!" + fi +} + +# backup etc direktorija +backup_etc_dir () { + if [ ! -f /var/backups/etc.tar.gz ]; then + if tar cfz /var/backups/etc.tar.gz /etc 2> /dev/null; then + log "/var/backups/etc.tar.gz created" + notice "Napravljen backup /etc direktorija u /var/backups/etc.tar.gz." + fi + else + log "/etc backup already present in /var/backups/etc.tar.gz, skipping." + notice "Backup /etc direktorija u /var/backups/etc.tar.gz vec postoji!" + 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.cn-upgrade.$$ + chown --reference=/etc/default/raid2 /etc/default/raid2.cn-upgrade.$$ + chmod --reference=/etc/default/raid2 /etc/default/raid2.cn-upgrade.$$ + + if ! cmp -s /etc/default/raid2.cn-upgrade.$$ /etc/default/raid2; then + log "Fixed /etc/default/raid2 AUTOSTART option." + mv /etc/default/raid2.cn-upgrade.$$ /etc/default/raid2 + else + rm /etc/default/raid2.cn-upgrade.$$ + fi + fi +} + +# instaliraj zadnji freeradius; uvjeti u queue fileovima +install_freeradius () { + pkgadd --force-yes freeradius-cn freeradius=1.0.5-0 freeradius-ldap=1.0.5-0 +} + +# tentatively remove obsolete option in xinetd.conf +fix_xinetd_conf () { + if [ -f /etc/xinetd.conf ]; then + check_and_sed 'log_on_failure.*RECORD' \ + 's/\(log_on_failure.*\)RECORD/\1/g' \ + /etc/xinetd.conf || true + fi +} + +# temporarily disable mod_ssl.conf in apache so that upgrade works +fix_mod_ssl_include() { + if [ -f /etc/apache/mod_ssl.conf ]; then + check_and_sed '^Include /etc/apache/mod_ssl\.conf' \ + 's,\(^Include[ ][ ]*/etc/apache/mod_ssl\.conf\),#\1,' \ + /etc/apache/httpd.conf || true + fi +} + +fix_proftpd_conf() { + if [ -f /etc/proftpd.conf ]; then + check_and_sed '^LsDefaultOptions' \ + 's,^LsDefaultOptions,ListOptions,' \ + /etc/proftpd.conf || true + fi + [ -x /etc/init.d/proftpd ] && /etc/init.d/proftpd restart || true +} + +# 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 +} + +fix_aidexfer_conf() { + if [ -f /etc/aide/aidexfer.conf ]; then + check_and_sed '/usr/local/lib/aidexfer' \ + 's,/usr/local/lib/aidexfer,/usr/share/aidexfer,' \ + /etc/aide/aidexfer.conf || true + fi +} + +fix_issue () { + cat > /etc/issue < /etc/issue.net < +# Ivan 'ico' Rako + +# Load debconf stuff +. /usr/share/debconf/confmodule + +# Load nase funkcije +. /usr/share/carnet-upgrade/functions.sh +. /usr/share/carnet-upgrade/messages.sh +. /usr/share/carnet-upgrade/data.sh + +# provjeri da li su paketi iz prvog polja instalirani i to strpaj u debconf +cs_preupgrade () { + local services i + + for i in $(echo "$services_to_check" | sed 's/ */ /g'| awk -F' ' '{print $1}') + do + if pkg $i; then + if ! echo $services | grep -q $i; then + services="$services $i" + fi + fi + done + + if [ -n "$services" ]; then + db_set cn-upgrade/check-services "$services" + db_go || true + fi +} + +# uzmi iz debconfa instalirane servise, i provjeri rade li +cs_postupgrade () { + local services i failed_services msg_header + + case "$queuename" in + sarge) msg_header="$msg_finished_sarge" + ;; + *) + msg_header="$msg_finished" + ;; + esac + + db_get cn-upgrade/check-services || true + services="$RET" + + for i in $(echo "$services"); do + user=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $2}') + psname=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $3}') + nicename=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $4}') + if ! pgrep -u $user -f "$psname" > /dev/null; then + if [ -z "$failed_services" ]; then + failed_services="$nicename" + else + failed_services="$failed_services, $nicename" + fi + fi + done + + if [ -n "$failed_services" ]; then + notice "$msg_header$msg_failed_services$failed_services" + else + notice "$msg_header" + fi +} + +# checkiraj da li je sto zapisano u debconf +cs_check () { + db_get cn-upgrade/check-services || true + debconf="$RET" + + if [ -n "$debconf" ]; then + exit 0 + else + exit 1 + fi +} + +case "$1" in +preupgrade) cs_preupgrade + ;; +postupgrade) cs_postupgrade + ;; +check) cs_check + ;; +*) echo "Usage: $0 (preupgrade|postupgrade|postupgrade-sarge|check)" + exit 1 + ;; +esac +exit 0 + diff --git a/usr/share/carnet-upgrade/scripts/debconf_priority b/usr/share/carnet-upgrade/scripts/debconf_priority new file mode 100755 index 0000000..028b445 --- /dev/null +++ b/usr/share/carnet-upgrade/scripts/debconf_priority @@ -0,0 +1,65 @@ +#!/bin/sh +# last update: 2004-12-19 +# Zoran 'jelly' Dzelajlija +# Ivan 'ico' Rako + + +# Load debconf stuff +. /usr/share/debconf/confmodule + +# setiraj debconf na high i spremi stari +debconf_priority_preupgrade () { + local old_debconf + + db_get debconf/priority || true + old_debconf="$RET" + + if [ -n "$old_debconf" ]; then + db_set cn-upgrade/debconf-priority "$old_debconf" + fi + + db_set debconf/priority high + db_go || true +} + + +# vrati debconf na staru vrijednost +debconf_priority_postupgrade () { + local new_debconf + + db_get cn-upgrade/debconf-priority || true + new_debconf="$RET" + + if [ -n "$new_debconf" ]; then + db_set debconf/priority "$new_debconf" + db_set cn-upgrade/debconf-priority "" + fi + + db_go || true +} + +# checkiraj +debconf_priority_check () { + db_get cn-upgrade/debconf-priority || true + debconf="$RET" + + if [ -n "$debconf" ]; then + exit 0 + else + exit 1 + fi +} + +case "$1" in +set) debconf_priority_preupgrade + ;; +reset) debconf_priority_postupgrade + ;; +check) debconf_priority_check + ;; +*) echo "Usage: $0 (set|reset|check)" + exit 1 + ;; +esac +exit 0 + diff --git a/usr/share/carnet-upgrade/sources.list b/usr/share/carnet-upgrade/sources.list new file mode 100644 index 0000000..df1cf57 --- /dev/null +++ b/usr/share/carnet-upgrade/sources.list @@ -0,0 +1,13 @@ +# See sources.list(5) for more information, especialy +# Remember that you can only use http, ftp or file URIs +# CDROMs are managed through the apt-cdrom tool. +deb http://ftp.carnet.hr/debian sarge main contrib non-free +deb http://ftp.carnet.hr/debian-non-US sarge/non-US main contrib non-free +deb http://security.debian.org sarge/updates main contrib non-free + +# CARNet Debian Linux v2 +deb http://ftp.carnet.hr/carnet-debian sarge main non-free + +# Uncomment if you want the apt-get source function to work +#deb-src http://ftp.carnet.hr/debian sarge main contrib non-free +#deb-src http://ftp.carnet.hr/debian-non-US sarge/non-US main contrib non-free diff --git a/usr/share/carnet-upgrade/tags b/usr/share/carnet-upgrade/tags new file mode 100644 index 0000000..7152d1b --- /dev/null +++ b/usr/share/carnet-upgrade/tags @@ -0,0 +1,47 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.7 // +add_group_proc functions.sh /^add_group_proc () {$/;" f +backup_etc_dir functions.sh /^backup_etc_dir () {$/;" f +backup_slapd_db functions.sh /^backup_slapd_db () {$/;" f +check_and_sed functions.sh /^check_and_sed() {$/;" f +check_and_update_ugid functions.sh /^check_and_update_ugid() {$/;" f +check_disk_space functions.sh /^check_disk_space() {$/;" f +check_upgrade functions.sh /^check_upgrade () {$/;" f +comment_force_overwrite functions.sh /^comment_force_overwrite () {$/;" f +create_sources_list functions.sh /^create_sources_list () {$/;" f +cs_check scripts/check_services /^cs_check () {$/;" f +cs_postupgrade scripts/check_services /^cs_postupgrade () {$/;" f +cs_preupgrade scripts/check_services /^cs_preupgrade () {$/;" f +debconf_priority_check scripts/debconf_priority /^debconf_priority_check () {$/;" f +debconf_priority_postupgrade scripts/debconf_priority /^debconf_priority_postupgrade () {$/;" f +debconf_priority_preupgrade scripts/debconf_priority /^debconf_priority_preupgrade () {$/;" f +dist_upgrade functions.sh /^dist_upgrade () {$/;" f +find_id functions.sh /^find_id() {$/;" f +first_warning functions.sh /^first_warning () {$/;" f +fix_aidexfer_conf functions.sh /^fix_aidexfer_conf() {$/;" f +fix_etc_default_raid2 functions.sh /^fix_etc_default_raid2 () {$/;" f +fix_issue functions.sh /^fix_issue () {$/;" f +fix_mod_ssl_include functions.sh /^fix_mod_ssl_include() {$/;" f +fix_proftpd_conf functions.sh /^fix_proftpd_conf() {$/;" f +fix_smtp_auth functions.sh /^fix_smtp_auth() {$/;" f +fix_webalizer_conf functions.sh /^fix_webalizer_conf () {$/;" f +fix_xinetd_conf functions.sh /^fix_xinetd_conf () {$/;" f +install_freeradius functions.sh /^install_freeradius () {$/;" f +log functions.sh /^log() {$/;" f +notice functions.sh /^notice () {$/;" f +pkg functions.sh /^pkg() {$/;" f +pkgadd functions.sh /^pkgadd () {$/;" f +pkgrm functions.sh /^pkgrm () {$/;" f +post_upgrade functions.sh /^post_upgrade() {$/;" f +remove_bloat functions.sh /^remove_bloat() {$/;" f +remove_group_proc functions.sh /^remove_group_proc () {$/;" f +run_actions functions.sh /^run_actions() {$/;" f +run_post_upgrade functions.sh /^run_post_upgrade() {$/;" f +sarge_sources_list functions.sh /^sarge_sources_list() {$/;" f +update functions.sh /^update() {$/;" f +upgrade functions.sh /^upgrade () {$/;" f +what_upgrade functions.sh /^what_upgrade () {$/;" f diff --git a/usr/share/doc/carnet-upgrade/NEWS.CARNet b/usr/share/doc/carnet-upgrade/NEWS.CARNet new file mode 100644 index 0000000..7d084a7 --- /dev/null +++ b/usr/share/doc/carnet-upgrade/NEWS.CARNet @@ -0,0 +1,14 @@ +carnet-upgrade (2.1.6) sarge; urgency=medium + + * Zbog izmjena na ftp posluzitelju, potrebno je izmijeniti + /etc/apt/sources.list datoteku s postavkama za apt. + Nakon sto zavrsi upgrade, pokrenite + + carnet-upgrade apt + + * Pored ove postoji jos nekoliko sitnih izmjena u CARNet Debian 2 + instalacijama. Mozete ih aktivirati sa + + carnet-upgrade sarge + + -- Zoran Dzelajlija Fri, 3 Jun 2005 14:26:10 +0200 diff --git a/usr/share/doc/carnet-upgrade/README.CARNet b/usr/share/doc/carnet-upgrade/README.CARNet new file mode 100644 index 0000000..abe294a --- /dev/null +++ b/usr/share/doc/carnet-upgrade/README.CARNet @@ -0,0 +1,19 @@ +carnet-upgrade + +Ovaj paket donosi skriptu za nadogradnju CARNetovih cvornih racunala sa +CARNet Debian 1.x na CARNet Debian 2.x i nadogradnju postavki na postojecim +CARNet Debian 2 instalacijama. + +Dokumentacija za upgrade sa CARNet Debian 1.x se nalazi u ovom direktoriju +pod nazivom carnet-upgrade.pdf. + +Paket su pripremili: + +Zoran Dzelajlija +Ivan 'ico' Rako + +Sve komentare, zelje i pozdrave, molimo uputite sluzbi pomoci sistem +inzinjerima. + + + -- Ivan 'ico' Rako Mon, 20 Dec 2004 20:12:29 +0100 diff --git a/usr/share/doc/carnet-upgrade/carnet-upgrade.pdf b/usr/share/doc/carnet-upgrade/carnet-upgrade.pdf new file mode 100644 index 0000000..0d72cad Binary files /dev/null and b/usr/share/doc/carnet-upgrade/carnet-upgrade.pdf differ diff --git a/usr/share/doc/carnet-upgrade/changelog.CARNet b/usr/share/doc/carnet-upgrade/changelog.CARNet new file mode 100644 index 0000000..0fd1a96 --- /dev/null +++ b/usr/share/doc/carnet-upgrade/changelog.CARNet @@ -0,0 +1,109 @@ +carnet-upgrade (2.1.8) woody sarge; urgency=low + + * Promjenjena verzija freeradiusa u 1.0.5-0 + + -- Ivan 'ico' Rako Wed, 28 Sep 2005 17:37:33 +0200 + +carnet-upgrade (2.1.7) woody sarge; urgency=low + + * Poziv apt-get update nakon postavljanja sources.list za sarge + (T#: 2005060813000012). + * Zamjena sources.list datoteke za sarge samo jednom. + * Provjera i nadogradnja gnupg za sarge. + * Typo u sarge ispravkama. + * Forsirani upgrade freeradius paketa na sparc platformi. + * U queue datotekama dodana mogucnost nastavka retka sa \. + + -- Zoran Dzelajlija Thu, 30 Jun 2005 17:12:40 +0200 + +carnet-upgrade (2.1.6) woody sarge; urgency=medium + + * Novi sources.list zbog izmjena na ftp serveru, dodan u + "new", "sarge" i novi "apt" argument. Za popraviti samo + sources.list koristiti "carnet-upgrade apt". + + * Forsiranje upgradea carnet-tools-cn i jos nekih paketa koji + inace ne prolaze bez dist-upgrade, u "sarge" i "new" argumentu. + + -- Zoran Dzelajlija Fri, 3 Jun 2005 14:26:10 +0200 + +carnet-upgrade (2.1.5) woody sarge; urgency=low + + * Popravljene dozvole nad doc/carnet-upgrade.pdf + * Ispravka u fix_smtp_auth() + + -- Ivan 'ico' Rako Wed, 13 Apr 2005 01:17:09 +0200 + +carnet-upgrade (2.1.4) woody sarge; urgency=low + + * Sprecavanje moguceg downgradea freeradiusa na sargeu. + * Dodana provjera i nadogradnja ntp-cn (woody i sarge). + * Instalacija apt-listchanges{,-cn} i za sarge. + * Dodan Usage, i drukcija zavrsna poruka za sarge. + * Pocisceni komentari u kodu. + + -- Zoran Dzelajlija Fri, 7 Jan 2005 15:03:46 +0100 + +carnet-upgrade (2.1-3) stable; urgency=low + + * Ispravke SMTP AUTH nakon upgradea. + * Novi nacini poziva skripte: + - samo ispravke dodane nakon proslog izdanja: + carnet-upgrade new + + - samo ispravke koje se izvrsavaju nakon nadogradnje, za + preskociti pocetak u slucaju pucanja skripte ili slicnog: + carnet-upgrade post_upgrade + + - ispravke primjerene za sarge instalaciju: + carnet-upgrade sarge + + "sarge" argument forsira nadogradnju bind9-cn, php4-cn, gcc-cn + i vezanih Debianovih paketa, ako je potrebno, jer za njih + apt-get upgrade nije dovoljan. + + -- Zoran Dzelajlija Mon, 3 Jan 2005 18:04:59 +0100 + +carnet-upgrade (2.1-2) stable; urgency=low + + * sweep-cn mora ici u prvom prolazu. + * remove_bloat() je ignorirao zadnji izabrani paket za brisanje. + * kozmetika, nakon izvrsenja run_post_upgrade() kriva akcija u logu. + + -- Zoran Dzelajlija Wed, 29 Dec 2004 19:06:15 +0100 + +carnet-upgrade (2.1-1) stable; urgency=low + + * sitne ispravke u main.queue i functions.sh. + * instalacija apt-listchanges, apt-listchanges-cn i deborphan paketa. + + -- Ivan 'ico' Rako Wed, 29 Dec 2004 12:43:37 +0100 + +carnet-upgrade (2.1-0.99) stable; urgency=low + + * Dokumentacija. + * apt-get autoclean prije downloada sarge paketa. + * kozmetika u main.queue i functions.sh. + + -- Zoran Dzelajlija Mon, 27 Dec 2004 19:55:10 +0100 + +carnet-upgrade (2.1-0.9) stable; urgency=low + + * ispravke u remove_bloat(). + * dokumentiran odabir non-default postavki. + + -- Zoran Dzelajlija Mon, 27 Dec 2004 00:00:00 +0100 + +carnet-upgrade (2.1-0.8) stable; urgency=low + + * pazi na sysmon-cn (inetd.conf). + * kozmetika u pkgadd() i pkgrm(). + * hrpa ispravki izmedju 2.1-0.1 i 2.1-0.7. + + -- Zoran Dzelajlija Thu, 23 Dec 2004 14:41:17 +0100 + +carnet-upgrade (2.1-0.1) stable; urgency=low + + * Prva razvojna verzija + + -- Ivan 'ico' Rako Mon, 20 Dec 2004 20:15:59 +0100