w.c.s : ajout d'un champ wcs_comments lors de l'extraction.
[progfou.git] / sysadmin / upgrade.sh
... / ...
CommitLineData
1#!/bin/sh
2# upgrade.sh - outil de mise à jour de serveur, avec support OpenVZ
3# Copyright ©2010 Agence universitaire de la Francophonie
4# http://www.auf.org/
5# Licence : GNU General Public License, version 3
6# Auteur : Progfou <jean-christophe.andre@auf.org>
7# Création : 2010-01-26
8# Mise à jour : 2010-01-26
9export LANG=
10CONFDIRS="/etc"
11IPT="iptables"
12IP6T="ip6tables"
13IF="`route -n | awk '/^0.0.0.0/{print $(NF);exit}'`"
14$IPT -I OUTPUT -o "$IF" -m owner --uid-owner 0 -p tcp --dport 80 -j ACCEPT
15$IP6T -I OUTPUT -o "$IF" -m owner --uid-owner 0 -p tcp --dport 80 -j ACCEPT
16aptitude update
17aptitude safe-upgrade
18aptitude clean
19$IP6T -D OUTPUT -o "$IF" -m owner --uid-owner 0 -p tcp --dport 80 -j ACCEPT
20$IPT -D OUTPUT -o "$IF" -m owner --uid-owner 0 -p tcp --dport 80 -j ACCEPT
21if test -x /usr/sbin/vzctl
22then
23 $IPT -I FORWARD -o "$IF" -p tcp --dport 80 -j ACCEPT
24 $IP6T -I FORWARD -o "$IF" -p tcp --dport 80 -j ACCEPT
25 shopt -s nullglob
26 for id in `vzlist -H -o ctid`
27 do
28 #vzctl exec $id rm -v -f /var/lib/apt/lists/partial/*
29 vzctl exec $id aptitude update
30 vzctl exec $id aptitude safe-upgrade </dev/tty >/dev/tty
31 vzctl exec $id aptitude clean
32 done
33 $IP6T -D FORWARD -o "$IF" -p tcp --dport 80 -j ACCEPT
34 $IPT -D FORWARD -o "$IF" -p tcp --dport 80 -j ACCEPT
35 CONFDIRS="$CONFDIRS "/vz/private/*/etc
36fi
37find $CONFDIRS -name "*.dpkg*" -o -name "*.ucf*"