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/cellframe-node
  • evseev/cellframe-node
  • dmitry.puzyrkov/cellframe-node
  • MIKA83/cellframe-node
4 results
Show changes
Showing
with 999 additions and 0 deletions
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Node"
include(":app")
#!/bin/bash -e
DAP_APP_NAME="cellframe-node"
DAP_PREFIX="/opt/$DAP_APP_NAME"
# Check profile.d symlink
[ -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
#unconditianly create directories on pkg instllation
echo "[*] Creating run, lib, var dirs...."
mkdir -p $DAP_PREFIX/var/{run,lib/wallet,lib/global_db,var/plugins} || true
if [ -e /.dockerenv ]
then
echo "[ ] No logrotate in docker-container"
else
echo "[!] Enabling logrotate"
chmod 644 $DAP_PREFIX/share/logrotate/$DAP_APP_NAME || true
chmod 644 $DAP_PREFIX/share/logrotate/logrotate.timer || true
systemctl enable $DAP_PREFIX/share/logrotate/logrotate.timer || true
fi
#set permissions
echo "[!] Set exec permissions"
chmod +x $DAP_PREFIX/bin/$DAP_APP_NAME-cli $DAP_PREFIX/python/bin/pip3* $DAP_PREFIX/python/bin/python3* || true
echo "[!] Run cellframe-config for configuration..."
$DAP_PREFIX/bin/cellframe-node-config -i $DAP_PREFIX/share/default.setup
echo "[!] Set cfg permissions"
#set rwo permissions to configs
chmod 666 $(find ${DAP_PREFIX}/etc/ -type f)
#set rwx permissions to dirs
chmod 777 $(find ${DAP_PREFIX}/etc/ -type d)
echo "[!] Setting up cellframe-node as service"
$DAP_PREFIX/bin/cellframe-node-config -e service enable
if [ -e "$DAP_PREFIX/bin/cellframe-diagtool" ]; then
echo "[!] Starting up cellframe-diagtool"
systemctl --system enable $DAP_PREFIX/share/cellframe-diagtool.service || true
systemctl start cellframe-diagtool || true
echo "[!] Starting up cellframe-tray"
if [ -d /run/user/$SUDO_UID ]; then
export XDG_RUNTIME_DIR=/run/user/$SUDO_UID
echo "Use $XDG_RUNTIME_DIR as XDG_RUNTIME_DIR, for tray install"
su $SUDO_USER -c "systemctl --user enable $DAP_PREFIX/share/cellframe-tray.service" || true
su $SUDO_USER -c "systemctl --user start cellframe-tray.service" || true
fi
fi
if [ -e "$DAP_PREFIX/share/cellframe-updater.service" ]; then
echo "[!] Starting up cellframe-updater"
systemctl --system enable $DAP_PREFIX/share/cellframe-updater.service || true
systemctl --system enable $DAP_PREFIX/share/cellframe-updater.timer || true
systemctl start cellframe-updater || true
systemctl start cellframe-updater.timer || true
fi
echo "[!] Starting up cellframe-node"
$DAP_PREFIX/bin/cellframe-node-config -e service start
echo "[!] Done"
#! /bin/bash -e
#!/bin/bash -e
case "$1" in
remove|purge|abort-install|abort-upgrade)
echo "[*] Stopping cellframe-node and services..."
systemctl stop cellframe-node.service || true
systemctl stop cellframe-diagtool.service || true
systemctl stop cellframe-updater.service || true
echo "[*] Disabling cellframe-node and services..."
systemctl disable cellframe-node.service || true
systemctl disable cellframe-diagtool.service || true
systemctl disable cellframe-updater.service || true
if [ -d /run/user/$SUDO_UID ]; then
export XDG_RUNTIME_DIR=/run/user/$SUDO_UID
echo "Use $XDG_RUNTIME_DIR as XDG_RUNTIME_DIR, for tray install"
su $SUDO_USER -c "systemctl --user stop cellframe-tray.service" || true
su $SUDO_USER -c "systemctl --user disable cellframe-tray.service" || true
fi
;;
disappear)
;;
upgrade)
echo "[*] Stopping cellframe-node and services..."
systemctl stop cellframe-node.service || true
systemctl stop cellframe-diagtool.service || true
systemctl stop cellframe-updater.service || true
if [ -d /run/user/$SUDO_UID ]; then
export XDG_RUNTIME_DIR=/run/user/$SUDO_UID
echo "Use $XDG_RUNTIME_DIR as XDG_RUNTIME_DIR, for tray install"
su $SUDO_USER -c "systemctl --user stop cellframe-tray.service" || true
su $SUDO_USER -c "systemctl --user disable cellframe-tray.service" || true
fi
;;
failed-upgrade)
echo "[*] Stopping cellframe-node and services"
systemctl stop cellframe-node.service || true
systemctl stop cellframe-diagtool.service || true
systemctl stop cellframe-updater.service || true
if [ -d /run/user/$SUDO_UID ]; then
export XDG_RUNTIME_DIR=/run/user/$SUDO_UID
echo "Use $XDG_RUNTIME_DIR as XDG_RUNTIME_DIR, for tray install"
su $SUDO_USER -c "systemctl --user stop cellframe-tray.service" || true
su $SUDO_USER -c "systemctl --user disable cellframe-tray.service" || true
fi
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1;;
esac
exit 0
#!/usr/bin/make -f #!/usr/bin/make -f
override_dh_fixperms: override_dh_fixperms:
dh_fixperms -X/opt/kelvin-node dh_fixperms -X/opt/cellframe-node
chmod 777 /opt/cellframe-node/bin/cellframe-node-cli
override_dh_auto_install: override_dh_auto_install:
dh_auto_install -- prefix=/opt/kelvin-node dh_auto_install -- prefix=/opt/cellframe-node
%: %:
# dh $@ --with=systemd # dh $@ --with=systemd
dh $@ dh $@
<?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>CFBundleExecutable</key>
<string>cellframe-node</string>
<key>CFBundleAdditionalExecutables</key>
<array>
<string>cellframe-node-cli</string>
<string>cellframe-node-tool</string>
<string>cellframe-node-config</string>
<string>cellframe-diagtool</string>
</array>
<key>CFBundleGetInfoString</key>
<string>Cellframe Project</string>
<key>CFBundleIdentifier</key>
<string>com.demlabs.CellframeNode</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</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">
<array>
<dict>
<key>BundleHasStrictIdentifier</key>
<true/>
<key>BundleIsRelocatable</key>
<true/>
<key>BundleIsVersionChecked</key>
<true/>
<key>BundleOverwriteAction</key>
<string>upgrade</string>
<key>RootRelativeBundlePath</key>
<string>CellframeNode.app</string>
</dict>
</array>
</plist>
<?xml version="1.0" encoding="utf-8"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.demlabs.CellframeNode" postinstall-action="none" format-version="2" generator-version="InstallCmds-860 (24B83)" install-location="/Applications/" auth="root" version="0" >
<payload numberOfFiles="" installKBytes=""/>
<bundle id="com.demlabs.CellframeNode" path="./CellframeNode.app"/>
<bundle-version>
<bundle id="com.demlabs.CellframeNode"/>
</bundle-version>
<upgrade-bundle>
<bundle id="com.demlabs.CellframeNode"/>
</upgrade-bundle>
<update-bundle/>
<atomic-update-bundle/>
<strict-identifier>
<bundle id="com.demlabs.CellframeNode"/>
</strict-identifier>
<relocate>
<bundle id="com.demlabs.CellframeNode"/>
</relocate>
<scripts>
<preinstall file="./preinstall" timeout="600"/>
<postinstall file="./postinstall" timeout="600"/>
</scripts>
</pkg-info>
\ No newline at end of file
#!/bin/sh
#set -x
INSTALL_BINS="/Applications/CellframeNode.app/Contents/MacOS/"
INSTALL_RES=/Applications/CellframeNode.app/Contents/Resources
USER_RES="/Library/Application Support/CellframeNode"
mkdir -p "${USER_RES}/"
cp -r "${INSTALL_RES}/etc" "${USER_RES}/"
cp -r "${INSTALL_RES}/share" "${USER_RES}/"
mkdir "${USER_RES}/var/run/"
${INSTALL_BINS}/cellframe-node-config -i "${USER_RES}/share/default.setup"
echo "[!] Set cfg permissions"
find "${USER_RES}/" -type d -exec chmod 777 {} \;
find "${USER_RES}/" -type f -exec chmod 666 {} \;
echo "[!] Copy daemon plist"
cp ${INSTALL_RES}/com.demlabs.cellframe-node.plist /Library/LaunchDaemons/
cp ${INSTALL_RES}/com.demlabs.cellframe-diagtool.plist /Library/LaunchDaemons/
${INSTALL_BINS}/cellframe-node-config -e service enable
launchctl load -w /Library/LaunchDaemons/com.demlabs.cellframe-diagtool.plist
#!/bin/sh
echo "preinstall!"
USER_RES="/Library/Application Support/CellframeNode"
INSTALL_RES=/Applications/CellframeNode.app/Contents/Resources
/Applications/CellframeNode.app/Contents/MacOS/cellframe-node-config -e service disable || true
killall cellframe-node cellframe-diagtool
mv_safe() {
local SOURCE_DIR="$1"
local TARGET_DIR="$2"
# Ensure the target directory exists
mkdir -p "$TARGET_DIR"
# Loop through each file in the source directory
for file in "$SOURCE_DIR"/*; do
# Get the base name of the file
base_name=$(basename "$file")
# Set the new file path in the target directory
target_file="$TARGET_DIR/$base_name"
# If the file already exists, rename the file
if [[ -e "$target_file" ]]; then
# Get the file extension (if any)
ext="${base_name##*.}"
name="${base_name%.*}"
# Append a number to the file name to make it unique
counter=1
while [[ -e "$TARGET_DIR/${name}_$counter.${ext}" ]]; do
((counter++))
done
target_file="$TARGET_DIR/${name}_$counter.${ext}"
fi
# Move the file to the target directory
mv "$file" "$target_file"
done
echo "Files moved successfully from $SOURCE_DIR to $TARGET_DIR."
}
mkdir "${USER_RES}/"
mkdir -p "${USER_RES}/var/lib/ca/"
mkdir -p "${USER_RES}/var/lib/wallet/"
mv_safe ${INSTALL_RES}/var/lib/wallet/ "${USER_RES}/var/lib/wallet/"
mv_safe ${INSTALL_RES}/var/lib/ca/ "${USER_RES}/var/lib/ca/"
mv_safe $HOME/Applications/Cellframe.app/Contents/Resources/var/lib/wallet/ "${USER_RES}/var/lib/wallet/"
mv_safe $HOME/Applications/Cellframe.app/Contents/Resources/var/lib/ca/ "${USER_RES}/var/lib/ca/"
\ No newline at end of file
<?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.cellframe-diagtool</string>
<key>Program</key>
<string>/Applications/CellframeNode.app/Contents/MacOS/cellframe-diagtool</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/cellframe-diagtool.log</string>
<key>StandardErrorPath</key>
<string>/tmp/cellframe-diagtool.err</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.cellframe-node</string>
<key>Program</key>
<string>/Applications/CellframeNode.app/Contents/MacOS/cellframe-node</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
; ***************************************************************
; * Authors:
; * Dmitry Puzyrkov <dmitry.puzrykov@demlabs.net>
; * DeM Labs Inc. https://demlabs.net
; * Cellframe Project https://gitlab.demlabs.net/cellframe
; * Copyright (c) 2024
; * All rights reserved.
; ***************************************************************
!define MULTIUSER_EXECUTIONLEVEL Admin
!include "MUI2.nsh"
!include "x64.nsh"
!include nsDialogs.nsh
!include LogicLib.nsh
!include MUI2.nsh
!include "WordFunc.nsh"
!define StrTrimNewLines "!insertmacro StrTrimNewLines Init ''"
!define UnStrTrimNewLines "!insertmacro StrTrimNewLines Init Un"
!macro StrTrimNewLines OutVar String
!verbose push
!verbose 3
!if "${OutVar}" == "Init"
!undef ${String}StrTrimNewLines
!define ${String}StrTrimNewLines "!insertmacro StrTrimNewLines "
!if "${String}" != ""
Function un.StrTrimNewLines
!else
Function StrTrimNewLines
!endif
!insertmacro StrTrimNewLines Func ''
FunctionEnd
!else if "${OutVar}" == "Func"
Exch $0
Push $1
n: StrCpy $1 $0 1 -1
StrCmp $1 '$\r' +2
StrCmp $1 '$\n' +1 e
StrCpy $0 $0 -1
Goto n
e: Pop $1
Exch $0
!else
Push "${String}"
!ifdef __UNINSTALL__
Call un.StrTrimNewLines
!else
Call StrTrimNewLines
!endif
Pop "${OutVar}"
!endif
!verbose pop
!macroend
Unicode true
!define APP_NAME "cellframe-node"
!define NODE_NAME "cellframe-node"
!define EXE_NAME "${APP_NAME}.exe"
!define PUBLISHER "Cellframe Network"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define ICON "cellframe.ico"
!define BANNER "cellframe.bmp"
!define MUI_ICON "${ICON}"
!define MUI_UNICON "${ICON}"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${BANNER}"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${BANNER}"
Name "${APP_NAME}"
OutFile "${APP_NAME}-${APP_VERSION_VISUAL}-installer.exe"
BrandingText "${APP_NAME} by ${PUBLISHER}"
Var CommonDocuments
Var ConfigPath
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "CompanyName" "${PUBLISHER}"
VIAddVersionKey "LegalCopyright" "${PUBLISHER} 2024"
VIAddVersionKey "FileDescription" "Cellframe Node Installer"
VIAddVersionKey "FileVersion" "${APP_VERSION}"
VIAddVersionKey "ProductVersion" "${APP_VERSION}"
VIProductVersion "${APP_VERSION}.0"
Function .onInit
${If} ${RunningX64}
${EnableX64FSRedirection}
SetRegView 64
${else}
MessageBox MB_OK "${APP_NAME} supports x64 architectures only"
Abort
${EndIf}
ReadRegStr $CommonDocuments HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common Documents"
StrCpy $ConfigPath "$CommonDocuments\${NODE_NAME}"
FunctionEnd
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Page custom pgNetSelectCreate pgNetSelectLeave
!define MUI_FINISHPAGE_RUN "$INSTDIR\cellframe-node.exe"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Russian"
Function createRuntimePaths
CreateDirectory "$ConfigPath\var\lib\global_db"
CreateDirectory "$ConfigPath\var\lib\wallet"
CreateDirectory "$ConfigPath\var\lib\ca"
FunctionEnd
InstallDir "$PROGRAMFILES64\${APP_NAME}"
!define PRODUCT_NAME "${APP_NAME}"
!define PRODUCT_VERSION "${APP_VERSION}"
!define PRODUCT_FULLNAME "${APP_NAME} ${APP_VERSION}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_FULLNAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_UNINSTALL_EXE "uninstall.exe"
Var NetworksDialog
Var NetBackboneCb
Var NetKelVPNCb
Var NetRiemannCb
Var NetRaidenCb
Var NetBackboneState
Var NetKelVPNState
Var NetRiemannState
Var NetRaidenState
${StrTrimNewLines}
Function getNetworksStates
nsExec::ExecToStack /OEM "$INSTDIR\${NODE_NAME}-config.exe -e network Backbone check"
Pop $0 ; Exit code / error
Pop $1 ; stdout output
${WordFind} $1 " " "-01" $NetBackboneState
${StrTrimNewLines} $NetBackboneState $NetBackboneState
nsExec::ExecToStack /OEM "$INSTDIR\${NODE_NAME}-config.exe -e network KelVPN check"
Pop $0 ; Exit code / error
Pop $1 ; stdout output
${WordFind} $1 " " "-01" $NetKelVPNState
${StrTrimNewLines} $NetKelVPNState $NetKelVPNState
nsExec::ExecToStack /OEM "$INSTDIR\${NODE_NAME}-config.exe -e network riemann check"
Pop $0 ; Exit code / error
Pop $1 ; stdout output
${WordFind} $1 " " "-01" $NetRiemannState
${StrTrimNewLines} $NetRiemannState $NetRiemannState
nsExec::ExecToStack /OEM "$INSTDIR\${NODE_NAME}-config.exe -e network raiden check"
Pop $0 ; Exit code / error
Pop $1 ; stdout output
${WordFind} $1 " " "-01" $NetRaidenState
${StrTrimNewLines} $NetRaidenState $NetRaidenState
FunctionEnd
${UnStrTrimNewLines}
Section "${APP_NAME}" CORE
SectionIn RO
SetOutPath "$INSTDIR"
nsExec::ExecToLog /OEM 'taskkill /f /im ${NODE_NAME}.exe'
nsExec::ExecToLog /OEM 'taskkill /f /im cellframe-diagtool.exe'
File /oname=cellframe-node.tmp "opt/cellframe-node/bin/${NODE_NAME}.exe"
File "opt/cellframe-node/bin/${NODE_NAME}-cli.exe"
File "opt/cellframe-node/bin/${NODE_NAME}-tool.exe"
File "opt/cellframe-node/bin/${NODE_NAME}-config.exe"
File "opt/cellframe-node/bin/cellframe-diagtool.exe"
Call createRuntimePaths
InitPluginsDir
SetOutPath "$PLUGINSDIR"
SetOutPath "$ConfigPath\etc"
File /r "opt/cellframe-node/etc/"
SetOutPath "$ConfigPath\share"
File /r "opt/cellframe-node/share/*"
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME} ${APP_VERSION}"
WriteRegStr HKLM "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayVersion" "${APP_VERSION}"
WriteRegStr HKLM "${UNINSTALL_PATH}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${EXE_NAME}"
; Remove "RUNASADMIN" flag for node if it was present
DetailPrint "Try remove runasadmin HKCU"
DeleteRegValue HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\" "$INSTDIR\${NODE_NAME}.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
;${DisableX64FSRedirection}
;nsExec::ExecToLog /OEM 'schtasks /Create /F /RL highest /SC onlogon /TR "$0" /TN "${NODE_NAME}"'
;${EnableX64FSRedirection}
WriteRegStr HKLM "Software\${APP_NAME}" "Path" "$INSTDIR"
WriteRegStr HKLM "Software\${APP_NAME}" "Version" "${APP_VERSION}"
nsExec::ExecToLog /OEM "$INSTDIR\${NODE_NAME}-config.exe -i $ConfigPath\share\default.setup"
nsExec::ExecToLog /OEM "$INSTDIR\${NODE_NAME}-config.exe -e service enable"
; check net states after install to show in checkboxes
Call getNetworksStates
StrCpy $0 "'$INSTDIR\cellframe-diagtool.exe' --tray"
${DisableX64FSRedirection}
nsExec::ExecToLog /OEM 'schtasks /Create /F /RL highest /SC onlogon /TR "$0" /TN "CellframeTray"'
nsExec::ExecToLog /OEM 'schtasks /run /TN CellframeTray"'
${EnableX64FSRedirection}
StrCpy $0 "'$INSTDIR\cellframe-diagtool.exe'"
${DisableX64FSRedirection}
nsExec::ExecToLog /OEM 'schtasks /Create /F /RL highest /SC onlogon /TR "$0" /TN "CellframeDiagtool"'
nsExec::ExecToLog /OEM 'schtasks /run /TN CellframeDiagtool"'
${EnableX64FSRedirection}
SectionEnd
Function checkEnabledNets
${If} $NetBackboneState == "on"
${NSD_Check} $NetBackboneCb
${EndIf}
${If} $NetKelVPNState == "on"
${NSD_Check} $NetKelVPNCb
${EndIf}
${If} $NetRiemannState == "on"
${NSD_Check} $NetRiemannCb
${EndIf}
${If} $NetRaidenState == "on"
${NSD_Check} $NetRaidenCb
${EndIf}
FunctionEnd
Function pgNetSelectCreate
GetDlgItem $R0 $HWNDPARENT 2
ShowWindow $R0 ${SW_HIDE}
!insertmacro MUI_HEADER_TEXT "Network Settings" "Select enabled networks"
nsDialogs::Create 1018
Pop $NetworksDialog
${If} $NetworksDialog == error
Abort
${EndIf}
${NSD_CreateGroupBox} 10% 10u 80% 110u "Networks:"
Pop $0
${NSD_CreateCheckbox} 20% 26u 20% 10u "Backbone"
Pop $NetBackboneCb
${NSD_CreateCheckbox} 20% 40u 20% 10u "KelVPN"
Pop $NetKelVPNCb
${NSD_CreateCheckbox} 20% 54u 20% 10u "Riemann"
Pop $NetRiemannCb
${NSD_CreateCheckbox} 20% 68u 20% 10u "Raiden"
Pop $NetRaidenCb
Call checkEnabledNets
nsDialogs::Show
FunctionEnd
!macro ensureNetworkState netname state
${If} ${state} == 1
nsExec::ExecToStack "$INSTDIR\${NODE_NAME}-config.exe -e network ${netname} ensure on"
${else}
nsExec::ExecToStack "$INSTDIR\${NODE_NAME}-config.exe -e network ${netname} ensure off"
${endif}
!macroend
Function pgNetSelectLeave
${NSD_GetState} $NetBackboneCb $NetBackboneState
${NSD_GetState} $NetKelVPNCb $NetKelVPNState
${NSD_GetState} $NetRiemannCb $NetRiemannState
${NSD_GetState} $NetRaidenCb $NetRaidenState
!insertmacro ensureNetworkState "Backbone" $NetBackboneState
!insertmacro ensureNetworkState "KelVPN" $NetKelVPNState
!insertmacro ensureNetworkState "riemann" $NetRiemannState
!insertmacro ensureNetworkState "raiden" $NetRaidenState
Delete "$INSTDIR\${NODE_NAME}.exe"
Rename "$INSTDIR\cellframe-node.tmp" "$INSTDIR\cellframe-node.exe"
FunctionEnd
Section "Uninstall"
SetRegView 64
nsExec::ExecToLog /OEM "$INSTDIR\${NODE_NAME}-config.exe -e service disable"
nsExec::ExecToLog /OEM "$INSTDIR\${NODE_NAME}-config.exe -e service stop"
nsExec::ExecToLog /OEM 'taskkill /f /im ${NODE_NAME}.exe'
nsExec::ExecToLog /OEM 'taskkill /f /im cellframe-diagtool.exe'
Delete "$INSTDIR\cellframe-diagtool.exe"
Delete "$INSTDIR\${NODE_NAME}.exe"
Delete "$INSTDIR\${NODE_NAME}-tool.exe"
Delete "$INSTDIR\${NODE_NAME}-cli.exe"
Delete "$INSTDIR\${NODE_NAME}-config.exe"
DeleteRegKey HKLM "${UNINSTALL_PATH}"
DeleteRegKey HKLM "Software\${APP_NAME}"
DeleteRegValue HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\" "$INSTDIR\${NODE_NAME}.exe"
Delete "$INSTDIR\Uninstall.exe"
RMDir /R "$INSTDIR"
SectionEnd
Subproject commit 18a73adcaeeafe2c75dc82b71c698ccdbada7116
test_build_dependencies:
deb:
- 'build-essential'
- 'cmake'
- 'libmagic-dev'
- 'libsqlite3-dev'
- 'libjson-c-dev'
- 'libffi-dev'
- 'file'
- 'python3-dev'
- 'curl'
- 'jq'
- 'xsltproc'
- 'libpq-dev'
build_dependencies:
deb:
- 'build-essential'
- 'cmake'
- 'libmagic-dev'
- 'libsqlite3-dev'
- 'libjson-c-dev'
- 'libffi-dev'
- 'file'
- 'python3-dev'
- 'curl'
- 'jq'
- 'xsltproc'
- 'libpq-dev'
deploy_dependencies:
deb:
- 'ssh'
Subproject commit b6468582546483f3ad867b89ebf71bfda4a8a70a
resources/cellframe.bmp

25.9 KiB

resources/cellframe.ico

99.7 KiB