-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,12 +27,13 @@ jobs: | |
run: sudo apt-get install build-essential devscripts debhelper dh-make | ||
shell: bash | ||
|
||
- name: Extract version from Makefile | ||
- name: Extract version from root.go | ||
id: extract_version | ||
run: | | ||
VERSION=$(awk -F '=' '/^VERSION/ {print $2}' Makefile) | ||
VERSION=$(grep 'Version[[:space:]]*string' cmd/root.go | awk -F'"' '{ print $2 }') | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "::set-output name=version::${VERSION}" | ||
echo "VERSION=$VERSION" | ||
shell: bash | ||
|
||
- name: Build Windows binary | ||
|
@@ -79,17 +80,20 @@ jobs: | |
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract version from Makefile | ||
- name: Extract version from root.go | ||
id: extract_version | ||
run: echo "VERSION=$(awk -F '=' '/^VERSION/ {print $2}' Makefile)" >> $GITHUB_ENV | ||
run: | | ||
VERSION=$(grep 'Version[[:space:]]*string' cmd/root.go | awk -F'"' '{ print $2 }') | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "::set-output name=version::${VERSION}" | ||
echo "VERSION=$VERSION" | ||
shell: bash | ||
|
||
- name: Select XCode | ||
uses: BoundfoxStudios/action-xcode-select@v1 | ||
with: | ||
version: 14.2 | ||
|
||
|
||
- name: Import app certificate | ||
run: | | ||
security create-keychain -p ${{ secrets.APPLE_CERTPWD }} build.keychain | ||
|
@@ -135,10 +139,6 @@ jobs: | |
xcrun notarytool submit ./opnsense.pkg --wait --apple-id ${{ secrets.APPLE_NOTARIZATION_USERNAME }} --password ${{ secrets.APPLE_NOTARIZATION_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_NAME }} | ||
xcrun stapler staple ./opnsense.pkg | ||
- name: Compile .txz package in FreeBSD | ||
id: compile | ||
uses: vmactions/[email protected] | ||
|
@@ -184,6 +184,16 @@ jobs: | |
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Git user information | ||
run: | | ||
git config user.name "Miha Kralj" | ||
git config user.email "[email protected]" | ||
- name: Delete existing beta tag | ||
run: | | ||
git tag -d beta || true | ||
git push origin --delete beta || true | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
|
@@ -194,20 +204,20 @@ jobs: | |
ls -l ./bin | ||
shell: bash | ||
|
||
- name: Remove Existing Beta Tag | ||
run: | | ||
git tag -d beta || true | ||
git push origin :refs/tags/beta || true | ||
- name: Create Beta Release and Upload Assets | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
prerelease: true | ||
draft: false | ||
tag_name: beta | ||
draft: true | ||
tag_name: ${{ env.VERSION }} | ||
name: opnsense-cli ${{ env.VERSION }} | ||
files: ./bin/opnsense* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ needs.linuxwindows.outputs.version }} | ||
|
||
- name: Add beta tag to the new release | ||
run: | | ||
git tag beta ${{ env.VERSION }} | ||
git push origin beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ import ( | |
) | ||
|
||
var ( | ||
Version string | ||
Version string = "0.5.0" | ||
verbose int | ||
force bool | ||
host string | ||
|
@@ -33,6 +33,11 @@ func init() { | |
rootCmd.PersistentFlags().BoolVarP(&force, "force", "f", false, "Accept or bypass checks and prompts") | ||
//rootCmd.PersistentFlags().StringVarP(&configfile, "config", "c", "/conf/config.xml", "path to target config.xml") | ||
|
||
rootCmd.Flags().StringVar(&Version, "version", "", "display version of opnsense") | ||
rootCmd.SetHelpCommand(&cobra.Command{ | ||
Hidden: true, | ||
}) | ||
|
||
cobra.OnInitialize(func() { | ||
configfile = "/conf/config.xml" | ||
stagingfile = "/conf/staging.xml" | ||
|
@@ -43,22 +48,28 @@ func init() { | |
} | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "opnsense", | ||
Short: "opnsense is a CLI to manage and monitor OPNsense firewall configuration, check status, change settings, and execute commands.", | ||
Long: ` | ||
Description: | ||
opnsense is a command-line utility for managing, configuring, and monitoring OPNsense firewall systems. | ||
It facilitates non-GUI administration, both directly in the shell and remotely via an SSH tunnel. | ||
All interactions with OPNsense utilize the same mechanisms as the Web GUI, | ||
including staged modifications of config.xml and execution of available configd commands.`, | ||
Use: "opnsense [command]", | ||
Short: "CLI to manage and monitor OPNsense firewall systems.", | ||
Long: `Command Line utility to interact with OPNsense firewall. | ||
opnsense CLI is a command-line utility for managing, configuring, and monitoring OPNsense firewall systems. | ||
It facilitates non-GUI administration, both locally on the firewall and remotely via an SSH tunnel. | ||
To avoid entering passwords for each remote call, use 'ssh-add' to add private key to your ssh-agent.`, | ||
|
||
Example: ` opnsense -t [email protected] show system - Show system information on remote OPNsense | ||
opnsense show config interfaces/wan --json - Show the inerfaces/wan of config.xml in json format | ||
opnsense show backup -d2 - Show backup details 2 levels deep | ||
opnsense run firmware reboot -f - Reboot OPNsense, force (no confirmation) | ||
opnsense commit - Commit staged changes`, | ||
|
||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error { | ||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
if len(args) == 0 { | ||
fmt.Println(cmd.Long) | ||
cmd.Help() | ||
os.Exit(0) | ||
} | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.