<commit_before>#!/bin/sh
#
# DMG building script adopted from:
#   http://el-tramo.be/git/fancy-dmg/plain/Makefile
#

WC_DMG=wc.dmg
WC_DIR=wc
TEMPLATE_DMG=template.dmg
OUTPUT_DMG=Duplicati.dmg
OUTPUT_PKG=Duplicati.pkg
UNWANTED_FILES="AlphaVSS.Common.dll AlphaFS.dll AlphaFS.dll.config AlphaVSS.Common.dll.config appindicator-sharp.dll SQLite win-tools alphavss control_dir Duplicati.sqlite Duplicati-server.sqlite run-script-example.bat lvm-scripts Duplicati.debug.log SVGIcons"

CODESIGN_IDENTITY=<PASSWORD>

SHOW_USAGE_ERROR=


TEMPLATE_DMG_BZ2=$(echo "$TEMPLATE_DMG.bz2")
DELETE_DMG=0

if [ -f "$TEMPLATE_DMG_BZ2" ]; then
    if [ -f "$TEMPLATE_DMG" ]; then
        rm -rf "$TEMPLATE_DMG"
    fi
    
    bzip2 --decompress --keep --quiet "$TEMPLATE_DMG_BZ2"
    DELETE_DMG=1
fi

if [ ! -f "$TEMPLATE_DMG" ]; then
    echo "Template file $TEMPLATE_DMG not found"
    exit
fi

if [ ! -f "$1" ]; then
    echo "Please supply a packaged zip file as the first input argument"
    exit
fi

VERSION_NUMBER=$(echo "$1" | awk -F- '{print $2}' | awk -F_ '{print $1}')

VERSION_NAME="Duplicati"
if [ -e "${OUTPUT_DMG}" ]; then
    rm -rf "${OUTPUT_DMG}"
fi

if [ -e "${OUTPUT_PKG}" ]; then
    rm -rf "${OUTPUT_PKG}"
fi

# Remove any existing work copy
if [ -e "Duplicati.app" ]; then
    sudo rm -rf "Duplicati.app"
fi

# Create folder structure
mkdir "Duplicati.app"
mkdir "Duplicati.app/Contents"
mkdir "Duplicati.app/Contents/MacOS"
mkdir "Duplicati.app/Contents/Resources"

# Extract the zip into the Resouces folder
unzip -q "$1" -d "Duplicati.app/Contents/Resources"

# Install the Info.plist and icon
SHORT_VERSION_NUMBER=$(echo ${VERSION_NUMBER} | awk -F. '{printf $1; printf "."; printf $2; printf "."; print $3}')
PLIST=$(cat "Info.plist")
PLIST=${PLIST/!LONG_VERSION!/${VERSION_NUMBER}}
PLIST=${PLIST/!SHORT_VERSION!/${SHORT_VERSION_NUMBER}}
echo ${PLIST} > "Duplicati.app/Contents/Info.plist"
cp "Duplicati.icns" "Duplicati.app/Contents/Resources"

for n in "../oem" "../../oem" "../../../oem"
do
    if [ -d $n ]; then
        echo "Installing OEM files"
        cp -R $n Duplicati.app/Contents/Resources/webroot/
    fi
done

for n in "oem-app-name.txt" "oem-update-url.txt" "oem-update-key.txt" "oem-update-readme.txt" "oem-update-installid.txt"
do
    for p in "../$n" "../../$n" "../../../$n"
    do
        if [ -f $p ]; then
            echo "Installing OEM override file"
            cp $p Duplicati.app/Contents/Resources
        fi
    done
done
<commit_msg>Fixed some issues with the version number for the MacOS build. This fixes #3247<commit_after>#!/bin/sh
#
# DMG building script adopted from:
#   http://el-tramo.be/git/fancy-dmg/plain/Makefile
#

WC_DMG=wc.dmg
WC_DIR=wc
TEMPLATE_DMG=template.dmg
OUTPUT_DMG=Duplicati.dmg
OUTPUT_PKG=Duplicati.pkg
UNWANTED_FILES="AlphaVSS.Common.dll AlphaFS.dll AlphaFS.dll.config AlphaVSS.Common.dll.config appindicator-sharp.dll SQLite win-tools alphavss control_dir Duplicati.sqlite Duplicati-server.sqlite run-script-example.bat lvm-scripts Duplicati.debug.log SVGIcons"

CODESIGN_IDENTITY=<PASSWORD>

SHOW_USAGE_ERROR=


TEMPLATE_DMG_BZ2=$(echo "$TEMPLATE_DMG.bz2")
DELETE_DMG=0

if [ -f "$TEMPLATE_DMG_BZ2" ]; then
    if [ -f "$TEMPLATE_DMG" ]; then
        rm -rf "$TEMPLATE_DMG"
    fi
    
    bzip2 --decompress --keep --quiet "$TEMPLATE_DMG_BZ2"
    DELETE_DMG=1
fi

if [ ! -f "$TEMPLATE_DMG" ]; then
    echo "Template file $TEMPLATE_DMG not found"
    exit
fi

if [ ! -f "$1" ]; then
    echo "Please supply a packaged zip file as the first input argument"
    exit
fi

ZIPNAME=$(basename "$1")
VERSION_NUMBER=$(echo "$ZIPNAME" | awk -F- '{print $2}' | awk -F_ '{print $1}')

VERSION_NAME="Duplicati"
if [ -e "${OUTPUT_DMG}" ]; then
    rm -rf "${OUTPUT_DMG}"
fi

if [ -e "${OUTPUT_PKG}" ]; then
    rm -rf "${OUTPUT_PKG}"
fi

# Remove any existing work copy
if [ -e "Duplicati.app" ]; then
    sudo rm -rf "Duplicati.app"
fi

# Create folder structure
mkdir "Duplicati.app"
mkdir "Duplicati.app/Contents"
mkdir "Duplicati.app/Contents/MacOS"
mkdir "Duplicati.app/Contents/Resources"

# Extract the zip into the Resouces folder
unzip -q "$1" -d "Duplicati.app/Contents/Resources"

# Install the Info.plist and icon, patch the plist file as well
PLIST=$(cat "Info.plist")
PLIST=${PLIST//!LONG_VERSION!/${VERSION_NUMBER}}
echo ${PLIST} > "Duplicati.app/Contents/Info.plist"
cp "Duplicati.icns" "Duplicati.app/Contents/Resources"

for n in "../oem" "../../oem" "../../../oem"
do
    if [ -d $n ]; then
        echo "Installing OEM files"
        cp -R $n Duplicati.app/Contents/Resources/webroot/
    fi
done

for n in "oem-app-name.txt" "oem-update-url.txt" "oem-update-key.txt" "oem-update-readme.txt" "oem-update-installid.txt"
do
    for p in "../$n" "../../$n" "../../../$n"
    do
        if [ -f $p ]; then
            echo "Installing OEM override file"
            cp $p Duplicati.app/Contents/Resources
        fi
    done
done

{'fraction_non_alphanumeric': 0.15310907237512741, 'fraction_numerical': 0.006320081549439347, 'mean_word_length': 3.3570159857904085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2327124', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1881, 'n_words': 456}