ScoDocMM/config/distrib.sh

98 lines
2.0 KiB
Bash
Raw Normal View History

2020-09-26 16:19:37 +02:00
#!/bin/bash
# Pense bete pour tout nettoyer avant de faire une distribution...
#
#
# E. Viennet, jul 2008
source config.sh
source utils.sh
if [ "$UID" != "0" ]
then
echo "Erreur: le script $0 doit etre lance par root"
exit 1
fi
echo "Changing to directory " $SCODOC_DIR/config
cd $SCODOC_DIR/config
echo "Stopping ScoDoc..."
2020-12-05 17:29:26 +01:00
scodocctl stop
2020-09-26 16:19:37 +02:00
# DROITS
echo -n "Verification des droits: proprietaire www-data ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
echo 'changing owner to www-data'
chown -R www-data.www-data ..
fi
echo -n 'Suppression des backups des sources (*~) ? (y/n) [y] '
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
/bin/rm -f ../*~ ../*/*~
fi
# SVN
echo -n "svn update ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
echo 'Updating from SVN...'
(cd ..; svn update)
fi
# DEPARTEMENTS (maintenant inutile car dans /var)
echo -n "Supprimer les (anciennes) configs de departements ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
echo "moving " depts/*.cfg "to /tmp"
mv depts/*.cfg /tmp
fi
# .../var/
echo -n "Supprimer et recréer .../var (archives, photos, configs, ...) ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
echo "moving ../../../var/scodoc to /tmp"
mv ../../../var/scodoc /tmp
mkdir -p ../../../var/scodoc/config/depts
mkdir ../../../var/scodoc/photos
mkdir ../../../var/scodoc/tmp
mkdir ../../../var/scodoc/archives
chown -R www-data.www-data ../../../var/scodoc/
fi
# LOGS ZOPE
echo -n "Effacer les logs de Zope et ScoDoc ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
(cd ../../../log/; ./purge)
fi
# IMAGE Data.fs
echo -n "Recopier le Data.fs original ? (y/n) [y] "
read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
echo "moving Data.fs to /tmp"
mv ../../../var/Data.fs ../../../var/Data.fs.index /tmp
DATAFS=../../../var/Data.fs.ok-to-distrib-545
echo "copying $DATAFS to Data.fs"
cp -p $DATAFS ../../../var/Data.fs
fi
#
echo
echo "OK, vous pouvez archiver la distribution !"
echo