-
-
Save stephenwaite/c6133ece6f7528d9dd64655cc9a90897 to your computer and use it in GitHub Desktop.
Build openemr patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright (C) 2022 Brady Miller <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; either version 2 | |
# of the License, or (at your option) any later version. | |
# | |
# Script to build patch for openemr | |
# | |
# place this script in the official-patches directory and run it in that directory (bash buildPatch) | |
# - it will create a directory at patchDirectory(variable below) with the patch in it | |
# | |
# PATCH SETTINGS | |
patchFileName="6-1-0-Patch-1.zip" | |
versionStart="v6_1_0" | |
versionBranch="rel-610" | |
patchDirectory="official-patch-6-1-0-1" | |
copyStyles=true | |
rm -fr openemr | |
git clone https://github.com/openemr/openemr.git | |
cd openemr | |
git checkout "$versionBranch" | |
listScripts=`git diff --name-only "$versionStart".."$versionBranch"` | |
echo "list of changed scripts:" | |
echo "$listScripts" | |
if [ "$copyStyles" = true ] ; then | |
# need to build the theme scripts | |
npm install --unsafe-perm | |
npm run build | |
fi | |
cd ../ | |
echo "prepare the $patchDirectory directory" | |
rm -fr "$patchDirectory" | |
mkdir "$patchDirectory" | |
cd "$patchDirectory" | |
while read -r line; do | |
dirNameScript=`dirname "$line"` | |
if [ "$dirNameScript" != "." ] && [ ! -d "$dirNameScript" ]; then | |
echo "creating directory $dirNameScript" | |
mkdir -p "$dirNameScript" | |
fi | |
echo "bringing over $line into patch" | |
cp "../openemr/$line" "$line" | |
done <<< "$listScripts" | |
if [ "$copyStyles" = true ] ; then | |
echo "create public/themes directory and bring all the theme scripts over" | |
mkdir -p public/themes | |
cp -R ../openemr/public/themes/* public/themes/ | |
fi | |
echo "make setup.php blank" | |
> setup.php | |
echo "always bring over version.php" | |
cp ../openemr/version.php version.php | |
echo "always bring over sql_patch.php" | |
cp ../openemr/sql_patch.php sql_patch.php | |
echo "just to show you the number of files in the patch:" | |
find . -type f -print | wc -l | |
echo "just to show you all the files in the patch:" | |
find . -type f -print | cut -c 3- | sort | |
echo "dry run to show you command that will standardize permission:" | |
find . -type f -print0 | xargs -0 echo chmod 0644 | |
echo "if above 2 commands look good, then running this to standardize permissions:" | |
find . -type f -print0 | xargs -0 chmod 0644 | |
echo "building the $patchFileName patch:" | |
zip -r "$patchFileName" . | |
cd ../ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment