diff --git a/pack_core b/pack_core index d940f51c..363fc567 100755 --- a/pack_core +++ b/pack_core @@ -11,12 +11,18 @@ destDirPart1="dist" destDirPart2="core" function check { + # output + output="main" # get version version=$(grep "info.Set" main.go | cut -d'"' -f4) # build versioned file name filename="portmaster_v${version//./-}" # platform platform="${GOOS}_${GOARCH}" + if [[ $GOOS == "windows" ]]; then + filename="${filename}.exe" + output="${output}.exe" + fi # build destination path destPath=${destDirPart1}/${platform}/${destDirPart2}/$filename @@ -29,19 +35,25 @@ function check { } function build { + # output + output="main" # get version version=$(grep "info.Set" main.go | cut -d'"' -f4) # build versioned file name filename="portmaster_v${version//./-}" # platform platform="${GOOS}_${GOARCH}" + if [[ $GOOS == "windows" ]]; then + filename="${filename}.exe" + output="${output}.exe" + fi # build destination path destPath=${destDirPart1}/${platform}/${destDirPart2}/$filename # check if file exists if [[ -f $destPath ]]; then echo "[core] $platform already built in version $version, skipping..." - exit 0 + return fi # build @@ -51,7 +63,7 @@ function build { exit 1 fi mkdir -p $(dirname $destPath) - cp main $destPath + cp $output $destPath echo -e "\n${COL_BOLD}[core] $platform: successfully built.${COL_OFF}" } diff --git a/pmctl/pack b/pmctl/pack index 597f0913..3aa44b82 100755 --- a/pmctl/pack +++ b/pmctl/pack @@ -11,12 +11,18 @@ destDirPart1="../dist" destDirPart2="pmctl" function check { + # output + output="pmctl" # get version version=$(grep "info.Set" main.go | cut -d'"' -f4) # build versioned file name filename="pmctl_v${version//./-}" # platform platform="${GOOS}_${GOARCH}" + if [[ $GOOS == "windows" ]]; then + filename="${filename}.exe" + output="${output}.exe" + fi # build destination path destPath=${destDirPart1}/${platform}/${destDirPart2}/$filename @@ -29,19 +35,25 @@ function check { } function build { + # output + output="pmctl" # get version version=$(grep "info.Set" main.go | cut -d'"' -f4) # build versioned file name filename="pmctl_v${version//./-}" # platform platform="${GOOS}_${GOARCH}" + if [[ $GOOS == "windows" ]]; then + filename="${filename}.exe" + output="${output}.exe" + fi # build destination path destPath=${destDirPart1}/${platform}/${destDirPart2}/$filename # check if file exists if [[ -f $destPath ]]; then echo "[pmctl] $platform already built in version $version, skipping..." - exit 0 + return fi # build @@ -51,7 +63,7 @@ function build { exit 1 fi mkdir -p $(dirname $destPath) - cp pmctl $destPath + cp $output $destPath echo -e "\n${COL_BOLD}[pmctl] $platform: successfully built.${COL_OFF}" }