Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cellframe/prod_build_cellframe-dashboard
1 result
Show changes
Commits on Source (2)
Showing
with 21 additions and 235 deletions
#!/bin/bash
set -e
if [ ${0:0:1} = "/" ]; then
HERE=`dirname $0`
else
CMD=`pwd`/$0
HERE=`dirname ${CMD}`
fi
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET=$(readlink "$SOURCE")
if [[ $TARGET == /* ]]; then
echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'"
SOURCE=$TARGET
else
DIR=$( dirname "$SOURCE" )
echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')"
SOURCE=$DIR/$TARGET # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
echo "SOURCE is '$SOURCE'"
RDIR=$( dirname "$SOURCE" )
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
HERE="$DIR"
export SOURCES=${HERE}/../
......@@ -50,7 +60,7 @@ BUILD_OPTIONS="${@:2}"
BUILD_TARGET="${TARGET:-linux}"
BUILD_DIR=${PWD}/build_${BUILD_TARGET}_${BUILD_TYPE}
BUILD_DIR=${HERE}/../build_${BUILD_TARGET}_${BUILD_TYPE}
VALIDATE_TARGET $TARGET
......@@ -59,6 +69,8 @@ VALIDATE_BUILD_TYPE $BUILD_TYPE
#append qmake debug\release qmake options for this
if [ "${BUILD_TYPE}" = "debug" ]; then
BUILD_OPTIONS[${#BUILD_OPTIONS[@]}]="CONFIG+=debug"
elif [ "${BUILD_TYPE}" = "rwd" ]; then
BUILD_OPTIONS[${#BUILD_OPTIONS[@]}]="CONFIG+=force_debug_info"
else
BUILD_OPTIONS[${#BUILD_OPTIONS[@]}]="CONFIG+=release"
fi
......@@ -78,8 +90,8 @@ cd ${BUILD_DIR}/build
export INSTALL_ROOT=${BUILD_DIR}/dist
#debug out
echo "$QMAKE ../../*.pro ${BUILD_OPTIONS[@]}"
echo "$QMAKE $HERE/../*.pro ${BUILD_OPTIONS[@]}"
"${QMAKE[@]}" ../../*.pro ${BUILD_OPTIONS[@]}
"${QMAKE[@]}" $HERE/../*.pro ${BUILD_OPTIONS[@]}
"${MAKE[@]}" -j$(nproc)
"${MAKE[@]}" install
ANDROID_NDK_HOME="/opt/android-ndk-r21e"
SDKROOT="/opt/android-sdk/bin"
NDKHOST="linux-x86_64"
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ANDRQT_HOME="/usr/lib/crossdev"
RES_PATH=CellFrameDashboardGUI/android/res
WORK_PATH=../cellframe-dashboard-client-build
ARCH_VERSIONS="arm64-v8a"
PACKAGE_PATH="/home/gitlab-runner/production-docker/builds/apk"
CELLFRAME_FILESERVER_CREDS="admin@pub.cellframe.net"
CELLFRAME_FILESERVER_KEY="~/.ssh/demlabs_publish"
CELLFRAME_FILESERVER_PATH="~/web/pub.cellframe.net/public_html/android"
VERSION_FILE=config.pri
VERSION_ENTRIES="VER_MAJ VER_MIN VER_PAT VER_CODE"
VERSION_FORMAT="VER_MAJ.VER_MIN-VER_PAT"
#!/bin/bash
echo "Entering build "
SCRIPTDIR="prod_build/android/scripts"
$SCRIPTDIR/compile_and_pack.sh $@ || { errcode=$?; echo "[ERR] Android build errcode $errcode"; exit 20; }
\ No newline at end of file
#!/bin/bash
. ./prod_build/general/pre-build.sh
export_variables $(find "./prod_build/android/conf" -maxdepth 1 -type f)
PKG_TYPE=$1
platform=$2
BRAND=$3
shift 3
echo "On compile and pack platform with brand $BRAND"
## Passing by build variables, connected with android.
for var in $@; do
export ${var//\"/}
done
SRC_DIR=$(pwd)
RES_PATH=${SRC_DIR}/$RES_PATH
exitcode=0
mkdir -p $SRC_DIR/build/apk
ANDROID_SDK=/opt/android-sdk
ANDROID_BUILD_TOOLS_VERSION=30.0.3
echo $(pwd)
export_variables $(find "./prod_build/android/conf/$BRAND/" -maxdepth 1 -type f)
echo "extracting version"
VERSION=$(extract_version_number)
echo "version number is $VERSION"
APK_NAME=Cellframe-Dashboard
[ ! $MOD = "" ] && MOD="-$MOD"
mkdir -p $WORK_PATH
wd=$(pwd)
cd $WORK_PATH
[ -v WORK_PATH ] && rm -rf * || { echo "WORK_PATH variable is undefined. Indirect launch detected."; exit -1; }
APK_PATH=android/build/outputs/apk/release
KEY_PATH=/release-key.jks
mkdir -p $APK_PATH
echo "arch-versions are $ARCH_VERSIONS"
IFS=" "
for arch in $ARCH_VERSIONS; do
mkdir -p $arch
cd $arch
export QT_SELECT=$arch
ANDROID_ANDRQT_HOME=/usr/lib/crossdev/android-$arch/*/bin
$ANDROID_ANDRQT_HOME/qmake -r -spec android-clang BUILD_VARIANT=$BUILD_VARIANT CONFIG+=release CONFIG+=qml_release BRAND=$BRAND BRAND_TARGET=$BRAND $SRC_DIR/*.pro && \
$ANDROID_NDK_ROOT/prebuilt/$ANDROID_NDKHOST/bin/make -j$(nproc) && \
$ANDROID_NDK_ROOT/prebuilt/$ANDROID_NDKHOST/bin/make install INSTALL_ROOT=$(pwd)/android && \
echo "Deploying in " && pwd && ls && $ANDROID_ANDRQT_HOME/androiddeployqt --output android --verbose --release --input CellFrameDashboardGUI/*.json --jdk $ANDROID_JAVA_HOME --gradle && echo "androiddeployqt complete" && \
$ANDROID_SDK/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign -f -v 4 $(pwd)/$APK_PATH/android-release-unsigned.apk $(pwd)/$APK_PATH/android-release-unsigned-aligned.apk && echo "zipalign complete" && \
$ANDROID_SDK/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner sign -ks $KEY_PATH --ks-key-alias $ALIAS --ks-pass pass:$PASS \
--v1-signing-enabled true --v2-signing-enabled true \
--out $(pwd)/$APK_PATH/android-release-signed.apk $(pwd)/$APK_PATH/android-release-unsigned-aligned.apk && \
mv -v $(pwd)/$APK_PATH/android-release-signed.apk $SRC_DIR/build/apk/"$APK_NAME-${VERSION}-$arch$MOD.apk" || \
exitcode=$?
cd $wd
if [[ $exitcode != 0 ]]; then
echo "Build failed with exit code $exitcode"
cd $workdir
exit $exitcode
fi
done
cd $workdir
\ No newline at end of file
#!/bin/bash
echo "Deploying to $PACKAGE_PATH"
mkdir -p $PACKAGE_PATH
pwd
[ -d build/apk ] && cd build/apk || echo "[ERR] build/apk folder is not created!"
PKGFILES=$(ls . | grep .apk)
MOD=$(echo $MOD | sed 's/-\?static-\?//') && [ ! $MOD = "" ] && MODNAME="-$MOD"
[[ -v CI_COMMIT_REF_NAME ]] && [[ $CI_COMMIT_REF_NAME != "master" ]] && SUBDIR="${CI_COMMIT_REF_NAME}/" || SUBDIR=""
echo $PKGFILES
errcode=0
for pkgfile in $PKGFILES; do
pkgname=$(echo $pkgfile | sed "s/.apk$//")
echo $VERSION_STRING
echo "Pkgfile is $pkgfile"
pkgname_weblink="$(echo $pkgname | sed 's/-\?[0-9]\+\.[0-9]\+-[0-9]\+//' )-latest" #leaving only necessary entries
mv -v $pkgfile $PACKAGE_PATH/$pkgname.apk || echo "[ERR] Something went wrong in publishing the package. Now aborting."
# if [[ -v CI_COMMIT_REF_NAME ]] && { [[ $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" ]] || [[ $(echo $CI_COMMIT_REF_NAME | grep "master\|^release\|^pubtest\|^hotfix") ]]; }; then #TMP restriction for master only.
CODENAME=$(echo $pkgname | rev | cut -d '_' -f1 | rev)
cp -r ../../prod_build/general/essentials/weblink-latest ../../prod_build/general/essentials/$pkgname_weblink
sed -i "/document/s/\/.*deb/\/$pkgname.apk/" ../../prod_build/general/essentials/$pkgname_weblink/index.html
echo "attempting to publish new Cellframe-Dashboard"
[[ $SUBDIR != "" ]] && ssh -i $CELLFRAME_FILESERVER_KEY "$CELLFRAME_FILESERVER_CREDS" "mkdir -p $CELLFRAME_FILESERVER_PATH/$SUBDIR"
scp -i $CELLFRAME_FILESERVER_KEY $PACKAGE_PATH/$pkgname.apk "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR"
scp -r -i $CELLFRAME_FILESERVER_KEY ../../prod_build/general/essentials/$pkgname_weblink "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR"
rm -r ../../prod_build/general/essentials/$pkgname_weblink
done
cd ../..
exit $errcode
\ No newline at end of file
#!/bin/bash
#echo "Stub for post-build actions"
echo "Entering post-build deployment and cleanup"
SCRIPTDIR="prod_build/android/scripts"
$SCRIPTDIR/deploy.sh || { errcode=$?; echo "[ERR] Android deploy errcode $errcode"; exit 30; }
#!/bin/bash
echo "Working with $brand now"
#sed -i "s/android:versionName=\"[0-9]\+\.[0-9]\+-[0-9]\+\"/android:versionName=\"$VERSION_STRING\"/g" brand/$brand/os/android/AndroidManifest.xml
\ No newline at end of file
#!/bin/bash
platform=$1
echo "workdir is $(pwd)"
. prod_build/general/pre-build.sh
export_variables "prod_build/general/conf/*"
. prod_build/general/mod-handler.sh
mod_handler $MOD
IFS=' '
[ -e config.pribak ] && rm config.pribak
VERSION_STRING=$(echo "$VERSION_FORMAT" | sed "s/\"//g" ) #Removing quotes
VERSION_ENTRIES=$(echo "$VERSION_ENTRIES" | sed "s/\"//g" )
export VERSION_STRING=$(extract_version_number)
errcode=0
errstring=""
echo "Platform Candidates test"
echo $IMPLEMENTED
echo "checking out $platform"
[[ $(echo $IMPLEMENTED | grep $platform) != "" ]] && PLATFORMS="$PLATFORMS$platform " || echo "Platform $platform is not implemented in this project yet. Sorry"
echo "Working with $platform now on $brand brand"
PLATFORM_UPPERCASED=$( echo "$platform" | tr '[:lower:]' '[:upper:]')
ENV=${PLATFORM_UPPERCASED}_ENV
varpack=$( export | grep $PLATFORM_UPPERCASED | awk '{print $3}')
if [ $(echo $platform | grep "linux") ]; then
ln -snf prod_build/linux/debian/essentials/$brand ./debian && ls -la . | grep debian
[[ $platform == "linux" ]] && platform="linux/debian"
export_variables "./prod_build/$platform/conf/*"
elif [ $(echo $platform | grep -v "mac") ]; then
export_variables "./prod_build/$platform/conf/*"
fi
if [[ $platform == "mac" ]]; then
[ -e prod_build/$platform/scripts/pre-build.sh ] && prod_build/$platform/scripts/pre-build.sh $CHROOT_PREFIX $platform || { errcode=$? && errstring="$errstring macprebuild $errcode" && echo "[ERR] Mac host prefetch errcode $errcode. Skipping"; exit $errcode; } #Setting up brand in conf file
for conffile in $(find "./prod_build/$platform/conf" | grep conf/ | grep -v .bak); do
export_variables $conffile
done
IFS=' '
for arch in $ARCH_VERSIONS; do
prod_build/$platform/scripts/build.sh $arch || { errcode=$? && errstring="$errstring macbuild $errcode" && echo "[ERR] Mac host build errcode $errcode now. Skipping"; exit $errcode; }
done
exit 0
else
[[ -e prod_build/$platform/scripts/pre-build.sh ]] && prod_build/$platform/scripts/pre-build.sh $platform || echo "[WRN] No pre-build script detected. Moving on" #For actions before build not in chroot and in chroot (version update, install missing dependencies(under schroot))
prod_build/$platform/scripts/build.sh || { errcode=$? && errstring="$errstring ${platform}_build $errcode" && echo "[ERR] $platform build on $HOST_DISTR_VERSIONS-$HOST_ARCH_VERSIONS errcode $errcode"; }
fi
unexport_variables "./prod_build/$platform/conf/*"
[[ $errstring != "" ]] && echo "$brand done with errors:" && echo "$errstring" >> ~/prod_log && errstring="" && errcode=5 ## General failure error
cd $wd
exit $errcode
IMPLEMENTED="linux/debian linux/ubuntu windows mac android"
VERSION_FILE=config.pri
VERSION_ENTRIES="VER_MAJ VER_MIN VER_PAT VER_CODE"
VERSION_FORMAT="VER_MAJ.VER_MIN-VER_PAT"
DirectoryIndex index.php index.html index.htm
<script>
window.onload = function(){
document.location = '../cellframe-dashboard.deb';}
</script>
mod_handler() {
MODLIST=$1
IFS=' '
for mod in $MODLIST; do
case $mod in
"static")
[[ $(echo "$PLATFORM_CANDIDATES" | grep "linux") != "" ]] && sed -ibak "/static/s/^#unix/unix/" CellFrameDashboard.pro && [ ! -z "ICU_LINUX_PATH" ] && sed -ibak "s!ICU_LINUX_PATH!$ICU_LINUX_PATH!" CellFrameDashboard.pro && \
PLATFORM_CANDIDATES=$( echo $PLATFORM_CANDIDATES | sed "s/linux\/[a-z]\+ \?//g" | sed "s/$/ linux/" | sed "s/^ //") || sed -ibak "/static/s/^unix/#unix/" CellFrameDashboard.pro #For toggling static mode
;;
*)
echo "No handling required for mod $mod. Proceeding"
;;
esac
done
IFS='\n'
}