2020-03-23 15:12:07 +03:00
|
|
|
#!/bin/bash
|
|
|
|
# $1 -- folder name to pack;
|
|
|
|
|
|
|
|
version=$1
|
|
|
|
dir=${2-$PWD}
|
|
|
|
|
|
|
|
cd $dir
|
|
|
|
|
|
|
|
date=`date +"%Y-%m-%d %H:%M:%S"`
|
|
|
|
|
|
|
|
if [ ! -d "$version/install" ]; then
|
|
|
|
mkdir -p "./$version/install"
|
|
|
|
echo "Created a folder \"install\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$version/install/version.php" ]; then
|
|
|
|
touch "./$version/install/version.php"
|
|
|
|
echo "Created a file \"version.php\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<?
|
|
|
|
\$arModuleVersion = array(
|
|
|
|
\"VERSION\" => \"$version\",
|
|
|
|
\"VERSION_DATE\" => \"$date\"
|
|
|
|
);
|
|
|
|
" > "./$version/install/version.php"
|
|
|
|
echo "Update version and date in the file \"version.php\""
|
|
|
|
|
|
|
|
for i in `find ./"$version" -type f -name '*.*'`; do
|
|
|
|
encoding=`file -b --mime-encoding "$i"`
|
|
|
|
if [ "$encoding" != "iso-8859-1" ] && [ "$encoding" != "binary" ]; then
|
2020-05-04 14:56:20 +03:00
|
|
|
iconv -c -f $encoding -t "cp1251" $i >> $i.cp1251
|
2020-03-23 15:12:07 +03:00
|
|
|
mv $i.cp1251 $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "Encoding the file has changed"
|
|
|
|
|
|
|
|
tar -czf $version.tar.gz $version
|
|
|
|
echo "Update has been successfully packaged"
|