1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00
piwigo_ynh/sources/tools/pwg_rel_create.sh

125 lines
3.4 KiB
Bash
Raw Normal View History

2014-07-06 13:21:10 +02:00
#!/bin/bash
2016-08-27 21:53:29 +02:00
scriptdir=$(dirname $(readlink -e $0))
2014-07-06 13:21:10 +02:00
# +--------------------------------------------------------------------------+
# | pwg_rel_create.sh |
# +--------------------------------------------------------------------------+
# | author : Pierrick LE GALL <http://le-gall.net/pierrick> |
# | project : Piwigo |
# +--------------------------------------------------------------------------+
2016-08-27 21:53:29 +02:00
if [ $# -lt 1 ]
2014-07-06 13:21:10 +02:00
then
echo
2016-08-27 21:53:29 +02:00
echo 'usage : '$(basename $0)' <version number> [<sha>]'
2014-07-06 13:21:10 +02:00
echo
exit 1
fi
2016-08-27 21:53:29 +02:00
version=$1
sha=$2
2014-07-06 13:21:10 +02:00
name=piwigo-$version
cd /tmp
if [ -e $version ]
then
rm -rf $version
fi
mkdir $version
cd $version
2016-08-27 21:53:29 +02:00
git clone https://github.com/Piwigo/Piwigo.git piwigo
cd piwigo
if [ $# -eq 2 ]
then
git checkout $2
fi
# remove Git metadata
rm -rf /tmp/$version/piwigo/.git
# +--------------------------------------------------------------------------+
# | plugins |
# +--------------------------------------------------------------------------+
cd plugins
for plugin in TakeATour AdminTools LocalFilesEditor LanguageSwitch
do
cd /tmp/$version/piwigo/plugins
plugin_dir=$plugin
if [ $plugin = "LanguageSwitch" ]
then
plugin_dir=language_switch
fi
2014-07-06 13:21:10 +02:00
2016-08-27 21:53:29 +02:00
# clone repo
git clone https://github.com/Piwigo/${plugin}.git $plugin_dir
cd /tmp/$version/piwigo/plugins/$plugin_dir
2014-07-06 13:21:10 +02:00
2016-08-27 21:53:29 +02:00
# change version
perl $scriptdir/replace_version.pl --file=main.inc.php --version=$version
# register metadata in dedicated file
echo https://github.com/Piwigo/${plugin}.git > pem_metadata.txt
git log -n 1 --pretty=format:"%H %ad" --date=iso8601 >> pem_metadata.txt
# remove Git metadata
rm -rf .git
done
# +--------------------------------------------------------------------------+
# | themes |
# +--------------------------------------------------------------------------+
cd /tmp/$version/piwigo/themes
for themefile in $(ls */themeconf.inc.php)
do
# change version
perl $scriptdir/replace_version.pl --file=$themefile --version=$version
done
# +--------------------------------------------------------------------------+
# | languages |
# +--------------------------------------------------------------------------+
cd /tmp/$version/piwigo/language
for languagefile in $(ls */common.lang.php)
do
# change version
perl $scriptdir/replace_version.pl --file=$languagefile --version=$version
done
# +--------------------------------------------------------------------------+
# | data directories + zip 1 |
# +--------------------------------------------------------------------------+
# create "data" directories
cd /tmp/$version
mkdir piwigo/upload
2014-07-06 13:21:10 +02:00
mkdir piwigo/_data
touch piwigo/_data/dummy.txt
2016-08-27 21:53:29 +02:00
zip -q -r $name-nochmod.zip piwigo
2014-07-06 13:21:10 +02:00
2016-08-27 21:53:29 +02:00
# +--------------------------------------------------------------------------+
# | permissions + zip 2 |
# +--------------------------------------------------------------------------+
2014-07-06 13:21:10 +02:00
chmod -R a+w piwigo/local
chmod a+w piwigo/_data
chmod a+w piwigo/upload
2016-08-27 21:53:29 +02:00
chmod a+w piwigo/plugins
chmod a+w piwigo/themes
2014-07-06 13:21:10 +02:00
2016-08-27 21:53:29 +02:00
zip -q -r $name.zip piwigo
2014-07-06 13:21:10 +02:00
echo cd /tmp/$version