1
0
forked from pool/roundcubemail

Accepting request 260379 from home:Ledest:misc

fix bashisms in post scripts

OBS-URL: https://build.opensuse.org/request/show/260379
OBS-URL: https://build.opensuse.org/package/show/server:php:applications/roundcubemail?expand=0&rev=85
This commit is contained in:
Wolfgang Rosenauer 2014-11-09 09:43:05 +00:00 committed by Git OBS Bridge
parent 84010809a2
commit be162c243d
2 changed files with 23 additions and 37 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Nov 08 20:02:00 UTC 2014 - Led <ledest@gmail.com>
- fix bashisms in post scripts
-------------------------------------------------------------------
Mon Sep 29 17:23:39 UTC 2014 - aj@ajaissle.de

View File

@ -166,47 +166,36 @@ mkdir %{buildroot}%{roundcubepath}/migration
%pre
# backup logs, temp and config for migration
if [[ ! -h %{roundcubepath}/logs ]]; then
if [[ -d %{roundcubepath}/logs ]]; then
if [ ! -h %{roundcubepath}/logs ] && [ -d %{roundcubepath}/logs ]; then
mkdir -p %{roundcubepath}/migration
mv %{roundcubepath}/logs %{roundcubepath}/migration/.
fi
fi
if [[ ! -h %{roundcubepath}/temp ]]; then
if [[ -d %{roundcubepath}/temp ]]; then
if [ ! -h %{roundcubepath}/temp ] && [ -d %{roundcubepath}/temp ]; then
mkdir -p %{roundcubepath}/migration
mv %{roundcubepath}/temp %{roundcubepath}/migration/.
fi
fi
if [[ ! -h %{roundcubepath}/SQL ]]; then
if [[ -d %{roundcubepath}/SQL ]]; then
if [ ! -h %{roundcubepath}/SQL ] && [ -d %{roundcubepath}/SQL ]; then
mkdir -p %{roundcubepath}/migration
mv %{roundcubepath}/SQL %{roundcubepath}/migration/.
fi
fi
for PLUGIN in acl managesieve password; do
if [[ ! -h %{roundcubepath}/plugins/$PLUGIN/config.inc.php ]]; then
if [[ -f %{roundcubepath}/plugins/$PLUGIN/config.inc.php ]]; then
if [ ! -h %{roundcubepath}/plugins/$PLUGIN/config.inc.php ] && [ -f %{roundcubepath}/plugins/$PLUGIN/config.inc.php ]; then
mv %{roundcubepath}/plugins/$PLUGIN/config.inc.php %{roundcubepath}/migration/$PLUGIN.inc.php
fi
fi
done
%post
# replace default des string in config file for better security
function makedesstr () {
chars=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A
B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
max=${#chars[*]}
for i in `seq 1 24`; do
let rand=${RANDOM}%%${max}
str="${str}${chars[$rand]}"
done
echo $str
makedesstr() {
local chars="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
local max=${#chars}
for i in $(seq 1 24); do
echo "$chars" | dd bs=1 skip=$(($(od -An -d -N2 /dev/urandom) % $max)) count=1 2>/dev/null
done
echo
}
sed -i "s/rcmail-\!24ByteDESkey\*Str/`makedesstr`/" %{roundcubeconfigpath}/defaults.inc.php || : &> /dev/null
# enable apache required apache modules
@ -216,38 +205,30 @@ if [ -x /usr/sbin/a2enmod ]; then
fi
# restore backed up logs, temp and config
if [[ -h %{roundcubepath}/logs ]]; then
if [[ -d %{roundcubepath}/migration/logs ]]; then
if [ -h %{roundcubepath}/logs ] && [ -d %{roundcubepath}/migration/logs ]; then
mkdir -p %{roundcubepath}/migrated
cp %{roundcubepath}/migration/logs/* %{roundcubepath}/logs/.
mv %{roundcubepath}/migration/logs %{roundcubepath}/migrated/.
fi
fi
if [[ -h %{roundcubepath}/temp ]]; then
if [[ -d %{roundcubepath}/migration/temp ]]; then
if [ -h %{roundcubepath}/temp ] && [ -d %{roundcubepath}/migration/temp ]; then
mkdir -p %{roundcubepath}/migrated
cp %{roundcubepath}/migration/temp/* %{roundcubepath}/temp/.
mv %{roundcubepath}/migration/temp %{roundcubepath}/migrated/.
fi
fi
if [[ -h %{roundcubepath}/SQL ]]; then
if [[ -d %{roundcubepath}/migration/SQL ]]; then
if [ -h %{roundcubepath}/SQL ] && [ -d %{roundcubepath}/migration/SQL ]; then
rm -r %{roundcubepath}/migration/SQL
fi
fi
for PLUGIN in acl managesieve password; do
if [[ -f %{roundcubepath}/migration/$PLUGIN.inc.php ]]; then
if [[ -h %{roundcubepath}/plugins/$PLUGIN/config.inc.php ]]; then
if [ -f %{roundcubepath}/migration/$PLUGIN.inc.php ] && [ -h %{roundcubepath}/plugins/$PLUGIN/config.inc.php ]; then
cp %{roundcubepath}/migration/$PLUGIN.inc.php %{roundcubeconfigpath}/.
mv %{roundcubepath}/migration/$PLUGIN.inc.php %{roundcubepath}/migrated/$PLUGIN.inc.php
fi
fi
done
for MIGDIR in migration migrated; do
if [[ -d %{roundcubepath}/$MIGDIR ]]; then
if [ -d %{roundcubepath}/$MIGDIR ]; then
find %{roundcubepath}/$MIGDIR -empty -delete
fi
if [[ -d %{roundcubepath}/$MIGDIR ]]; then
if [ -d %{roundcubepath}/$MIGDIR ]; then
echo "Found %{roundcubepath}/$MIGDIR! Make sure you delete this folder after checking the migration!"
fi
done