mirror of
https://github.com/safing/portmaster
synced 2025-04-25 05:19:09 +00:00
Add pack sripts
This commit is contained in:
parent
fbf7bf51d5
commit
90a5b4a882
3 changed files with 179 additions and 0 deletions
35
pack
Executable file
35
pack
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
baseDir="$( cd "$(dirname "$0")" && pwd )"
|
||||
cd "$baseDir"
|
||||
|
||||
# first check what will be built
|
||||
|
||||
echo ""
|
||||
echo "pack list:"
|
||||
echo ""
|
||||
|
||||
./pmctl/pack check
|
||||
./pack_core check
|
||||
|
||||
# confirm
|
||||
|
||||
echo ""
|
||||
read -p "press [Enter] to start packing" x
|
||||
echo ""
|
||||
|
||||
# build
|
||||
|
||||
./pmctl/pack build
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./pack_core build
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "finished packing."
|
||||
echo ""
|
72
pack_core
Executable file
72
pack_core
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
baseDir="$( cd "$(dirname "$0")" && pwd )"
|
||||
cd "$baseDir"
|
||||
|
||||
COL_OFF="\033[00m"
|
||||
COL_BOLD="\033[01;01m"
|
||||
COL_YELLOW="\033[33m"
|
||||
|
||||
destDirPart1="./dist"
|
||||
destDirPart2="core"
|
||||
|
||||
function check {
|
||||
# get version
|
||||
version=$(grep "info.Set" main.go | cut -d'"' -f4)
|
||||
# build versioned file name
|
||||
filename="portmaster_v${version//./-}"
|
||||
# build destination path
|
||||
destPath=${destDirPart1}/linux_amd64/${destDirPart2}/$filename
|
||||
|
||||
# check if file exists
|
||||
if [[ -f $destPath ]]; then
|
||||
echo "[core] linux_amd64 $version already built"
|
||||
else
|
||||
echo -e "${COL_BOLD}[core] linux_amd64 $version${COL_OFF}"
|
||||
fi
|
||||
}
|
||||
|
||||
function build {
|
||||
# get version
|
||||
version=$(grep "info.Set" main.go | cut -d'"' -f4)
|
||||
# build versioned file name
|
||||
filename="portmaster_v${version//./-}"
|
||||
# build destination path
|
||||
destPath=${destDirPart1}/linux_amd64/${destDirPart2}/$filename
|
||||
|
||||
# check if file exists
|
||||
if [[ -f $destPath ]]; then
|
||||
echo "core[linux_amd64] already built in version $version, skipping..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# build
|
||||
GOOS=linux GOARCH=amd64 ./build main.go
|
||||
cp main $destPath
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "\nlinux_amd64: BUILD FAILED."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
"check" )
|
||||
check
|
||||
;;
|
||||
"build" )
|
||||
build
|
||||
;;
|
||||
* )
|
||||
echo ""
|
||||
echo "build list:"
|
||||
echo ""
|
||||
check
|
||||
echo ""
|
||||
read -p "press [Enter] to start building" x
|
||||
echo ""
|
||||
build
|
||||
echo ""
|
||||
echo "finished building."
|
||||
echo ""
|
||||
;;
|
||||
esac
|
72
pmctl/pack
Executable file
72
pmctl/pack
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
baseDir="$( cd "$(dirname "$0")" && pwd )"
|
||||
cd "$baseDir"
|
||||
|
||||
COL_OFF="\033[00m"
|
||||
COL_BOLD="\033[01;01m"
|
||||
COL_YELLOW="\033[33m"
|
||||
|
||||
destDirPart1="../dist"
|
||||
destDirPart2="pmctl"
|
||||
|
||||
function check {
|
||||
# get version
|
||||
version=$(grep "info.Set" main.go | cut -d'"' -f4)
|
||||
# build versioned file name
|
||||
filename="pmctl_v${version//./-}"
|
||||
# build destination path
|
||||
destPath=${destDirPart1}/linux_amd64/${destDirPart2}/$filename
|
||||
|
||||
# check if file exists
|
||||
if [[ -f $destPath ]]; then
|
||||
echo "[pmctl] linux_amd64 $version already built"
|
||||
else
|
||||
echo -e "${COL_BOLD}[pmctl] linux_amd64 $version${COL_OFF}"
|
||||
fi
|
||||
}
|
||||
|
||||
function build {
|
||||
# get version
|
||||
version=$(grep "info.Set" main.go | cut -d'"' -f4)
|
||||
# build versioned file name
|
||||
filename="pmctl_v${version//./-}"
|
||||
# build destination path
|
||||
destPath=${destDirPart1}/linux_amd64/${destDirPart2}/$filename
|
||||
|
||||
# check if file exists
|
||||
if [[ -f $destPath ]]; then
|
||||
echo "pmctl[linux_amd64] already built in version $version, skipping..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# build
|
||||
GOOS=linux GOARCH=amd64 ./build
|
||||
cp pmctl $destPath
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "\nlinux_amd64: BUILD FAILED."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
"check" )
|
||||
check
|
||||
;;
|
||||
"build" )
|
||||
build
|
||||
;;
|
||||
* )
|
||||
echo ""
|
||||
echo "build list:"
|
||||
echo ""
|
||||
check
|
||||
echo ""
|
||||
read -p "press [Enter] to start building" x
|
||||
echo ""
|
||||
build
|
||||
echo ""
|
||||
echo "finished building."
|
||||
echo ""
|
||||
;;
|
||||
esac
|
Loading…
Add table
Reference in a new issue