Merge branch 'main' into beta1

This commit is contained in:
chalith
2022-08-31 16:31:09 +05:30
5 changed files with 35 additions and 12 deletions

View File

@@ -44,9 +44,10 @@ if ! command -v node &>/dev/null; then
curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get -y install nodejs
else
version=$(node -v)
if [[ ! $version =~ v16\..* ]]; then
echo "Found node $version, recommended node v16.x.x"
version=$(node -v | cut -d '.' -f1)
version=${version:1}
if [[ $version -lt 16 ]]; then
echo "Found node $version, recommended node v16.x.x or later"
fi
fi
@@ -63,6 +64,12 @@ if [[ -z "$(lsmod | grep br_netfilter)" ]]; then
echo "br_netfilter" >/etc/modules-load.d/br_netfilter.conf
fi
# Install ufw
if ! command -v ufw &>/dev/null; then
stage "Installing ufw"
apt-get install -y ufw
fi
# -------------------------------
# fstab changes
# We do not edit original file, instead we create a temp file with original and edit it.

View File

@@ -17,8 +17,8 @@ function confirm() {
read -p "'y' or 'n' expected: " yn </dev/tty
done
echo "" # Insert new line after answering.
[[ $yn =~ ^[Yy]$ ]] && return 0 || return 1 # 0 means success.
echo "" # Insert new line after answering.
[[ $yn =~ ^[Yy]$ ]] && return 0 || return 1 # 0 means success.
}
function cgrulesengd_servicename() {
@@ -87,10 +87,25 @@ if [ "$UPGRADE" == "0" ]; then
echo "Deleting $ucount contract instances..."
for user in "${sashiusers[@]}"; do
output=$($SASHIMONO_BIN/user-uninstall.sh $user | tee /dev/stderr)
homedir=$(eval echo ~$user)
cfgpath=$(find $homedir/ -type f -regex ^$homedir/[^/]+/cfg/hp.cfg$ 2>/dev/null | head -n 1)
instancename=$(echo $cfgpath | rev | cut -d '/' -f 3 | rev)
peerport=$(jq .mesh.port $cfgpath)
userport=$(jq .user.port $cfgpath)
output=$($SASHIMONO_BIN/user-uninstall.sh $user $peerport $userport $instancename | tee /dev/stderr)
[ "${output: -10}" != "UNINST_SUC" ] && echo "Uninstall user '$user' failed. Aborting." && exit 1
done
fi
# Find if there are any garbage rules that are created by sashimono and remove them.
prefix="sashi"
ufw status | grep -E ^[0-9]+,[0-9]+/tcp\\s+ALLOW\\s+Anywhere\\s+\#\\s$prefix-.+$ | while read -r line; do
ports=$(echo $line | cut -d ' ' -f 1)
echo "Removing found garbage ufw $ports rule..."
p1=$(echo $ports | cut -d ',' -f 1)
p2=$(echo $ports | cut -d ',' -f 2 | cut -d '/' -f 1)
ufw delete allow "$p1","$p2"/tcp
done
fi
echo "Removing Sashimono cgroup creation service..."
@@ -157,9 +172,9 @@ if grep -q "^$MB_XRPL_USER:" /etc/passwd; then
fi
echo "Deleting message board user..."
# Killall command is not found in every linux systems, therefore pkill command is used.
# Killall command is not found in every linux systems, therefore pkill command is used.
# A small timeout(0.5 second) is applied before deleting the user because it takes some time to kill all the processes
loginctl disable-linger $MB_XRPL_USER
loginctl disable-linger $MB_XRPL_USER
pkill -u $MB_XRPL_USER # Kill any running processes.
sleep 0.5
userdel -f "$MB_XRPL_USER"

View File

@@ -125,8 +125,9 @@ function GB() {
function check_prereq() {
# Check if node js installed.
if command -v node &>/dev/null; then
version=$(node -v)
if [[ ! $version =~ v16\..* ]]; then
version=$(node -v | cut -d '.' -f1)
version=${version:1}
if [[ $version -lt 16 ]]; then
echo "$evernode requires NodeJs 16.x or later. You system has NodeJs $version installed. Either remove the NodeJs installation or upgrade to NodeJs 16.x."
exit 1
fi

View File

@@ -24,7 +24,7 @@ appenv = {
ACQUIRE_LEASE_WAIT_TIMEOUT_THRESHOLD: 0.4,
ORPHAN_PRUNE_SCHEDULER_INTERVAL_HOURS: 4,
SASHI_CLI_PATH: appenv.IS_DEV_MODE ? "../build/sashi" : "/usr/bin/sashi",
MB_VERSION: '0.5.9',
MB_VERSION: '0.5.10',
TOS_HASH: '757A0237B44D8B2BBB04AE2BAD5813858E0AECD2F0B217075E27E0630BA74314' // This is the sha256 hash of TOS text.
}
Object.freeze(appenv);

View File

@@ -6,7 +6,7 @@
namespace version
{
// Sashimono agent version. Written to new configs.
constexpr const char *AGENT_VERSION = "0.5.9";
constexpr const char *AGENT_VERSION = "0.5.10";
// Minimum compatible config version (this will be used to validate configs).
constexpr const char *MIN_CONFIG_VERSION = "0.5.0";