mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Fix pack script for windows
This commit is contained in:
parent
196233358b
commit
7bbfdf288f
2 changed files with 28 additions and 4 deletions
16
pack_core
16
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}"
|
||||
}
|
||||
|
||||
|
|
16
pmctl/pack
16
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}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue