Skip to content
Snippets Groups Projects
Commit f334fe60 authored by Aleksandr Vodianov's avatar Aleksandr Vodianov
Browse files

add scripts for mac && windows

parent 080112e9
No related branches found
No related tags found
2 merge requests!13Hotfix update submodule,!9Support 4917
Showing
with 383 additions and 9 deletions
......@@ -62,14 +62,7 @@ for platform in $PLATFORMS; do
if [[ $platform == "mac" ]]; then
if [[ $(uname -a | cut -d ' ' -f1) == "Linux" ]]; then
prod_build/$platform/scripts/$JOB-remote.sh || { errcode=$? && errstring="$errstring macremote $errcode" && echo "[ERR] Mac remote build errcode $errcode now. Skipping"; continue; } #Just some remote calls to compile and place.
for conffile in $(find "./prod_build/$platform/conf" | grep conf/ | grep -v .bak); do
export_variables $conffile
done
elif [[ $(uname -a | cut -d ' ' -f1) == "Darwin" ]]; then
[[ $(uname -a | cut -d ' ' -f1) == "Darwin" ]]; 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
......@@ -81,7 +74,7 @@ for platform in $PLATFORMS; do
PKG_TYPE=$(echo $PKG_FORMAT | cut -d ' ' -f1)
prod_build/$platform/scripts/$JOB.sh $PKG_TYPE || { errcode=$? && errstring="$errstring macbuild $errcode" && echo "[ERR] Mac host build errcode $errcode now. Skipping"; exit $errcode; }
exit 0
fi
else
......
APP_PATH=CellframeDashboardGUI/CellframeDashboard.app
BUILD_PATH=build/CellframeDashboard/ROOT
APP_NAME=CellframeDashboard
APP_SERVICE_NAME=CellframeDashboardService
PKGSCRIPT_PATH=prod_build/mac/essentials/CellframeDashboard-pkginstall
#!/bin/bash
set -x
sudo xattr -rd com.apple.quarantine /Applications/CellframeDashboard.app
sudo killall -HUP mDNSResponder
SERVICE=com.demlabs.CellframeDashboardService.plist
echo $SERVICE
sudo launchctl stop $SERVICE
sudo launchctl unload -w /Library/LaunchDaemons/$SERVICE
sudo ln -sf /Applications/CellframeDashboard.app/Contents/Resources/$SERVICE /Library/LaunchDaemons/$SERVICE
sudo chown root /Library/LaunchDaemons/$SERVICE
sudo chmod 600 /Library/LaunchDaemons/$SERVICE
sudo launchctl load -w /Library/LaunchDaemons/$SERVICE
[ ! -e /Library/LaunchDaemons/cleanup ] && sudo cp -r /Applications/CellframeDashboard.app/Contents/resources/cleanup /Library/LaunchDaemons/
sudo chown -R root:wheel /Library/LaunchDaemons/cleanup
sudo ln -sf /Library/LaunchDaemons/cleanup/com.demlabs.cleanup.plist /Library/LaunchDaemons/com.demlabs.cleanup.plist
sudo chmod 600 /Library/LaunchDaemons/com.demlabs.cleanup.plist
sudo launchctl load -w /Library/LaunchDaemons/com.demlabs.cleanup.plist
sudo chmod 500 /Library/LaunchDaemons/cleanup/cleanup.sh
#sudo mkdir -p /Users/.DapVPN
#touch /Users/.DapVPN/dap_brands
#sudo cp -f /Applications/DiveVPN.app/Contents/Resources/*.sh /Users/.DapVPN/
#sudo chown root /Users/.DapVPN/*.sh
#sudo chmod 500 /Users/.DapVPN/*.sh
#sudo cp -f /Applications/DiveVPN.app/Contents/Resources/com.demlabs.DiveVPN-watchdog.plist /Library/LaunchDaemons
#sudo chown root /Library/LaunchDaemons/com.demlabs.DiveVPN-watchdog.plist
#sudo chmod 600 /Library/LaunchDaemons/com.demlabs.DiveVPN-watchdog.plist
#sudo launchctl load -w /Library/LaunchDaemons/com.demlabs.DiveVPN-watchdog.plist #It is self-deleting thing
sudo launchctl start $SERVICE
#sudo launchctl start -w com.demlabs.DiveVPN-watchdog.plist
set +x
#!/bin/bash
echo "Installing time!" >> /tmp/debug_vpn.txt
BRAND=CellframeDashboard
RET=0
echo "Installation logs" > /tmp/CellframeDashboard_Install_Logs.txt
echo "Gui_check" >> /tmp/debug_dashboard.txt
if pgrep -x "CellframeDashboard" > /dev/null
then
echo "Gui is Running" >> /tmp/CellframeDashboard_Install_Logs.txt
./cmdAlert.app/Contents/MacOS/cmdAlert
RET=$?
else
echo "Gui Stopped" >> /tmp/CellframeDashboard_Install_Logs.txt
fi
echo "RET from asking user = $RET" >> /tmp/CellframeDashboard_Install_Logs.txt
if [ "$RET" -eq "0" ]; then
echo "Continue install" >> /tmp/CellframeDashboard_Install_Logs.txt
elif [ "$RET" -eq "1" ]; then
echo "Stop install" >> /tmp/CellframeDashboard_Install_Logs.txt
exit 1
fi
#### Kill all opened CellframeDashboard gui clients
GuiPIDs=$(pgrep -x "CellframeDashboard")
while read -r GuiPID; do
echo "... $GuiPID ..." >> /tmp/CellframeDashboard_Install_Logs.txt
if [ "$GuiPID" != "" ]; then
echo "CellframeDashboard is set! Kill It!!!" >> /tmp/CellframeDashboard_Install_Logs.txt
sudo kill $GuiPID
fi
done <<< "$GuiPIDs"
echo "unloading the weirdo deps" >> /tmp/debug_dashboard.txt
[ -e /Library/LaunchDaemons/com.demlabs.${BRAND}Service.plist ] && sudo launchctl unload -w /Library/LaunchDaemons/com.demlabs.CellframeDashboardService.plist
#sudo rm -fr /Applications/KelVPN.app
#udo rm -fr /Applications/${BRAND}.app
#delete CellframeDashboards from com.apple.dock.plist
echo "path to dock /Users/$USER/Library/Preferences/com.apple.dock.plist" >> /tmp/CellframeDashboard_Install_Logs.txt
dockApps=$(defaults read /Users/$USER/Library/Preferences/com.apple.dock.plist persistent-apps | nl | grep file-label | awk '/CellframeDashboard/ {print NR}')
cnt=1
while read -r app; do
app=$[$app-$cnt]
cnt=$[$cnt+1]
if [ "$app" -ne "-1" ]; then
echo "app in dock exists" >> /tmp/CellframeDashboard_Install_Logs.txt
sudo -u $USER /usr/libexec/PlistBuddy -c "Delete persistent-apps:$app" /Users/$USER/Library/Preferences/com.apple.dock.plist
else
echo "app in dock don't exists" >> /tmp/CellframeDashboard_Install_Logs.txt
fi
done <<< "$dockApps"
osascript -e 'delay 2' -e 'tell Application "Dock"' -e 'quit' -e 'end tell'
osascript -e 'delay 2' -e 'tell Application "Dock"' -e 'quit' -e 'end tell'
exit 0
echo "cleanup done" >> /tmp/debug_dashboard.txt
com.demlabs.DiveVPNService.plist
\ No newline at end of file
#!/bin/bash
wd=$(pwd)
cd /Library/LaunchDaemons
for filename in $(ls .); do
if [ -L $filename ] && [ ! -e $filename ]; then
launchctl unload -w $filename
rm $filename
fi
done
cd $wd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.demlabs.cleanup</string>
<key>ProgramArguments</key>
<array>
<string>/Library/LaunchDaemons/cleanup/cleanup.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>UserName</key>
<string>root</string>
<key>GroupName</key>
<string>wheel</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.demlabs.CellframeDashboardService</string>
<key>Program</key>
<string>/Applications/CellframeDashboard.app/Contents/MacOS/CellframeDashboardService</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>UserName</key>
<string>root</string>
<key>GroupName</key>
<string>wheel</string>
<key>PathState</key>
<dict>
<key>/tmp/CellframeDashboardService</key>
<true/>
</dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>DapPacketTunnelProvider</string>
</dict>
</dict>
</plist>
#!/bin/bash
echo "Deploying the mac app"
pwd
$QT_MAC_PATH/macdeployqt DapChainVpnGui/$brand.app -verbose=3 -alaways-overwrite
#!/bin/bash
#if [ -z "$1" ]; then
# echo "[ERR] Script needs argument - package name. Use one of next :"
# for i in `ls configs/build_dmg.pkg/| sed 's/\.cfg//'`; do
# echo " $i"
# done
# exit 1
#fi
./prod_build/mac/scripts/compile.sh $1 || { errcode=$?; echo "[ERR] Mac build errcode $errcode";exit $errcode; }
./prod_build/mac/scripts/addqt.sh $1 || { errcode=$?; echo "[ERR] Mac addqtlibs errcode $errcode";exit $errcode; }
./prod_build/mac/scripts/reloc.sh $1 || { errcode=$?; echo "[ERR] Mac reloc errcode $errcode"; exit $errcode; }
#./prod_build/mac/scripts/sign.sh $1 || exit 6
./prod_build/mac/scripts/pack.sh $1 || { errcode=$?; echo "[ERR] Mac pack errcode $errcode"; exit $errcode; }
#exit 0
#!/bin/bash
echo "packing things"
mkdir -p $wd/$BUILD_PATH
ls $wd
ls $wd/$BUILD_PATH
cp -r $APP_PATH $wd/$BUILD_PATH/
##### -- REMOVE AFTER VARIABLE SCOPE IS RIGHT -- #####
cd $wd/$SRC_PATH
. "$wd/$SRC_PATH/prod_build/general/pre-build.sh"
VERSION_INFO=$(extract_version_number)
cd $wd
##### -- PATCH_END -- #####
pkgbuild --analyze --root $wd/$BUILD_PATH/ $wd/$BUILD_PATH/$APP_NAME.plist
plutil -replace BundleIsRelocatable -bool NO $wd/$BUILD_PATH/$APP_NAME.plist
pkgbuild --install-location /Applications --identifier com.demlabs.$APP_NAME --scripts $wd/$SRC_PATH/$PKGSCRIPT_PATH --component-plist $wd/$BUILD_PATH/$APP_NAME.plist --root $wd/$BUILD_PATH/ $wd/$BUILD_PATH/$APP_NAME-$VERSION_INFO.pkg
#### For creating dmg
#macdeployqt $APP_PATH -verbose=2 -no-strip -no-plugins -dmg
#if [ -e $BUILD_PATH/SapNetGUI/$APP_NAME.dmg ]; then
# mv -f $BUILD_PATH/SapNetGUI/$APP_NAME.dmg $BUILD_PATH
# echo "[*] Success"
#else
# echo "[ERR] Nothing was build examine build.log for details"
# exit 2
#fi
exit 0
#!/bin/bash
echo "VERSION_INFO"
export -n VERSION_INFO
platform=$1
SCRIPTDIR=prod_build/$platform/scripts/
errcode=0
$SCRIPTDIR/deploy.sh || { errcode=$?; echo "[ERR] MacOS deployment errcode $errcode"; }
[ -e "prod_build/$platform/conf/PATHS.bak" ] && mv -v prod_build/$platform/conf/PATHS.bak prod_build/$platform/conf/PATHS
exit $errcode
#!/bin/bash
#set up config
echo "[*] Pack with $DEPLOY_OPTS"
macdeployqt $APP_PATH $DEPLOY_OPTS
#find $BUILD_PATH_FRAMEWORKS/GStreamer.framework -path *.a -exec rm -rf {} \;
#find $BUILD_PATH_FRAMEWORKS/GStreamer.framework -path *.la -exec rm -rf {} \;
#fdupes -r -dN $BUILD_PATH_FRAMEWORKS/GStreamer.framework/
exit 0
#!/bin/bash
WORKDIR="resources/cellframe/cellframe-dashboard"
export PLATFORM="$2"
export BRAND="$3"
shift 3
SCRIPTDIR="prod_build/$PLATFORM/scripts"
for var in $@; do
export ${var//\"/} #export variables without quotes
done
pwd
#cd $WORKDIR
$SCRIPTDIR/compile_and_pack.sh || { echo "[ERR] $PLATFORM compile_and_pack failed"; exit 12; } # && \
# $SCRIPTDIR/test.sh || { echo "[ERR] $PLATFORM test failed"; exit 13; } && \
# $SCRIPTDIR/install_test.sh || { echo "[ERR] $PLATFORM install_test failed"; exit 14; } && \
# $SCRIPTDIR/cleanup.sh || { echo "[ERR] $PLATFORM cleanup failed"; exit 15; }
#cd $wd
#!/bin/bash
WINDOWS_TOOLCHAIN=$WINDOWS_TOOLCHAIN_PATH/usr/bin
WINDOWS_CROSS_QT=$WINDOWS_TOOLCHAIN_PATH/usr/x86_64-w64-mingw32.static/qt5/bin
export PATH=$WINDOWS_TOOLCHAIN:$PATH
error_explainer() {
case "$1" in
"0" ) echo "";;
"1" ) echo "Error in pre-config happened. Please, review logs";;
"2" ) echo "Error in compilation happened. Please, review logs";;
* ) echo "Unhandled error $1 happened. Please, review logs";;
esac
}
cleanup() {
make distclean
if [ "$1" == "--static" ]; then
export $QT_SELECT="default" #Returning back the shared library link
fi
}
defines() {
[ -e ./build/Nsis.defines.nsh ] && rm ./build/Nsis.defines.nsh
echo "!define APP_NAME \"$1\"" >> ./build/Nsis.defines.nsh
echo "!define APP_VERSION \"$(echo $2 | sed 's/-/\./g').0\"" >> ./build/Nsis.defines.nsh
echo "!define DAP_VER \"$2\"" >> ./build/Nsis.defines.nsh
}
. prod_build/general/conf/version_info
. prod_build/general/pre-build.sh
pack() {
mkdir -p ./build/
rm -r ./build/*
cp ./prod_build/windows/essentials/share/CellFrameDashboard.ico ./build/
#cp -r ./os/windows/drivers ./build/
#cp ./os/windows/build.nsi ./build/
#cp ./os/windows/ssl/libeay32.dll ./build/
#cp ./os/windows/ssl/ssleay32.dll ./build/
VERSION=$(extract_version_number)
defines $1 $VERSION
cp ./CellFrameDashboardService/release/CellFrameDashboardService.exe ./build/
cp ./CellFRameDashboardGUI/release/CellFrameDashboard.exe ./build/
makensis ./build/build.nsi
mv ./build/"$BRAND ${VERSION}.exe" ./build/"${BRAND}-${VERSION}.exe"
}
. prod_build/general/conf/publish
error=0
codename=$(lsb_release -a | grep Codename | cut -f2)
#2DO: add trap command to clean the sources on exit.
trap cleanup SIGINT
cd cellfrmae-node && git checkout master && git pull && git submodule init && git submodule update
mkdir build && cd build
x86_64-w64-mingw32.static-cmake .. && make
$WINDOWS_CROSS_QT/qmake && \
make -j$(nproc) && \
[ -v BRAND ] && echo "Brand = $BRAND" || { echo "No brand defined"; BRAND="CellFrameDashboard"; } && \
# pack $BRAND
# for filepkg in $(ls .. | grep .deb | grep -v $codename | grep -v "dbgsym"); do
# filename=$(echo $filepkg | sed 's/.deb$//')
# [ ! -v QT_LINUX_PATH ] && mv ../$filepkg build/$filename\_$codename.deb || mv ../$filepkg build/$filepkg
# cd build && repack $filename\_$codename.deb $codename && cd ..
# done || error=$?
cleanup
error_explainer $error
exit $error #2DO: Learn how to sign up the package.
#!/bin/bash
echo "Deploying to $PACKAGE_PATH"
echo $wd
CELLFRAME_REPO_KEY="~/.ssh/demlabs_publish"
CELLFRAME_FILESERVER_CREDS="admin@pub.cellframe.net"
CELLFRAME_FILESERVER_PATH="~/web/pub.cellframe.net/public_html/windows"
pwd
cd build
PKGFILES=$(ls . | grep .iso)
[[ -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 iso files."
for pkgfile in $PKGFILES; do
pkgname=$(echo $pkgfile | sed 's/.iso$//')
pkgname_public=$(echo $pkgname | cut -d '-' -f1-4,7-) #cutting away Debian-9.12
#pkgname_weblink="$(echo $pkgname | cut -d '-' -f2,8 )-latest" #leaving only necessary entries
mv $pkgfile $wd/$PACKAGE_PATH/$pkgname$MOD.iso || { 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.*iso/$pkgname_public$MOD.iso/" ../prod_build/general/essentials/$pkgname_weblink/index.php
echo "REF_NAME is $CI_COMMIT_REF_NAME"
ssh -i $CELLFRAME_REPO_KEY "$CELLFRAME_FILESERVER_CREDS" "mkdir -p $CELLFRAME_FILESERVER_PATH/$SUBDIR"
scp -i $CELLFRAME_REPO_KEY $wd/$PACKAGE_PATH/$pkgname$MOD.iso "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR/$pkgname_public$MOD.iso"
#scp -r -i $CELLFRAME_REPO_KEY ../prod_build/general/essentials/$pkgname_weblink "$CELLFRAME_FILESERVER_CREDS:$CELLFRAME_FILESERVER_PATH/$SUBDIR/"
#rm -r ../prod_build/general/essentials/$pkgname_weblink
done
# export -n "UPDVER"
cd ..
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment