Browse Source

Refractor build script (#3)

tags/v0.14.0
fbartels 7 months ago
parent
commit
31ead44714
80 changed files with 76 additions and 130 deletions
  1. 1
    0
      .gitignore
  2. 0
    0
      APP/application.cfg
  3. 0
    0
      APP/bin/pdfinfo
  4. 0
    0
      APP/config
  5. 0
    0
      APP/css/synocr_1.0.0.css
  6. 0
    0
      APP/edit.sh
  7. 0
    0
      APP/etc/Konfiguration.txt
  8. 0
    0
      APP/footer.sh
  9. 0
    0
      APP/help.sh
  10. 0
    0
      APP/images/calendar_delete@geimist.svg
  11. 0
    0
      APP/images/calendar_grey3@geimist.svg
  12. 0
    0
      APP/images/calendar_new@geimist.svg
  13. 0
    0
      APP/images/calendar_white@geimist.svg
  14. 0
    0
      APP/images/checkbox_checked@geimist.svg
  15. 0
    0
      APP/images/checkbox_disable@geimist.svg
  16. 0
    0
      APP/images/checkbox_unchecked@geimist.svg
  17. 0
    0
      APP/images/fieldset_expand1@geimist.svg
  18. 0
    0
      APP/images/fieldset_expand2@geimist.svg
  19. 0
    0
      APP/images/help_grey3@geimist.svg
  20. 0
    0
      APP/images/help_white@geimist.svg
  21. 0
    0
      APP/images/home_grey3@geimist.svg
  22. 0
    0
      APP/images/home_white@geimist.svg
  23. 0
    0
      APP/images/icon_information_mini@geimist.svg
  24. 0
    0
      APP/images/sanduhr_blue@geimist.svg
  25. 0
    0
      APP/images/settings_grey3@geimist.svg
  26. 0
    0
      APP/images/settings_white@geimist.svg
  27. 0
    0
      APP/images/status_green@geimist.svg
  28. 0
    0
      APP/images/status_grey3@geimist.svg
  29. 0
    0
      APP/images/status_loading.gif
  30. 0
    0
      APP/images/status_white@geimist.svg
  31. 0
    0
      APP/images/synOCR-LOGO.svg
  32. 0
    0
      APP/images/synOCR_120.png
  33. 0
    0
      APP/images/synOCR_128.png
  34. 0
    0
      APP/images/synOCR_16.png
  35. 0
    0
      APP/images/synOCR_24.png
  36. 0
    0
      APP/images/synOCR_256.png
  37. 0
    0
      APP/images/synOCR_32.png
  38. 0
    0
      APP/images/synOCR_48.png
  39. 0
    0
      APP/images/synOCR_512.png
  40. 0
    0
      APP/images/synOCR_64.png
  41. 0
    0
      APP/images/synOCR_72.png
  42. 0
    0
      APP/images/synOCR_90.png
  43. 0
    0
      APP/includes/check_privilege.inc.php
  44. 0
    0
      APP/includes/decode.sed
  45. 0
    0
      APP/includes/encode.sed
  46. 0
    0
      APP/includes/token.php
  47. 0
    0
      APP/index.cgi
  48. 0
    0
      APP/main.sh
  49. 0
    0
      APP/status.sh
  50. 0
    0
      APP/synOCR-start.sh
  51. 0
    0
      APP/synOCR.sh
  52. 0
    0
      APP/timer.sh
  53. 0
    0
      APP/upgradeconfig.sh
  54. 0
    0
      APP/usersettings/Konfiguration_org.txt
  55. 0
    0
      PKG/CHANGELOG
  56. 0
    0
      PKG/INFO
  57. 0
    0
      PKG/LICENSE
  58. 0
    0
      PKG/PACKAGE_ICON.PNG
  59. 0
    0
      PKG/PACKAGE_ICON_120.PNG
  60. 0
    0
      PKG/PACKAGE_ICON_256.PNG
  61. 0
    0
      PKG/WIZARD_UIFILES/uninstall_uifile
  62. 0
    0
      PKG/WIZARD_UIFILES/uninstall_uifile_enu
  63. 0
    0
      PKG/WIZARD_UIFILES/uninstall_uifile_ger
  64. 0
    0
      PKG/WIZARD_UIFILES/upgrade_uifile
  65. 0
    0
      PKG/WIZARD_UIFILES/upgrade_uifile_enu
  66. 0
    0
      PKG/WIZARD_UIFILES/upgrade_uifile_ger
  67. 0
    0
      PKG/scripts/backup/export
  68. 0
    0
      PKG/scripts/backup/import
  69. 0
    0
      PKG/scripts/backup/version
  70. 0
    0
      PKG/scripts/lang/enu
  71. 0
    0
      PKG/scripts/lang/ger
  72. 0
    0
      PKG/scripts/postinst
  73. 0
    0
      PKG/scripts/postuninst
  74. 0
    0
      PKG/scripts/postupgrade
  75. 0
    0
      PKG/scripts/preinst
  76. 0
    0
      PKG/scripts/preuninst
  77. 0
    0
      PKG/scripts/preupgrade
  78. 0
    0
      PKG/scripts/start-stop-status
  79. 70
    126
      build_spk.sh
  80. 5
    4
      translation_instruction.md

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
*.spk

Build/application.cfg → APP/application.cfg View File


Build/bin/pdfinfo → APP/bin/pdfinfo View File


Build/config → APP/config View File


Build/css/synocr_1.0.0.css → APP/css/synocr_1.0.0.css View File


Build/edit.sh → APP/edit.sh View File


Build/etc/Konfiguration.txt → APP/etc/Konfiguration.txt View File


Build/footer.sh → APP/footer.sh View File


Build/help.sh → APP/help.sh View File


Build/images/calendar_delete@geimist.svg → APP/images/calendar_delete@geimist.svg View File


Build/images/calendar_grey3@geimist.svg → APP/images/calendar_grey3@geimist.svg View File


Build/images/calendar_new@geimist.svg → APP/images/calendar_new@geimist.svg View File


Build/images/calendar_white@geimist.svg → APP/images/calendar_white@geimist.svg View File


Build/images/checkbox_checked@geimist.svg → APP/images/checkbox_checked@geimist.svg View File


Build/images/checkbox_disable@geimist.svg → APP/images/checkbox_disable@geimist.svg View File


Build/images/checkbox_unchecked@geimist.svg → APP/images/checkbox_unchecked@geimist.svg View File


Build/images/fieldset_expand1@geimist.svg → APP/images/fieldset_expand1@geimist.svg View File


Build/images/fieldset_expand2@geimist.svg → APP/images/fieldset_expand2@geimist.svg View File


Build/images/help_grey3@geimist.svg → APP/images/help_grey3@geimist.svg View File


Build/images/help_white@geimist.svg → APP/images/help_white@geimist.svg View File


Build/images/home_grey3@geimist.svg → APP/images/home_grey3@geimist.svg View File


Build/images/home_white@geimist.svg → APP/images/home_white@geimist.svg View File


Build/images/icon_information_mini@geimist.svg → APP/images/icon_information_mini@geimist.svg View File


Build/images/sanduhr_blue@geimist.svg → APP/images/sanduhr_blue@geimist.svg View File


Build/images/settings_grey3@geimist.svg → APP/images/settings_grey3@geimist.svg View File


Build/images/settings_white@geimist.svg → APP/images/settings_white@geimist.svg View File


Build/images/status_green@geimist.svg → APP/images/status_green@geimist.svg View File


Build/images/status_grey3@geimist.svg → APP/images/status_grey3@geimist.svg View File


Build/images/status_loading.gif → APP/images/status_loading.gif View File


Build/images/status_white@geimist.svg → APP/images/status_white@geimist.svg View File


Build/images/synOCR-LOGO.svg → APP/images/synOCR-LOGO.svg View File


Build/images/synOCR_120.png → APP/images/synOCR_120.png View File


Build/images/synOCR_128.png → APP/images/synOCR_128.png View File


Build/images/synOCR_16.png → APP/images/synOCR_16.png View File


Build/images/synOCR_24.png → APP/images/synOCR_24.png View File


Build/images/synOCR_256.png → APP/images/synOCR_256.png View File


Build/images/synOCR_32.png → APP/images/synOCR_32.png View File


Build/images/synOCR_48.png → APP/images/synOCR_48.png View File


Build/images/synOCR_512.png → APP/images/synOCR_512.png View File


Build/images/synOCR_64.png → APP/images/synOCR_64.png View File


Build/images/synOCR_72.png → APP/images/synOCR_72.png View File


Build/images/synOCR_90.png → APP/images/synOCR_90.png View File


Build/includes/check_privilege.inc.php → APP/includes/check_privilege.inc.php View File


Build/includes/decode.sed → APP/includes/decode.sed View File


Build/includes/encode.sed → APP/includes/encode.sed View File


Build/includes/token.php → APP/includes/token.php View File


Build/index.cgi → APP/index.cgi View File


Build/main.sh → APP/main.sh View File


Build/status.sh → APP/status.sh View File


Build/synOCR-start.sh → APP/synOCR-start.sh View File


Build/synOCR.sh → APP/synOCR.sh View File


Build/timer.sh → APP/timer.sh View File


Build/upgradeconfig.sh → APP/upgradeconfig.sh View File


Build/usersettings/Konfiguration_org.txt → APP/usersettings/Konfiguration_org.txt View File


Pack/CHANGELOG → PKG/CHANGELOG View File


Pack/INFO → PKG/INFO View File


Pack/LICENSE → PKG/LICENSE View File


Pack/PACKAGE_ICON.PNG → PKG/PACKAGE_ICON.PNG View File


Pack/PACKAGE_ICON_120.PNG → PKG/PACKAGE_ICON_120.PNG View File


Pack/PACKAGE_ICON_256.PNG → PKG/PACKAGE_ICON_256.PNG View File


Pack/WIZARD_UIFILES/uninstall_uifile → PKG/WIZARD_UIFILES/uninstall_uifile View File


Pack/WIZARD_UIFILES/uninstall_uifile_enu → PKG/WIZARD_UIFILES/uninstall_uifile_enu View File


Pack/WIZARD_UIFILES/uninstall_uifile_ger → PKG/WIZARD_UIFILES/uninstall_uifile_ger View File


Pack/WIZARD_UIFILES/upgrade_uifile → PKG/WIZARD_UIFILES/upgrade_uifile View File


Pack/WIZARD_UIFILES/upgrade_uifile_enu → PKG/WIZARD_UIFILES/upgrade_uifile_enu View File


Pack/WIZARD_UIFILES/upgrade_uifile_ger → PKG/WIZARD_UIFILES/upgrade_uifile_ger View File


Pack/scripts/backup/export → PKG/scripts/backup/export View File


Pack/scripts/backup/import → PKG/scripts/backup/import View File


Pack/scripts/backup/version → PKG/scripts/backup/version View File


Pack/scripts/lang/enu → PKG/scripts/lang/enu View File


Pack/scripts/lang/ger → PKG/scripts/lang/ger View File


Pack/scripts/postinst → PKG/scripts/postinst View File


Pack/scripts/postuninst → PKG/scripts/postuninst View File


Pack/scripts/postupgrade → PKG/scripts/postupgrade View File


Pack/scripts/preinst → PKG/scripts/preinst View File


Pack/scripts/preuninst → PKG/scripts/preuninst View File


Pack/scripts/preupgrade → PKG/scripts/preupgrade View File


Pack/scripts/start-stop-status → PKG/scripts/start-stop-status View File


+ 70
- 126
build_spk.sh View File

@@ -3,7 +3,7 @@
# Scriptaufruf:
#----------------------------------------------------------------------------------------
# erstellt das SPK aus dem aktuellen master-branch vom Server:
# sh ./build_spk.sh
# sh ./build_spk.sh
#
# erstellt das SPK aus dem als Parameter übergebenen Release vom Server:
# sh ./build_spk.sh 4.0.7
@@ -11,164 +11,108 @@
#----------------------------------------------------------------------------------------
# Ordnerstruktur:
#----------------------------------------------------------------------------------------
# ./[NAME-DES-SPK]/Build --> Arbeitsumgebung (erstellen/editieren/verschieben)
# ./[NAME-DES-SPK]/Pack --> Archivordner zum Aufbau des SPK (Startscripte etc.)
# ./APP --> Arbeitsumgebung (erstellen/editieren/verschieben)
# ./PKG --> Archivordner zum Aufbau des SPK (Startscripte etc.)
#

project="synOCR"

skriptuser=`whoami`
if [ ${skriptuser} != "root" ]; then
echo "Dieses Skript muss von Root ausgeführt werden!"
exit 1
fi
set -euo pipefail
IFS=$'\n\t'

# Arbeitsverzeichnis auslesen und hineinwechseln:
# ---------------------------------------------------------------------
APPDIR=$(cd $(dirname $0);pwd)
cd ${APPDIR}
function finish {
git worktree remove --force "$build_tmp"
rm -rf "$build_tmp"
}
trap finish EXIT

build_tmp="${APPDIR}/build_tmp"
dir=${APPDIR}
buildversion=$1
#######

project="synOCR"

#######

if ! [ -x "$(command -v git)" ]; then
echo 'Error: git is not installed.' >&2
exit 1
fi

# ACHTUNG: derzeit wird ein bestehendes Projektverzeichnis gelöscht und mit dem Serververzeichnis ersetzt!
if [ -d "./${project}" ] ; then
rm -rf "./${project}"
fi
if ! [ -x "$(command -v fakeroot)" ]; then
echo 'WARNING: fakeroot is not installed.' >&2
FAKEROOT=$(command -v fakeroot)
else
FAKEROOT=""
fi

# Arbeitsverzeichnis auslesen und hineinwechseln:
# ---------------------------------------------------------------------
# shellcheck disable=SC2086
APPDIR=$(cd "$(dirname $0)";pwd)
cd "${APPDIR}"

build_tmp=$(mktemp -d -t tmp.XXXXXXXXXX)
buildversion=${1:-latest}
taggedversions=$(git tag)

echo " - INFO: Erstelle den temporären Buildordner und kopiere Sourcen hinein ..."

gitpull()
{
#########################################################################################
# Diese Funktion gleicht die Projektdaten mit dem Server ab #
#########################################################################################
git worktree add --force "$build_tmp" "$(git rev-parse --abbrev-ref HEAD)"
pushd "$build_tmp"
set_spk_version="latest-$(date +%s)-$(git log -1 --format="%h")"

gitpath=`which git`
if [ -z ${gitpath} ]; then
echo "Es wurde keine GIT-Installation gefunden!"
exit 1
if echo "$taggedversions" | egrep -q "$buildversion"; then
echo "git checkout zu $buildversion"
git checkout "$buildversion"
set_spk_version="$buildversion"
else
echo "ACHTUNG: Die gewünschte Version wurde im Repository nicht gefunden!"
echo "Die $(git rev-parse --abbrev-ref HEAD)-branch wird verwendet!"
fi

# Ausführung: Erstellen des SPK
echo ""
echo "-----------------------------------------------------------------------------------"
echo " git holt die aktuelle Version ..."
echo "-----------------------------------------------------------------------------------"

if [ -d "./${project}" ] ; then
cd ${project}
git pull
versions=`git tag`
cd ${APPDIR}
# fallback to old app dir
if [ -d "$build_tmp"/Build ]; then
APP=Build
else
git clone https://geimist.eu:30443/geimist/${project}.git
cd ${project}
git pull
versions=`git tag`
cd ${APPDIR}
APP=APP
fi


#build_version=`cat "${APPDIR}/${project}/Pack/INFO" | grep version | awk -F '"' '{print $2}'`

# welche Version soll gebaut werden:
if [ -z $buildversion ]; then
echo "git checkout zu master-branch"
cd ${project}
git checkout master
cd ${APPDIR}
set_spk_version="latest_(`date +%Y`-`date +%m`-`date +%d`_`date +%H`-`date +%M`)"
# fallback to old pkg dir
if [ -d "$build_tmp"/Pack ]; then
PKG=Pack
else
if echo "$versions" | egrep -q "$buildversion"; then
echo "git checkout zu $buildversion"
cd ${project}
git checkout "$buildversion"
set_spk_version="$buildversion"
cd ${APPDIR}
else
echo "ACHTUNG: Die gewünschte Version wurde im Repository nicht gefunden!"
echo "Der master-branch wird verwendet!"
cd ${project}
git checkout master
cd ${APPDIR}
set_spk_version="latest_(`date +%Y`-`date +%m`-`date +%d`_`date +%H`-`date +%M`)"
fi
PKG=PKG
fi
}

gitpull

build_version=`cat "${APPDIR}/${project}/Pack/INFO" | grep version | awk -F '"' '{print $2}'`
# set_spk_version=$build_version
build_version=$(grep version "$build_tmp/$PKG/INFO" | awk -F '"' '{print $2}')
#set_spk_version=$build_version

echo " - INFO: Es wird foldende Version geladen und gebaut: $set_spk_version - BUILD-Version (INFO-File): $build_version"

echo " - INFO: Erstelle den temporären Buildordner und kopiere Sourcen hinein ..."
if [ -d "./build_tmp" ] ; then
rm -rf "./build_tmp"
fi
mkdir "${build_tmp}"

cp -r "${APPDIR}/${project}"/* "${build_tmp}/"

# Ausführung: Erstellen des SPK
echo ""
echo "-----------------------------------------------------------------------------------"
echo " SPK wird erstellt..."
echo "-----------------------------------------------------------------------------------"
echo ""
echo "-----------------------------------------------------------------------------------"
echo " SPK wird erstellt..."
echo "-----------------------------------------------------------------------------------"

# Falls versteckter Ordners /.helptoc vorhanden, diesen nach /helptoc umbenennen
if test -d "${build_tmp}/.helptoc"; then
echo ""
echo " - INFO: Versteckter Ordner /.helptoc wurde lokalisiert und nach /helptoc umbenannt"
mv ${build_tmp}/.helptoc ${build_tmp}/helptoc
fi

# Rechte anpassen
if test -d "${build_tmp}/.helptoc"; then
echo ""
echo " - INFO: Dateirechte anpassen ..."
for i in $(find "${build_tmp}/Pack/" -type f)
do
# echo "ändere Pack: $i"
chmod 755 "$i"
chown root:root "$i"
done
for i in $(find "${build_tmp}/Build/" -type f)
do
# echo "ändere Build: $i"
chmod 755 "$i"
chown root:root "$i"
done
echo " - INFO: Versteckter Ordner /.helptoc wurde lokalisiert und nach /helptoc umbenannt"
mv "${build_tmp}/.helptoc" "${build_tmp}/helptoc"
fi

# Packen und Ablegen der aktuellen Installation in den entsprechenden /Pack - Ordner
echo ""
echo " - INFO: Das Archiv package.tgz wird erstellt..."
tar -C ${build_tmp}/Build -czf ${build_tmp}/Pack/package.tgz .
echo ""
echo " - INFO: Das Archiv package.tgz wird erstellt..."

$FAKEROOT tar -C "${build_tmp}"/"$APP" -czf "${build_tmp}"/"$PKG"/package.tgz .

# Wechsel in den Ablageort von package.tgz bezüglich Aufbau des SPK's
cd ${build_tmp}/Pack
cd "${build_tmp}"/"$PKG"

# Erstellen des eigentlichen SPK's
echo ""
echo " - INFO: Das SPK wird erstellt..."
tar -cf ${project}_$set_spk_version.spk *
mv ${project}_$set_spk_version.spk ${APPDIR}
# Löschen der temporären Daten
echo ""
echo " - INFO: Der temporäre Ordner wird wieder geschlöscht ..."
cd ${APPDIR}
if [ -d "./build_tmp" ] ; then
rm -rf "./build_tmp"
fi
echo ""
echo " - INFO: Das SPK wird erstellt..."
$FAKEROOT tar -cf "${project}"_"$set_spk_version".spk ./*
cp -f "${project}"_"$set_spk_version".spk "${APPDIR}"

echo ""
echo "-----------------------------------------------------------------------------------"

+ 5
- 4
translation_instruction.md View File

@@ -1,8 +1,8 @@
### You miss your language in synOCR?

Then, you can help to translate synOCR in your language.
(currently only the paket management is multilingual - the synOCR GUI will follow in a future release)


Translate text only between double quotation marks.
It is also important that special characters remain in the same place. (e.g. \<br\> / \<b\> …)
@@ -11,9 +11,10 @@ It is also important that special characters remain in the same place. (e.g. \<b


**The following files are needed to translate:**
- ./Pack/scripts/lang/**\<language_code\>**
- ./Pack/WIZARD_UIFILES/uninstall\_uifile\_**\<language\_code\>**
- ./Pack/WIZARD_UIFILES/upgrade\_uifile\_**\<language\_code\>**

- ./PKG/scripts/lang/**\<language_code\>**
- ./PKG/WIZARD_UIFILES/uninstall\_uifile\_**\<language\_code\>**
- ./PKG/WIZARD_UIFILES/upgrade\_uifile\_**\<language\_code\>**
**The following languages are possible:**

Loading…
Cancel
Save