From 1c2a732872e72e760910b3a971e7b1738300caf0 Mon Sep 17 00:00:00 2001 From: dpuzyrkov <dpuzyrkov@gmail.com> Date: Fri, 7 Jul 2023 18:51:01 +0700 Subject: [PATCH] ... --- build.sh | 34 +++- oldscripts/android/conf/environment | 7 - oldscripts/android/conf/project_props | 3 - oldscripts/android/conf/publish | 2 - oldscripts/android/conf/version_info | 3 - oldscripts/android/scripts/compile.sh | 0 oldscripts/android/scripts/deploy.sh | 0 oldscripts/android/scripts/pack.sh | 0 oldscripts/android/scripts/pre-build.sh | 0 oldscripts/android/scripts/test.sh | 0 oldscripts/general/build.sh | 16 -- oldscripts/general/conf/version_info | 3 - .../essentials/weblink-latest/.htaccess | 1 - .../essentials/weblink-latest/index.html | 4 - oldscripts/general/post-build.sh | 19 -- oldscripts/general/pre-build.sh | 48 ----- oldscripts/ios/scripts/compile.sh | 0 oldscripts/ios/scripts/deploy.sh | 0 oldscripts/ios/scripts/pack.sh | 0 oldscripts/ios/scripts/pre-build.sh | 0 oldscripts/ios/scripts/test.sh | 0 oldscripts/linux/debian/conf/dependencies | 1 - oldscripts/linux/debian/conf/publish | 5 - oldscripts/linux/debian/essentials/config | 80 -------- oldscripts/linux/debian/essentials/postinst | 190 ------------------ oldscripts/linux/debian/essentials/postrm | 17 -- oldscripts/linux/debian/essentials/rules | 10 - oldscripts/linux/debian/essentials/templates | 133 ------------ oldscripts/linux/debian/scripts/build.sh | 11 - oldscripts/linux/debian/scripts/cleanup.sh | 5 - .../linux/debian/scripts/compile_and_pack.sh | 80 -------- oldscripts/linux/debian/scripts/deploy.sh | 60 ------ .../linux/debian/scripts/install_test.sh | 3 - oldscripts/linux/debian/scripts/pack.sh | 0 oldscripts/linux/debian/scripts/post-build.sh | 8 - oldscripts/linux/debian/scripts/pre-build.sh | 101 ---------- .../debian/scripts/publish_remote/reprepro.sh | 16 -- oldscripts/linux/debian/scripts/test.sh | 4 - oldscripts/linux/ubuntu/conf/dependencies | 1 - oldscripts/linux/ubuntu/conf/publish | 5 - oldscripts/linux/ubuntu/essentials | 1 - oldscripts/linux/ubuntu/scripts/build.sh | 1 - oldscripts/linux/ubuntu/scripts/chroot | 1 - oldscripts/linux/ubuntu/scripts/cleanup.sh | 1 - .../linux/ubuntu/scripts/compile_and_pack.sh | 1 - oldscripts/linux/ubuntu/scripts/deploy.sh | 1 - .../linux/ubuntu/scripts/install_test.sh | 1 - oldscripts/linux/ubuntu/scripts/pack.sh | 1 - oldscripts/linux/ubuntu/scripts/post-build.sh | 1 - oldscripts/linux/ubuntu/scripts/pre-build.sh | 138 ------------- oldscripts/linux/ubuntu/scripts/test.sh | 1 - oldscripts/mac/scripts/compile.sh | 13 -- oldscripts/mac/scripts/deploy.sh | 0 oldscripts/mac/scripts/pack.sh | 0 oldscripts/mac/scripts/pre-build.sh | 0 oldscripts/mac/scripts/test.sh | 0 oldscripts/windows/conf/win_libs | 1 - oldscripts/windows/scripts/compile.bat | 5 - oldscripts/windows/scripts/compile.sh | 28 --- oldscripts/windows/scripts/deploy.sh | 0 oldscripts/windows/scripts/pack.sh | 0 oldscripts/windows/scripts/pre-build.sh | 0 oldscripts/windows/scripts/test.sh | 0 pack.sh | 23 ++- packaging/linux.sh | 24 ++- packaging/osx.sh | 27 ++- targets/linux.sh | 25 ++- targets/osx.sh | 25 ++- targets/windows.sh | 64 ++++-- validate.sh | 24 ++- 70 files changed, 174 insertions(+), 1103 deletions(-) delete mode 100644 oldscripts/android/conf/environment delete mode 100644 oldscripts/android/conf/project_props delete mode 100644 oldscripts/android/conf/publish delete mode 100644 oldscripts/android/conf/version_info delete mode 100755 oldscripts/android/scripts/compile.sh delete mode 100755 oldscripts/android/scripts/deploy.sh delete mode 100755 oldscripts/android/scripts/pack.sh delete mode 100755 oldscripts/android/scripts/pre-build.sh delete mode 100755 oldscripts/android/scripts/test.sh delete mode 100755 oldscripts/general/build.sh delete mode 100644 oldscripts/general/conf/version_info delete mode 100644 oldscripts/general/essentials/weblink-latest/.htaccess delete mode 100644 oldscripts/general/essentials/weblink-latest/index.html delete mode 100755 oldscripts/general/post-build.sh delete mode 100755 oldscripts/general/pre-build.sh delete mode 100755 oldscripts/ios/scripts/compile.sh delete mode 100755 oldscripts/ios/scripts/deploy.sh delete mode 100755 oldscripts/ios/scripts/pack.sh delete mode 100755 oldscripts/ios/scripts/pre-build.sh delete mode 100755 oldscripts/ios/scripts/test.sh delete mode 100644 oldscripts/linux/debian/conf/dependencies delete mode 100644 oldscripts/linux/debian/conf/publish delete mode 100755 oldscripts/linux/debian/essentials/config delete mode 100755 oldscripts/linux/debian/essentials/postinst delete mode 100755 oldscripts/linux/debian/essentials/postrm delete mode 100755 oldscripts/linux/debian/essentials/rules delete mode 100755 oldscripts/linux/debian/essentials/templates delete mode 100755 oldscripts/linux/debian/scripts/build.sh delete mode 100755 oldscripts/linux/debian/scripts/cleanup.sh delete mode 100755 oldscripts/linux/debian/scripts/compile_and_pack.sh delete mode 100755 oldscripts/linux/debian/scripts/deploy.sh delete mode 100755 oldscripts/linux/debian/scripts/install_test.sh delete mode 100755 oldscripts/linux/debian/scripts/pack.sh delete mode 100755 oldscripts/linux/debian/scripts/post-build.sh delete mode 100755 oldscripts/linux/debian/scripts/pre-build.sh delete mode 100644 oldscripts/linux/debian/scripts/publish_remote/reprepro.sh delete mode 100755 oldscripts/linux/debian/scripts/test.sh delete mode 100644 oldscripts/linux/ubuntu/conf/dependencies delete mode 100644 oldscripts/linux/ubuntu/conf/publish delete mode 120000 oldscripts/linux/ubuntu/essentials delete mode 120000 oldscripts/linux/ubuntu/scripts/build.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/chroot delete mode 120000 oldscripts/linux/ubuntu/scripts/cleanup.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/compile_and_pack.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/deploy.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/install_test.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/pack.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/post-build.sh delete mode 100755 oldscripts/linux/ubuntu/scripts/pre-build.sh delete mode 120000 oldscripts/linux/ubuntu/scripts/test.sh delete mode 100755 oldscripts/mac/scripts/compile.sh delete mode 100755 oldscripts/mac/scripts/deploy.sh delete mode 100755 oldscripts/mac/scripts/pack.sh delete mode 100755 oldscripts/mac/scripts/pre-build.sh delete mode 100755 oldscripts/mac/scripts/test.sh delete mode 100644 oldscripts/windows/conf/win_libs delete mode 100644 oldscripts/windows/scripts/compile.bat delete mode 100755 oldscripts/windows/scripts/compile.sh delete mode 100755 oldscripts/windows/scripts/deploy.sh delete mode 100755 oldscripts/windows/scripts/pack.sh delete mode 100755 oldscripts/windows/scripts/pre-build.sh delete mode 100755 oldscripts/windows/scripts/test.sh diff --git a/build.sh b/build.sh index c723c3d..095c5c2 100755 --- a/build.sh +++ b/build.sh @@ -1,17 +1,29 @@ #!/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 ) +MHERE="$DIR" + + +export SOURCES=${MHERE}/../ -export SOURCES=${HERE}/../ #validate input params -. ${HERE}/validate.sh +. ${MHERE}/validate.sh Help() { @@ -77,8 +89,10 @@ echo "with options: [${BUILD_OPTIONS[@]}]" cd ${BUILD_DIR}/build #debug out -echo "$CMAKE ${BUILD_OPTIONS[@]}" +pwd +echo "${CMAKE[@]} ${MHERE}/../ -DCREATE_DEFAULT_CONFIG=OFF ${BUILD_OPTIONS[@]}" +#echo $HERE export INSTALL_ROOT=${BUILD_DIR}/dist -"${CMAKE[@]}" ${HERE}/../ ${BUILD_OPTIONS[@]} +"${CMAKE[@]}" ${MHERE}/../ -DCREATE_DEFAULT_CONFIG=OFF ${BUILD_OPTIONS[@]} "${MAKE[@]}" -j$(nproc) "${MAKE[@]}" install DESTDIR=${INSTALL_ROOT} diff --git a/oldscripts/android/conf/environment b/oldscripts/android/conf/environment deleted file mode 100644 index 5099a4a..0000000 --- a/oldscripts/android/conf/environment +++ /dev/null @@ -1,7 +0,0 @@ -ANDROID_NDK_HOME="/opt/android-ndk-r16b" -SDKROOT="/opt/android-sdk/bin" -NDKHOST="linux-x86_64" -JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" -ANDRQT_HOME="/usr/lib/crossdev" -HOST_DISTR_VERSIONS="stretch" -HOST_ARCH_VERSIONS="amd64" diff --git a/oldscripts/android/conf/project_props b/oldscripts/android/conf/project_props deleted file mode 100644 index d1d7d50..0000000 --- a/oldscripts/android/conf/project_props +++ /dev/null @@ -1,3 +0,0 @@ -RES_PATH=SapNetGui/resources/UltraPad/platforms/android -WORK_PATH=../sapnet-client-build -BRAND=UltraPad diff --git a/oldscripts/android/conf/publish b/oldscripts/android/conf/publish deleted file mode 100644 index 896aa10..0000000 --- a/oldscripts/android/conf/publish +++ /dev/null @@ -1,2 +0,0 @@ -ARCH_VERSIONS="arm64-v8a armv7 x86 x86_64 arm" -PACKAGE_PATH=builds/apk/ diff --git a/oldscripts/android/conf/version_info b/oldscripts/android/conf/version_info deleted file mode 100644 index 288cd5c..0000000 --- a/oldscripts/android/conf/version_info +++ /dev/null @@ -1,3 +0,0 @@ -VERSION_FILE=config.pri -VERSION_ENTRIES="VER_MAJ VER_MIN VER_PAT VER_CODE" -VERSION_FORMAT="VER_MAJ.VER_MIN-VER_PAT" diff --git a/oldscripts/android/scripts/compile.sh b/oldscripts/android/scripts/compile.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/android/scripts/deploy.sh b/oldscripts/android/scripts/deploy.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/android/scripts/pack.sh b/oldscripts/android/scripts/pack.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/android/scripts/pre-build.sh b/oldscripts/android/scripts/pre-build.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/android/scripts/test.sh b/oldscripts/android/scripts/test.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/general/build.sh b/oldscripts/general/build.sh deleted file mode 100755 index 44d14b2..0000000 --- a/oldscripts/general/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -platform=$1 -echo "workdir is $(pwd)" -. prod_build/general/pre-build.sh -export_variables "./prod_build/general/conf/*" - -[ -e prod_build/$platform/scripts/pre-build.sh ] && prod_build/$platform/scripts/pre-build.sh || exit $? #For actions before build not in chroot and in chroot (version update, install missing dependencies(under schroot)) -prod_build/$platform/scripts/build.sh $PKG_TYPE || { errcode=$? && unexport_variables "./prod_build/$platform/conf/*"; exit $errcode; } -echo "workdir before postinstall is $(pwd)" -#[ -e prod_build/$platform/scripts/post-build.sh ] && prod_build/$platform/scripts/post-build.sh errcode=$? #For post-build actions not in chroot (global publish) -unexport_variables "./prod_build/$platform/conf/*" - -cd $wd - -exit $errcode diff --git a/oldscripts/general/conf/version_info b/oldscripts/general/conf/version_info deleted file mode 100644 index d33ee15..0000000 --- a/oldscripts/general/conf/version_info +++ /dev/null @@ -1,3 +0,0 @@ -VERSION_FILE=CMakeLists.txt -VERSION_ENTRIES="CPACK_PACKAGE_VERSION_MAJOR CPACK_PACKAGE_VERSION_MINOR CPACK_PACKAGE_VERSION_PATCH" -VERSION_FORMAT="CPACK_PACKAGE_VERSION_MAJOR.CPACK_PACKAGE_VERSION_MINOR-CPACK_PACKAGE_VERSION_PATCH" diff --git a/oldscripts/general/essentials/weblink-latest/.htaccess b/oldscripts/general/essentials/weblink-latest/.htaccess deleted file mode 100644 index e2d575a..0000000 --- a/oldscripts/general/essentials/weblink-latest/.htaccess +++ /dev/null @@ -1 +0,0 @@ -DirectoryIndex index.php index.html index.htm diff --git a/oldscripts/general/essentials/weblink-latest/index.html b/oldscripts/general/essentials/weblink-latest/index.html deleted file mode 100644 index 7f01b04..0000000 --- a/oldscripts/general/essentials/weblink-latest/index.html +++ /dev/null @@ -1,4 +0,0 @@ -<script> -window.onload = function(){ - document.location = '../cellframe-node-3.2-2-Debian-10-amd64-buster.deb';} -</script> diff --git a/oldscripts/general/post-build.sh b/oldscripts/general/post-build.sh deleted file mode 100755 index 1d78267..0000000 --- a/oldscripts/general/post-build.sh +++ /dev/null @@ -1,19 +0,0 @@ -echo "workdir before postinstall is $(pwd)" - -platform=$1 -errstring="" -errcode=0 - -. prod_build/general/pre-build.sh -for conffile in $(find "./prod_build/$platform/conf" | grep conf/ | grep -v .bak); do - export_variables $conffile - echo "export variables from $conffile" -done -export_variables "prod_build/general/conf/*" - -[[ -e prod_build/$platform/scripts/post-build.sh ]] && prod_build/$platform/scripts/post-build.sh $platform || { errcode=$? && errstring="$errstring ${platform}_postbuild errcode $errcode"; } #For post-build actions not in chroot (global publish) -[[ $errstring != "" ]] && echo "$brand done with errors:" && echo "$errstring" >> ~/prod_log && errstring="" && errcode=5 ## General failure error - -unexport_variables $(find "./prod_build/$platform/conf" -maxdepth 1 -type f) - -exit $errcode diff --git a/oldscripts/general/pre-build.sh b/oldscripts/general/pre-build.sh deleted file mode 100755 index dbe6057..0000000 --- a/oldscripts/general/pre-build.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -extract_version_number() { - -IFS=" " -local VERSION_STRING=$VERSION_FORMAT -for entry in $VERSION_ENTRIES; do - VERSION_STRING=$(echo $VERSION_STRING | sed "s/$entry/$( cat $VERSION_FILE | grep $entry | grep [0-9] | cut -d ' ' -f3 | cut -d ")" -f1 )/") #Replacing templates with numbers -done -echo -e "$VERSION_STRING" - -} - -extract_gitlog_text() { - -borders=$( git log | grep -n 'commit\|Date' | head -n 3 | tail -n 2 | cut -d ':' -f1) -upb=$(echo $borders | cut -d $'\n' -f1) -dwnb=$(echo $borders | cut -d $'\n' -f2) -text=$(git log | head -n $( expr $dwnb - 2 ) | tail -n $( expr $dwnb - $upb - 3 ) ) -echo $text - -} - -export_variables() { - -IFS=$'\n' -for variable in $(cat $1); do - echo "$variable" - export $(echo "$variable" | sed 's/\"//g') -done - -} - -unexport_variables() { - -IFS=$'\n' -for variable in $(cat $1); do - echo "$variable" - export -n $(echo $variable | cut -d '=' -f1) -done - -} - -# init cellframe-sdk subs -cd cellframe-sdk -git submodule init -git submodule update -cd .. diff --git a/oldscripts/ios/scripts/compile.sh b/oldscripts/ios/scripts/compile.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/ios/scripts/deploy.sh b/oldscripts/ios/scripts/deploy.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/ios/scripts/pack.sh b/oldscripts/ios/scripts/pack.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/ios/scripts/pre-build.sh b/oldscripts/ios/scripts/pre-build.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/ios/scripts/test.sh b/oldscripts/ios/scripts/test.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/linux/debian/conf/dependencies b/oldscripts/linux/debian/conf/dependencies deleted file mode 100644 index 7e9e382..0000000 --- a/oldscripts/linux/debian/conf/dependencies +++ /dev/null @@ -1 +0,0 @@ -PKG_DEPS="libsqlite3-dev libmagic-dev libcurl4-gnutls-dev traceroute libpq-dev libzip-dev libz-dev zlib1g-dev" diff --git a/oldscripts/linux/debian/conf/publish b/oldscripts/linux/debian/conf/publish deleted file mode 100644 index b5df2d7..0000000 --- a/oldscripts/linux/debian/conf/publish +++ /dev/null @@ -1,5 +0,0 @@ -PACKAGE_PATH=/home/gitlab-runner/production-docker/builds/deb/ -REPO_DIR_SRC=/var/tmp/repository -REPO_ADDR=debian.pub.demlabs.net -REPO_DIR=/var/www/html/debian.pub.demlabs.net -DISTR_COMPONENT=main diff --git a/oldscripts/linux/debian/essentials/config b/oldscripts/linux/debian/essentials/config deleted file mode 100755 index ae86fd7..0000000 --- a/oldscripts/linux/debian/essentials/config +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -e -. /usr/share/debconf/confmodule - - -case "$1" in -reconfigure|configure) - - db_input critical cellframe-node/auto_online || true - db_go || true - - db_input critical cellframe-node/debug_mode || true - db_go || true - - db_input critical cellframe-node/server_enabled || true - db_go || true - - db_input critical cellframe-node/server_addr || true - db_go || true - - db_input critical cellframe-node/server_port || true - db_go || true - - db_input critical cellframe-node/notify_srv_addr || true - db_go || true - - db_input critical cellframe-node/notify_srv_port || true - db_go || true - - db_input critical cellframe-node/subzero_enabled || true - db_go || true - - db_get cellframe-node/subzero_enabled - if [ "$RET" = "true" ]; then - db_input critical cellframe-node/subzero_node_type || true - db_go || true - fi - - db_input critical cellframe-node/kelvpn_minkowski_enabled || true - db_go || true - - db_get cellframe-node/kelvpn_minkowski_enabled - if [ "$RET" = "true" ]; then - db_input critical cellframe-node/kelvpn_minkowski_node_type || true - db_go || true - fi - - db_input critical cellframe-node/backbone_enabled || true - db_go || true - - db_get cellframe-node/backbone_enabled - if [ "$RET" = "true" ]; then - db_input critical cellframe-node/backbone_node_type || true - db_go || true - fi - - db_input critical cellframe-node/mileena_enabled || true - db_go || true - - db_get cellframe-node/mileena_enabled - if [ "$RET" = "true" ]; then - db_input critical cellframe-node/mileena_node_type || true - db_go || true - fi - - db_input critical cellframe-node/enable_python_plugins || true - db_go || true - - db_get cellframe-node/enable_python_plugins - if [ "$RET" = "true" ]; then - db_input critical cellframe-node/python_plugins_path || true - db_go || true - fi -;; -*) - echo "config called with unknown argument \`$1'" >&2 - exit 1 -;; -esac - - diff --git a/oldscripts/linux/debian/essentials/postinst b/oldscripts/linux/debian/essentials/postinst deleted file mode 100755 index 98456ce..0000000 --- a/oldscripts/linux/debian/essentials/postinst +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/bash -e -. /usr/share/debconf/confmodule - -DAP_CHAINS_NAME="cellframe" -DAP_APP_NAME="${DAP_CHAINS_NAME}-node" -DAP_PREFIX="/opt/${DAP_APP_NAME}" - -DAP_CFG_TPL="${DAP_PREFIX}/share/configs/${DAP_APP_NAME}.cfg.tpl" - -# Store write config to new if present smth -DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg" - -[ -e "/etc/profile.d/${DAP_APP_NAME}.sh" ] || ln -sf ${DAP_PREFIX}/share/profile.d/${DAP_APP_NAME}.sh /etc/profile.d/${DAP_APP_NAME}.sh - -# Init node config -if [ -e "${DAP_CFG}" ]; then - DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg.dpkg-new" -else - DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg" -fi - -cat ${DAP_CFG_TPL} > ${DAP_CFG} || true - -sed -i "s/{PREFIX}/\/opt\/${DAP_APP_NAME}/g" ${DAP_CFG} || true - -db_get cellframe-node/debug_mode || true -sed -i "s/{DEBUG_MODE}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/auto_online || true -sed -i "s/{AUTO_ONLINE}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/server_enabled || true -sed -i "s/{SERVER_ENABLED}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/server_port || true -sed -i "s/{SERVER_PORT}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/server_addr || true -sed -i "s/{SERVER_ADDR}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/notify_srv_addr || true -sed -i "s/{NOTIFY_SRV_ADDR}/${RET}/g" ${DAP_CFG} || true - -db_get cellframe-node/notify_srv_port || true -sed -i "s/{NOTIFY_SRV_PORT}/${RET}/g" ${DAP_CFG} || true - -# Init subzero -NET_NAME="subzero" - -db_get cellframe-node/subzero_enabled || true -if [ "${RET}" = "true" ]; then - DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl" - DAP_NET_CFG="" - - if [ -e "$DAP_CFG_NET" ]; then - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new" - else - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - fi - - cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true - db_get cellframe-node/subzero_node_type || true - NODE_TYPE=${RET} - sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG} || true - echo "[*] Enabled subzero" -fi - -# Init mileena -NET_NAME="mileena" - -db_get cellframe-node/mileena_enabled || true -if [ "$RET" = "true" ]; then - DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl" - DAP_NET_CFG="" - - if [ -e "${DAP_CFG_NET}" ]; then - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new" - else - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - fi - - cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true - db_get cellframe-node/mileena_node_type || true - NODE_TYPE=${RET} - sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG} || true - echo "[*] Enabled mileena" -fi - -# Init Minkowski -NET_NAME="kelvpn-minkowski" - -db_get cellframe-node/kelvpn_minkowski_enabled || true -if [ "${RET}" = "true" ]; then - DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl" - DAP_NET_CFG="" - - if [ -e "$DAP_CFG_NET" ]; then - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new" - else - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - fi - - cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true - db_get cellframe-node/kelvpn_minkowski_node_type || true - NODE_TYPE=${RET} - sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG} || true - echo "[*] Enabled kelvpn-minkowski" -fi - -# Init Backbone -NET_NAME="Backbone" - -db_get cellframe-node/backbone_enabled || true -if [ "${RET}" = "true" ]; then - DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl" - DAP_NET_CFG="" - - if [ -e "${DAP_CFG_NET}" ]; then - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new" - else - DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg" - fi - - cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true - db_get cellframe-node/backbone_node_type || true - NODE_TYPE=$RET - sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG} || true - echo "[*] Enabled Backbone" -fi - -#Set up Python plugins -db_get cellframe-node/enable_python_plugins || true -if [ "${RET}" = "true" ]; then - sed -i 's/#\[plugins\]/\[plugins\]/g' ${DAP_CFG} || true - sed -i 's/#py_load=.*/py_load=true/g' ${DAP_CFG} || true - db_get cellframe-node/python_plugins_path || true - sed -i "s|#py_path=.*|py_path=${RET}|g" ${DAP_CFG} || true - echo "[*] Enabled Python plugins" -fi - -if [ $(cat /etc/passwd | grep ${DAP_APP_NAME}) ] ; then - usermod ${DAP_APP_NAME} -s /bin/false > /dev/null || true # Let's change the default shell just in case -else - echo "[*] Add user ${DAP_APP_NAME}" - adduser --system --no-create-home --group --home /opt/${DAP_APP_NAME} ${DAP_APP_NAME} --shell /bin/false > /dev/null || true -fi - -echo "[*] Check /etc/systemd/system/${DAP_APP_NAME}.service file..." -if [ -e /etc/systemd/system/${DAP_APP_NAME}.service ]; then - echo "[*] Restarting ${DAP_APP_NAME} to implement changes" - systemctl stop ${DAP_APP_NAME} >> /dev/null || true - echo "[*] Stopped ${DAP_APP_NAME}" - systemctl daemon-reload || true - systemctl start ${DAP_APP_NAME} || true - echo "[*] Started ${DAP_APP_NAME}" -else - echo "[!] Installing ${DAP_APP_NAME} as systemd service" - ln -sf $DAP_PREFIX/share/${DAP_APP_NAME}.service /etc/systemd/system/${DAP_APP_NAME}.service || true - systemctl enable ${DAP_PREFIX}/share/${DAP_APP_NAME}.service || true - echo "[*] Enabling logrotate" - ln -sf ${DAP_PREFIX}/share/logrotate/${DAP_APP_NAME} /etc/logrotate.d/${DAP_APP_NAME} || true - - mkdir -p ${DAP_PREFIX}/var/{run,lib/wallet,lib/global_db,lib/plugins,log} || true - - touch ${DAP_PREFIX}/var/run/${DAP_APP_NAME}.pid || true - - for filename in $(find ${DAP_PREFIX} | grep -v bugreport); do - if [ -d ${filename} ]; then - chmod 0775 ${filename} 2>/dev/null || true - else - chmod 0664 ${filename} 2>/dev/null || true - fi - done - - chmod 0666 ${DAP_CFG} - chmod 0666 ${DAP_CFG_TPL} - chmod 0774 ${DAP_PREFIX}/bin/* || true - - #set python permissions - find ${DAP_PREFIX}/bin/python -type d -exec chmod 755 {} + - chmod 774 ${DAP_PREFIX}/bin/python/bin/* - chown -R ${DAP_APP_NAME}: ${DAP_PREFIX} - echo "[*] Starting ${DAP_APP_NAME} service" - systemctl start ${DAP_APP_NAME} || true - echo "[!] Done" -fi \ No newline at end of file diff --git a/oldscripts/linux/debian/essentials/postrm b/oldscripts/linux/debian/essentials/postrm deleted file mode 100755 index b6cd2eb..0000000 --- a/oldscripts/linux/debian/essentials/postrm +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/bash -e -if [ "$1" == "purge" ] && [ -e /usr/share/debconf/confmodule ] ; then -. /usr/share/debconf/confmodule -db_purge -fi -GROUP_RM="cellframe-node" - -systemctl stop cellframe-node || true -systemctl disable cellframe-node || true - -#for username in `cat /etc/passwd | grep "/home" | cut -d ':' -f1`; do -# gpasswd -d $username $GROUP_RM || true -#done -#rm -r /opt/cellframe-node || true -#groupdel cellframe-node || true -#userdel cellframe-node || true - diff --git a/oldscripts/linux/debian/essentials/rules b/oldscripts/linux/debian/essentials/rules deleted file mode 100755 index 8ebdadf..0000000 --- a/oldscripts/linux/debian/essentials/rules +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/make -f - -override_dh_fixperms: - dh_fixperms -X/opt/cellframe-node - chmod 777 /opt/cellframe-node/bin/cellframe-node-cli -override_dh_auto_install: - dh_auto_install -- prefix=/opt/cellframe-node -%: -# dh $@ --with=systemd - dh $@ diff --git a/oldscripts/linux/debian/essentials/templates b/oldscripts/linux/debian/essentials/templates deleted file mode 100755 index 53d7dd3..0000000 --- a/oldscripts/linux/debian/essentials/templates +++ /dev/null @@ -1,133 +0,0 @@ -Template: cellframe-node/auto_online -Default: false -Choices: true, false -Type: select -Description: Auto online - Bring up links automatically and go to ONLINE network state - -Template: cellframe-node/debug_mode -Default: false -Choices: true, false -Type: select -Description: Debug mode - Debug mode for logs - -Template: cellframe-node/server_enabled -Default: false -Choices: true, false -Type: select -Description: Accept connections - Accept connections - -Template: cellframe-node/server_port -Default: 8079 -Type: string -Description: Server port - Server port to listen on, recommended 8079 - -Template: cellframe-node/server_addr -Default: 0.0.0.0 -Type: string -Description: Server address - Server address to listen on - -Template: cellframe-node/notify_srv_addr -Default: 127.0.0.1 -Type: string -Description: Notify server address - Notify server address to listen on - -Template: cellframe-node/notify_srv_port -Default: 8080 -Type: string -Description: Notify server port - Notify server port to listen on - -Template: cellframe-node/subzero_enabled -Default: true -Choices: true, false -Type: select -Description: SubZero: Enable network - Subzero Testnet: Enable network auto load on start - -Template: cellframe-node/subzero_node_type -Type: select -Default: full -Choices: full, light, master, archive, root -Description: SubZero: Node role - Select node role:. - Light - Synchronize only local wallets - full - Sync all its cell - master - Allow to store values in chains and take comission, sync all shards that will need to be synced - archive - Sync all the network - root - Special predefined root nodes, usually produces zerochain and acts like archive as well - -Template: cellframe-node/mileena_enabled -Default: true -Choices: true, false -Type: select -Description: Mileena: Enable network - Mileena Testnet: Enable network auto load on start - -Template: cellframe-node/mileena_node_type -Type: select -Default: full -Choices: full, light, master, archive, root -Description: Mileena: Node role - Select node role:. - Light - Synchronize only local wallets - full - Sync all its cell - master - Allow to store values in chains and take comission, sync all shards that will need to be synced - archive - Sync all the network - root - Special predefined root nodes, usually produces zerochain and acts like archive as well - -Template: cellframe-node/kelvpn_minkowski_enabled -Default: true -Choices: true, false -Type: select -Description: Kelvpn Minkowski: Enable network - Minkowski Testnet: Enable network auto load on start - -Template: cellframe-node/kelvpn_minkowski_node_type -Type: select -Default: full -Choices: full, light, master, archive, root -Description: Kelvpn Minkowski: Node role - Select node role:. - Light - Synchronize only local wallets - full - Sync all its cell - master - Allow to store values in chains and take comission, sync all shards that will need to be synced - archive - Sync all the network - root - Special predefined root nodes, usually produces zerochain and acts like archive as well - -Template: cellframe-node/backbone_enabled -Default: true -Choices: true, false -Type: select -Description: Backbone: Enable network - Backbone Mainnet: Enable network auto load on start - -Template: cellframe-node/backbone_node_type -Type: select -Default: full -Choices: full, light, master, archive, root -Description: Backbone: Node role - Select node role:. - Light - Synchronize only local wallets - full - Sync all its cell - master - Allow to store values in chains and take comission, sync all shards that will need to be synced - archive - Sync all the network - root - Special predefined root nodes, usually produces zerochain and acts like archive as well - -Template: cellframe-node/enable_python_plugins -Default: false -Choices: true, false -Type: select -Description: Python plugins: Enable Python plugins - Python plugins: Enable Python plugins - -Template: cellframe-node/python_plugins_path -Default: /opt/cellframe-node/var/lib/plugins -Type: string -Description: Python plugins path - Path for Python plugins \ No newline at end of file diff --git a/oldscripts/linux/debian/scripts/build.sh b/oldscripts/linux/debian/scripts/build.sh deleted file mode 100755 index 79768e9..0000000 --- a/oldscripts/linux/debian/scripts/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -WORKDIR="resources/cellframe/cellframe-node" -SCRIPTDIR="prod_build/linux/debian/scripts" - -#cd $WORKDIR - $SCRIPTDIR/compile_and_pack.sh || exit 2 && \ - $SCRIPTDIR/test.sh || exit 3 && \ - $SCRIPTDIR/install_test.sh || exit 4 && \ - $SCRIPTDIR/cleanup.sh || exit 5 -#cd $wd diff --git a/oldscripts/linux/debian/scripts/cleanup.sh b/oldscripts/linux/debian/scripts/cleanup.sh deleted file mode 100755 index 61180be..0000000 --- a/oldscripts/linux/debian/scripts/cleanup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -[ -d build ] && rm -r build -#[ -d packages ] && rm -r packages -exit 0 diff --git a/oldscripts/linux/debian/scripts/compile_and_pack.sh b/oldscripts/linux/debian/scripts/compile_and_pack.sh deleted file mode 100755 index 0e6c428..0000000 --- a/oldscripts/linux/debian/scripts/compile_and_pack.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - - - -substitute_pkgname_postfix() { - for variable in $(lsb_release -a 2>/dev/null | sed 's/\t//g' | sed 's/ //g' | sed 's/\:/\=/g'); do - echo "variable is $variable" - export $variable - done - sed -i "/ CPACK_SYSTEM_TYPE/s/\".*\"/\"$DistributorID\"/" CMakeLists.txt - sed -i "/ CPACK_SYSTEM_VERSION/s/\".*\"/\"$Release\"/" CMakeLists.txt - sed -i "/ CPACK_SYSTEM_CODENAME/s/\".*\"/\"$Codename\"/" CMakeLists.txt - export -n "DistributorID" - export -n "Release" - export -n "Codename" - export -n "Description" -} - -repack() { - -DEBNAME=$1 -DISTR_CODENAME="$Codename" -echo "Renaming controlde on $DEBNAME" -mkdir tmp && cd tmp - -#ПроÑматриваем архив и ищем Ñтроку Ñ control.tar -#Результат заноÑим в переменную -CONTROL=$(ar t ../${DEBNAME} | grep control.tar) - -ar x ../$DEBNAME $CONTROL -tar xf $CONTROL -VERSION=$(cat control | grep Version | cut -d ':' -f2) -echo "Version is $VERSION" -sed -i "s/$VERSION/${VERSION}-${DISTR_CODENAME}/" control -#fixed link with python libraries -sed -i "s/libpython3.5 (>= 3.5.0~b1)/libpython3-dev/" control -rm $CONTROL && tar zcf $CONTROL * -ar r ../$DEBNAME $CONTROL -cd .. -rm -rf tmp - -} - -pwd -error=0 -mkdir -p packages - -echo "Build for $ARCH_VERSION architectures" -substitute_pkgname_postfix && mkdir -p build && cd build - -echo $error -if [[ $ARCH_VERSION == "arm" ]]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ARM64 - ${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARM64_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARM64_CXX_COMPILER -DCMAKE_TARGET_ARCH="arm64" .. && make && \ - ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * && \ - ${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARM64_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARM64_CXX_COMPILER -DCMAKE_TARGET_ARCH="arm64" -DCMAKE_BUILD_TYPE=Debug ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$? - unset LD_LIBRARY_PATH - - #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ARMHF - #${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARMHF_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARMHF_CXX_COMPILER -DCMAKE_TARGET_ARCH="armhf" .. && make && \ - #${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * && \ - #${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARMHF_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARMHF_CXX_COMPILER -DCMAKE_TARGET_ARCH="armhf" -DCMAKE_BUILD_TYPE=Debug ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$? - #unset LD_LIBRARY_PATH -fi - -if [[ $ARCH_VERSION == "amd64" ]]; then - sed -i 's/#set(BUILD_WITH_PYTHON_ENV ON)/set(BUILD_WITH_PYTHON_ENV ON)/' ../CMakeLists.txt || error=$? - - #sed -i 's/target_link_libraries(${NODE_TARGET} ${NODE_LIBRARIES} pthread )/target_link_libraries(${NODE_TARGET} ${NODE_LIBRARIES} pthread z util expat )/' ../CMakeLists.txt || error=$?cd - ${CMAKE_PATH}cmake ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * \ - && ${CMAKE_PATH}cmake -DCMAKE_BUILD_TYPE=Debug ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$? - sed -ibak 's/#set(BUILD_WITH_GDB_DRIVER_PGSQL ON)/set(BUILD_WITH_GDB_DRIVER_PGSQL ON)/' ../CMakeLists.txt || error=$? - ${CMAKE_PATH}cmake ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * \ - && ${CMAKE_PATH}cmake -DCMAKE_BUILD_TYPE=Debug ../ && make && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$? -fi - -cd .. && rm -r build -[ -e CMakeLists.txtbak ] && mv -f CMakeLists.txtbak CMakeLists.txt - -exit $error \ No newline at end of file diff --git a/oldscripts/linux/debian/scripts/deploy.sh b/oldscripts/linux/debian/scripts/deploy.sh deleted file mode 100755 index 44098c3..0000000 --- a/oldscripts/linux/debian/scripts/deploy.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -echo "Deploying to $PACKAGE_PATH" -echo $wd - -CELLFRAME_REPO_KEY="~/.ssh/demlabs_publish" -PUB_REPO_PORT=34768 -PVT_REPO_PORT=22 -CELLFRAME_PUB_REPO_CREDS="admin@debian.pub.demlabs.net" -CELLFRAME_PUB_CREDS="admin@pub.cellframe.net" -CELLFRAME_PUB_PATH="~/web/pub.cellframe.net/public_html/linux" -CELLFRAME_PVT_CREDS="admin@pvt.demlabs.net" -CELLFRAME_PVT_PATH="~/web/public/cellframe-node" -pwd - -cd packages -PKGFILES=$(ls . | grep .deb) - -[[ -v CI_COMMIT_REF_NAME ]] && [[ $CI_COMMIT_REF_NAME != "master" ]] && SUBDIR="${CI_COMMIT_REF_NAME}" || SUBDIR="" - -#echo "We have $DISTR_CODENAME there" -#echo "On path $REPO_DIR_SRC we have debian files." -for pkgfile in $PKGFILES; do - if [[ $(echo $pkgfile | grep "pgsql") == "" ]]; then - CELLFRAME_FILESERVER_CREDS=$CELLFRAME_PUB_CREDS - CELLFRAME_FILESERVER_PATH=$CELLFRAME_PUB_PATH - CELLFRAME_REPO_CREDS=$CELLFRAME_PUB_REPO_CREDS - REPO_PORT=$PUB_REPO_PORT - else - CELLFRAME_FILESERVER_CREDS=$CELLFRAME_PVT_CREDS - CELLFRAME_FILESERVER_PATH=$CELLFRAME_PVT_PATH - CELLFRAME_REPO_CREDS=$CELLFRAME_PVT_CREDS - REPO_PORT=$PVT_REPO_PORT - fi - pkgname=$(echo $pkgfile | sed 's/.deb$//') - pkgname_public=$(echo $pkgname | cut -d '-' -f1-4,7,8) #cutting away Debian-9.12 - pkgname_weblink="$(echo $pkgname | cut -d '-' -f2,7 )-latest" #leaving only necessary entries - echo "Package name for public is $pkgname_public" - mv $pkgfile $wd/$PACKAGE_PATH/$pkgname.deb || { echo "[ERR] Something went wrong in publishing the package. Now aborting."; exit -4; } - 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/cellframe.*deb/$pkgname_public.deb/" ../prod_build/general/essentials/$pkgname_weblink/index.html - echo "REF_NAME is $CI_COMMIT_REF_NAME" - ssh -i $CELLFRAME_REPO_KEY "$CELLFRAME_FILESERVER_CREDS" "mkdir -p $CELLFRAME_FILESERVER_PATH/$SUBDIR" - echo "added $pkgname.deb how $pkgname_public.deb" - scp -i $CELLFRAME_REPO_KEY $wd/$PACKAGE_PATH/$pkgname.deb "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR/$pkgname_public.deb" - scp -r -i $CELLFRAME_REPO_KEY ../prod_build/general/essentials/$pkgname_weblink "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR/" - if [[ $CI_COMMIT_REF_NAME == "master" && $(echo $pkgname | grep "dbg") == "" ]]; then - scp -P $REPO_PORT -i $CELLFRAME_REPO_KEY $wd/$PACKAGE_PATH/$pkgname.deb "$CELLFRAME_REPO_CREDS:~/aptly/repo_update/$pkgname_public.deb" - ssh -p $REPO_PORT -i $CELLFRAME_REPO_KEY "$CELLFRAME_REPO_CREDS" -- "~/aptly/repo_update.sh" - fi - - rm -r ../prod_build/general/essentials/$pkgname_weblink -done - -cd .. -exit 0 -#symlink name-actual to the latest version. -#build/deb/versions - for all files -#build/deb/${PROJECT}-latest - for symlinks. diff --git a/oldscripts/linux/debian/scripts/install_test.sh b/oldscripts/linux/debian/scripts/install_test.sh deleted file mode 100755 index 21c44cd..0000000 --- a/oldscripts/linux/debian/scripts/install_test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo "stub for installation testing" diff --git a/oldscripts/linux/debian/scripts/pack.sh b/oldscripts/linux/debian/scripts/pack.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/linux/debian/scripts/post-build.sh b/oldscripts/linux/debian/scripts/post-build.sh deleted file mode 100755 index c18d6f6..0000000 --- a/oldscripts/linux/debian/scripts/post-build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -#echo "Stub for post-build actions" -echo "Entering post-build deployment and cleanup" -SCRIPTDIR="prod_build/linux/debian/scripts" - -$SCRIPTDIR/deploy.sh || exit 10 && \ -$SCRIPTDIR/cleanup.sh || exit 11 diff --git a/oldscripts/linux/debian/scripts/pre-build.sh b/oldscripts/linux/debian/scripts/pre-build.sh deleted file mode 100755 index b19e6f0..0000000 --- a/oldscripts/linux/debian/scripts/pre-build.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -#installing required dependencies - -check_packages() { - - IFS=" " - echo "[DBG] PKG_DEPS: $PKG_DEPS" - - local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g') - echo "[DBG] PKG_DEPS: $PKG_DEPPIES" - - for element in "$PKG_DEPPIES"; do - echo "[DEBUGGA] Checking if $element is installed" - if ! dpkg-query -s $element; then - echo "[WRN] Package $element is not installed. Starting installation" - return 1 - fi - done - return 0 - -} - -install_dependencies() { - - if check_packages; then - echo "[INF] All required packages are installed" - else - echo "" - /usr/bin/apt-get update - local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g') - echo "[DEBUGGA] Attempting to install $PKG_DEPPIES" - if /usr/bin/apt-get install -y $PKG_DEPPIES ; then - echo "" - echo "[INF] Packages were installed successfully" - else - echo "[ERR] can\'t install required packages. Please, check your package manager" - echo "Aborting" - exit 1 - fi - fi - return 0 - -} - - -#. prod_build/general/install_dependencies -. prod_build/general/pre-build.sh #VERSIONS and git -export_variables "prod_build/general/conf/*" -export_variables "prod_build/linux/debian/conf/*" - -#install_dependencies - -VERSION_STRING=$(echo $VERSION_FORMAT | sed "s/\"//g" ) #Removing quotes -VERSION_ENTRIES=$(echo $VERSION_ENTRIES | sed "s/\"//g" ) -extract_version_number -[ -e prod_build/linux/debian/essentials/changelog ] && last_version_string=$(cat prod_build/linux/debian/essentials/changelog | head -n 1 | cut -d '(' -f2 | cut -d ')' -f1) - - - -#if [ -z "$last_version_string"]; then -# echo "Changelog won't be modified" -# exit 1; -#fi - -### ideally, we need to ask whether changelog needs to be updated or not -### is it correct? And if not, we just need to exit from this conditional construction -### not quite. See, there is always a changelog in git. (git log). We need to maintain debian/changelog on projects not built with cmake, -### cause information from this changelog (version) is used to write package metadata. And we had messed up for a long time because of desyncing. -### This is a solution. We modify the changelog only if there are updates and not on build servers. And of course if it's not cmake-based build project. -### let's keep those comments here for a while - -if [[ $ONBUILDSERVER == 0 ]]; then - echo "[WRN] on build platform. Version won't be changed" # okay, so this echo wont be outputted as the condition is not true - -elif [ ! -e debian/changelog ]; then ### I guess this what's supposed to be added in order to solve the issue with the changelog?+ - echo "[INF] Debian changelog does not exist. Nothing to be done there." #I supposed it should look somehow like that. -#makes sense -elif [ "$last_version_string" == "$VERSION_STRING" ]; then - echo "[INF] Version $last_version_string is equal to $VERSION_STRING. Nothing to change" -else - echo "[INF] editing the changelog" - text=$(extract_gitlog_text) - IFS=$'\n' - for textline in $text; do - dch -v $VERSION_STRING $textline - done - branch=$(git branch | grep "*" | cut -c 3- ) - case branch in - "master" ) branch="stable";; - "develop" ) branch="testing";; - esac - dch -r --distribution "$branch" --force-distribution ignored - controlfile_version=$(cat prod_build/linux/debian/essentials/control | grep "Standards" | cut -d ' ' -f2) #Add to control info. - sed -i "s/$controlfile_version/$VERSION_STRING/" prod_build/linux/debian/essentials/control - export UPDVER=1 -fi - -exit 0 - -## Maybe we do have the version required? Then we don't need to build it again. CHECK IT THERE! diff --git a/oldscripts/linux/debian/scripts/publish_remote/reprepro.sh b/oldscripts/linux/debian/scripts/publish_remote/reprepro.sh deleted file mode 100644 index ad618a0..0000000 --- a/oldscripts/linux/debian/scripts/publish_remote/reprepro.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -x -DISTR_COMPONENT=$1 -DISTR_CODENAME=$2 -PKGNAME=$3 -PATH=$4 - -workdir=$(pwd) -error=0 -cd $PATH -ls /usr/bin | grep "reprepro" -/usr/bin/reprepro -C "$DISTR_COMPONENT" --ask-passphrase includedeb "$DISTR_CODENAME" "$PKGNAME" && /usr/bin/reprepro export "$DISTR_CODENAME" || error=$? -cd $workdir -exit $error -set +x diff --git a/oldscripts/linux/debian/scripts/test.sh b/oldscripts/linux/debian/scripts/test.sh deleted file mode 100755 index 2b1c7f0..0000000 --- a/oldscripts/linux/debian/scripts/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo "Stub for functionality testing" - diff --git a/oldscripts/linux/ubuntu/conf/dependencies b/oldscripts/linux/ubuntu/conf/dependencies deleted file mode 100644 index f279d9b..0000000 --- a/oldscripts/linux/ubuntu/conf/dependencies +++ /dev/null @@ -1 +0,0 @@ -PKG_DEPS="cmake libsqlite3-dev libmagic-dev libcurl4-gnutls-dev traceroute libz-dev" diff --git a/oldscripts/linux/ubuntu/conf/publish b/oldscripts/linux/ubuntu/conf/publish deleted file mode 100644 index b5df2d7..0000000 --- a/oldscripts/linux/ubuntu/conf/publish +++ /dev/null @@ -1,5 +0,0 @@ -PACKAGE_PATH=/home/gitlab-runner/production-docker/builds/deb/ -REPO_DIR_SRC=/var/tmp/repository -REPO_ADDR=debian.pub.demlabs.net -REPO_DIR=/var/www/html/debian.pub.demlabs.net -DISTR_COMPONENT=main diff --git a/oldscripts/linux/ubuntu/essentials b/oldscripts/linux/ubuntu/essentials deleted file mode 120000 index ff903c9..0000000 --- a/oldscripts/linux/ubuntu/essentials +++ /dev/null @@ -1 +0,0 @@ -../debian/essentials \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/build.sh b/oldscripts/linux/ubuntu/scripts/build.sh deleted file mode 120000 index 53fcd46..0000000 --- a/oldscripts/linux/ubuntu/scripts/build.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/build.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/chroot b/oldscripts/linux/ubuntu/scripts/chroot deleted file mode 120000 index 688a8bf..0000000 --- a/oldscripts/linux/ubuntu/scripts/chroot +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/chroot \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/cleanup.sh b/oldscripts/linux/ubuntu/scripts/cleanup.sh deleted file mode 120000 index 93a84bf..0000000 --- a/oldscripts/linux/ubuntu/scripts/cleanup.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/cleanup.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/compile_and_pack.sh b/oldscripts/linux/ubuntu/scripts/compile_and_pack.sh deleted file mode 120000 index ef456c3..0000000 --- a/oldscripts/linux/ubuntu/scripts/compile_and_pack.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/compile_and_pack.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/deploy.sh b/oldscripts/linux/ubuntu/scripts/deploy.sh deleted file mode 120000 index bbb85a1..0000000 --- a/oldscripts/linux/ubuntu/scripts/deploy.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/deploy.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/install_test.sh b/oldscripts/linux/ubuntu/scripts/install_test.sh deleted file mode 120000 index 7018847..0000000 --- a/oldscripts/linux/ubuntu/scripts/install_test.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/install_test.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/pack.sh b/oldscripts/linux/ubuntu/scripts/pack.sh deleted file mode 120000 index 92454e5..0000000 --- a/oldscripts/linux/ubuntu/scripts/pack.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/pack.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/post-build.sh b/oldscripts/linux/ubuntu/scripts/post-build.sh deleted file mode 120000 index bd51497..0000000 --- a/oldscripts/linux/ubuntu/scripts/post-build.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/post-build.sh \ No newline at end of file diff --git a/oldscripts/linux/ubuntu/scripts/pre-build.sh b/oldscripts/linux/ubuntu/scripts/pre-build.sh deleted file mode 100755 index 6594d92..0000000 --- a/oldscripts/linux/ubuntu/scripts/pre-build.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - -#export_variables() { - -#IFS=$'\n' -#for variable in $(cat prod_build/linux/ubuntu/conf/*); do -# echo "$variable" -# export $(echo "$variable" | sed 's/\"//g') -#done - -#} - - -#installing required dependencies - -check_packages() { - - IFS=" " - local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g') - for element in "$PKG_DEPPIES"; do - echo "[DEBUGGA] Checking if $element is installed" - if ! dpkg-query -s $element; then - echo "[WRN] Package $element is not installed. Starting installation" - return 1 - fi - done - return 0 - -} - -install_dependencies() { - - if check_packages; then - echo "[INF] All required packages are installed" - else - echo "" - local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g') - echo "[DEBUGGA] Attempting to install $PKG_DEPPIES" - if /usr/bin/apt-get install -y $PKG_DEPPIES ; then - echo "" - echo "[INF] Packages were installed successfully" - else - echo "[ERR] can\'t install required packages. Please, check your package manager" - echo "Aborting" - exit 1 - fi - fi - return 0 - -} - -#extract_version_number() { - -#IFS=" " -#for entry in $VERSION_ENTRIES; do -# VERSION_STRING=$(echo $VERSION_STRING | sed "s/$entry/$( cat $VERSION_FILE | grep $entry | sed 's/ //g' | cut -d '=' -f2 )/") #Replacing templates with numbers -#done -#echo -e "project version is $VERSION_STRING" -# -#} - -#extract_gitlog_text() { -# -#borders=$( git log | grep -n 'commit\|Date' | head -n 3 | tail -n 2 | cut -d ':' -f1) -#upb=$(echo $borders | cut -d $'\n' -f1) -#dwnb=$(echo $borders | cut -d $'\n' -f2) -#text=$(git log | head -n $( expr $dwnb - 2 ) | tail -n $( expr $dwnb - $upb - 3 ) ) -#echo $text -# -#} - - -#. prod_build/general/install_dependencies -. prod_build/general/pre-build.sh #VERSIONS and git -export_variables "prod_build/general/conf/*" -export_variables "prod_build/linux/ubuntu/conf/*" - -install_dependencies - - -VERSION_STRING=$(echo $VERSION_FORMAT | sed "s/\"//g" ) #Removing quotes -VERSION_ENTRIES=$(echo $VERSION_ENTRIES | sed "s/\"//g" ) -extract_version_number -[ -e prod_build/linux/ubuntu/essentials/changelog ] && last_version_string=$(cat prod_build/linux/ubuntu/essentials/changelog | head -n 1 | cut -d '(' -f2 | cut -d ')' -f1) - - - -#if [ -z "$last_version_string"]; then -# echo "Changelog won't be modified" -# exit 1; -#fi - -### ideally, we need to ask whether changelog needs to be updated or not -### is it correct? And if not, we just need to exit from this conditional construction -### not quite. See, there is always a changelog in git. (git log). We need to maintain ubuntu/changelog on projects not built with cmake, -### cause information from this changelog (version) is used to write package metadata. And we had messed up for a long time because of desyncing. -### This is a solution. We modify the changelog only if there are updates and not on build servers. And of course if it's not cmake-based build project. -### let's keep those comments here for a while -NOTONBUILDSERVER=0 -gitlab-runner -v 2&>>/dev/null || NOTONBUILDSERVER=$? -if [ $NOTONBUILDSERVER == 0 ]; then - echo "[WRN] on build platform. Version won't be changed" # okay, so this echo wont be outputted as the condition is not true - -elif [ ! -e ubuntu/changelog ]; then ### I guess this what's supposed to be added in order to solve the issue with the changelog?+ - echo "[INF] Ubuntu changelog does not exist. Nothing to be done there." #I supposed it should look somehow like that. -#makes sense -elif [ "$last_version_string" == "$VERSION_STRING" ]; then - echo "[INF] Version $last_version_string is equal to $VERSION_STRING. Nothing to change" -else - echo "[INF] editing the changelog" - text=$(extract_gitlog_text) - IFS=$'\n' - for textline in $text; do - dch -v $VERSION_STRING $textline - done - branch=$(git branch | grep "*" | cut -c 3- ) - case branch in - "master" ) branch="stable";; - "develop" ) branch="testing";; - esac - dch -r --distribution "$branch" --force-distribution ignored - controlfile_version=$(cat prod_build/linux/ubuntu/essentials/control | grep "Standards" | cut -d ' ' -f2) #Add to control info. - sed -i "s/$controlfile_version/$VERSION_STRING/" prod_build/linux/ubuntu/essentials/control - export UPDVER=1 -fi - -IFS=" " -CHROOT_PREFIX=$1 -for distr in $HOST_DISTR_VERSIONS; do #we need to install required dependencies under schroot. - for arch in $HOST_ARCH_VERSIONS; do - echo "$CHROOT_PREFIX-$distr-$arch" - schroot -c $CHROOT_PREFIX-$distr-$arch -- prod_build/linux/ubuntu/scripts/chroot/pre-build.sh "$PKG_DEPS" || errcode=$? - [[ $errcode != 0 ]] && echo "Problems with $CHROOT_PREFIX-$distr-$arch occured. You had installed it, right?" - done -done -exit 0 - -## Maybe we do have the version required? Then we don't need to build it again. CHECK IT THERE! diff --git a/oldscripts/linux/ubuntu/scripts/test.sh b/oldscripts/linux/ubuntu/scripts/test.sh deleted file mode 120000 index ebcc2fa..0000000 --- a/oldscripts/linux/ubuntu/scripts/test.sh +++ /dev/null @@ -1 +0,0 @@ -../../debian/scripts/test.sh \ No newline at end of file diff --git a/oldscripts/mac/scripts/compile.sh b/oldscripts/mac/scripts/compile.sh deleted file mode 100755 index 3ce85ac..0000000 --- a/oldscripts/mac/scripts/compile.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -wd=$1 - -echo "[INF] Building cellframe-node" -cd $wd - -mkdir build -cd build && - "$CROSS_COMPILE"cmake .. -DMACOS_ARCH="x86_64" \ -&& make -j$(nproc) || exit $? - -exit 0 diff --git a/oldscripts/mac/scripts/deploy.sh b/oldscripts/mac/scripts/deploy.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/mac/scripts/pack.sh b/oldscripts/mac/scripts/pack.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/mac/scripts/pre-build.sh b/oldscripts/mac/scripts/pre-build.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/mac/scripts/test.sh b/oldscripts/mac/scripts/test.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/windows/conf/win_libs b/oldscripts/windows/conf/win_libs deleted file mode 100644 index 7b48df0..0000000 --- a/oldscripts/windows/conf/win_libs +++ /dev/null @@ -1 +0,0 @@ -LIBS="KERNEL32 USER32 SHELL32 WINMM GDI32 ADVAPI32 Ole32 Version Imm32 OleAut32 Shlwapi Bcrypt Crypt32 Secur32" diff --git a/oldscripts/windows/scripts/compile.bat b/oldscripts/windows/scripts/compile.bat deleted file mode 100644 index 476cd37..0000000 --- a/oldscripts/windows/scripts/compile.bat +++ /dev/null @@ -1,5 +0,0 @@ -IF not exist %1 ( - mkdir %1 -) -cmake -S %2 -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=Release -D CMAKE_RUNTIME_OUTPUT_DIRECTORY=%1 -mingw32-make diff --git a/oldscripts/windows/scripts/compile.sh b/oldscripts/windows/scripts/compile.sh deleted file mode 100755 index 5b573a0..0000000 --- a/oldscripts/windows/scripts/compile.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -DESTDIR=$1 -wd=$2 - -echo "[INF] Building cellframe-node" -cd $wd - -. prod_build/general/pre-build.sh - -export_variables "./prod_build/windows/conf/*" - -IFS=" " -for lib in $LIBS; do - new_lib=$(echo "$lib" | tr '[:upper:]' '[:lower:]') - echo "changing $lib to $new_lib" - sed -i "s/$lib/$new_lib/g" CMakeLists.txt - sed -i "s/$lib/$new_lib/g" cellframe-sdk/CMakeLists.txt - sed -i "s/$lib/$new_lib/g" cellframe-sdk/dap-sdk/net/server/enc_server/CMakeLists.txt - sed -i "s/$lib/$new_lib/g" cellframe-sdk/dap-sdk/net/server/http_server/CMakeLists.txt - sed -i "s/$lib/$new_lib/g" python-cellframe/cellframe-sdk/CMakeLists.txt - sed -i "s/$lib/$new_lib/g" python-cellframe/cellframe-sdk/dap-sdk/net/server/enc_server/CMakeLists.txt - sed -i "s/$lib/$new_lib/g" python-cellframe/cellframe-sdk/dap-sdk/net/server/http_server/CMakeLists.txt -done - -mkdir build && cd build && \ -x86_64-w64-mingw32.static-cmake .. && make -j$(nproc) && \ -mv cellframe-node*.exe $DESTDIR && make clean && cd .. && rm -r build || echo "error $?" && exit $? diff --git a/oldscripts/windows/scripts/deploy.sh b/oldscripts/windows/scripts/deploy.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/windows/scripts/pack.sh b/oldscripts/windows/scripts/pack.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/windows/scripts/pre-build.sh b/oldscripts/windows/scripts/pre-build.sh deleted file mode 100755 index e69de29..0000000 diff --git a/oldscripts/windows/scripts/test.sh b/oldscripts/windows/scripts/test.sh deleted file mode 100755 index e69de29..0000000 diff --git a/pack.sh b/pack.sh index 1f2a337..f57ac55 100755 --- a/pack.sh +++ b/pack.sh @@ -1,12 +1,23 @@ #!/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}/../ diff --git a/packaging/linux.sh b/packaging/linux.sh index e64aaf2..8a65412 100755 --- a/packaging/linux.sh +++ b/packaging/linux.sh @@ -2,12 +2,22 @@ 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" FILL_VERSION() @@ -37,4 +47,4 @@ PACK() cd $BUILD_DIR cpack ./ cp *.deb ${OUT_DIR} -} \ No newline at end of file +} diff --git a/packaging/osx.sh b/packaging/osx.sh index 85b8fd8..3ef622c 100644 --- a/packaging/osx.sh +++ b/packaging/osx.sh @@ -2,12 +2,23 @@ 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" + PKG_SIGN_POSSIBLE=1 @@ -69,13 +80,13 @@ PACK() cp -r ${DIST_DIR}/Users/$(whoami)/Applications/Cellframe.app ${PACKAGE_DIR}/CellframeNode.app #copy pkginstall - cp ${HERE}/../os/macos/PKGINSTALL/* ${PACKAGE_DIR} + cp ${HERE}/../../os/macos/PKGINSTALL/* ${PACKAGE_DIR} echo "Do packaging magic in [$PACKAGE_DIR]" cd $wd #get version info - source "${HERE}/../version.mk" + source "${HERE}/../../version.mk" PACKAGE_NAME="cellframe-node_${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_amd64.pkg" PACKAGE_NAME_SIGNED="cellframe-node_${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_amd64-signed.pkg" echo "Building package [$PACKAGE_NAME]" diff --git a/targets/linux.sh b/targets/linux.sh index 13bc4ad..aa1560b 100644 --- a/targets/linux.sh +++ b/targets/linux.sh @@ -2,17 +2,26 @@ 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" CMAKE=(cmake) MAKE=(make) echo "Linux target" echo "CMAKE=${CMAKE[@]}" -echo "MAKE=${MAKE[@]}" \ No newline at end of file +echo "MAKE=${MAKE[@]}" diff --git a/targets/osx.sh b/targets/osx.sh index 328b076..067a001 100644 --- a/targets/osx.sh +++ b/targets/osx.sh @@ -5,12 +5,23 @@ 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" + if [ -z "$OSXCROSS_QT_ROOT" ] @@ -41,4 +52,4 @@ MAKE=(make) echo "OSXcross target" echo "CMAKE=${CMAKE[@]}" -echo "MAKE=${MAKE[@]}" \ No newline at end of file +echo "MAKE=${MAKE[@]}" diff --git a/targets/windows.sh b/targets/windows.sh index 2bd3129..d5e5c1a 100644 --- a/targets/windows.sh +++ b/targets/windows.sh @@ -5,28 +5,52 @@ 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" -if [ -z "$MXE_ROOT" ] +if [ -z "$MSYSTEM_PREFIX" ] then - echo "Please, export MXE_ROOT variable, pointing to MXE environment root (we will use qt, make shure it was built)" - echo "To build mxe, go to https://github.com/mxe/mxe, clone it, and do \"make qt5\" within it. Install dependencies if it says so." - exit 255 -fi + echo "Not MSYS2 env, try MXE" + if [ -z "$MXE_ROOT" ] + then + echo "Please, export MXE_ROOT variable, pointing to MXE environment root (we will use qt, make shure it was built)" + echo "To build mxe, go to https://github.com/mxe/mxe, clone it, and do \"make qt5\" within it. Install dependencies if it says so." + exit 255 + else + #cmake command + #mxe install prefix if configured by mxe, need to change it + CMAKE=(${MXE_ROOT}/usr/bin/x86_64-w64-mingw32.static-cmake ) + export PATH=${MXE_ROOT}/usr/bin:$PATH + #everything else can be done by default make + MAKE=(make) -#cmake command -#mxe install prefix if configured by mxe, need to change it -CMAKE=(${MXE_ROOT}/usr/bin/x86_64-w64-mingw32.static-cmake ) -export PATH=${MXE_ROOT}/usr/bin:$PATH -#everything else can be done by default make -MAKE=(make) + echo "Windows target" + echo "CMAKE=${CMAKE[@]}" + echo "MAKE=${MAKE[@]}" + fi +else + #cmake command + #mxe install prefix if configured by mxe, need to change it + CMAKE=(cmake -G "MSYS Makefiles") + MAKE=(make) + + echo "Windows target" + echo "CMAKE=${CMAKE[@]}" + echo "MAKE=${MAKE[@]}" +fi -echo "Windows target" -echo "CMAKE=${CMAKE[@]}" -echo "MAKE=${MAKE[@]}" diff --git a/validate.sh b/validate.sh index de0e788..b5221d4 100644 --- a/validate.sh +++ b/validate.sh @@ -1,12 +1,24 @@ #!/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" + + containsElement () { local e match="$1" -- GitLab