mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Support auto-install in package uploader tool (#31117)
This commit is contained in:
parent
6147a12ece
commit
b5de3c58e8
2 changed files with 15 additions and 3 deletions
|
|
@ -6,10 +6,11 @@
|
|||
2. Run the following script to upload a folder of packages via the Fleet API:
|
||||
|
||||
``` bash
|
||||
bash ./tools/software/packages/upload-packages.sh -u $FLEET_URL -t $TEAM_ID -k "$API_KEY" -f $FOLDER_PATH_CONTAINING_PACKAGES
|
||||
bash ./tools/software/packages/upload-packages.sh -u $FLEET_URL -t $TEAM_ID -k "$API_KEY" -f $FOLDER_PATH_CONTAINING_PACKAGES [-a]
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- uploading to a `localhost` Fleet server is heavily encouraged as uploading a large amount of packages is time consuming and can be subject to timeouts using tools like `ngrok`
|
||||
- `upload-packages.sh` creates non-functional install and uninstall scripts for `exe` files
|
||||
- use the `-a` flag to add auto-install to the upload
|
||||
|
|
|
|||
|
|
@ -4,16 +4,26 @@ set -euo pipefail
|
|||
shopt -s nullglob
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 -u FLEET_URL -t TEAM_ID -k API_TOKEN -f FOLDERPATH"
|
||||
echo "Usage: $0 -u FLEET_URL -t TEAM_ID -k API_TOKEN -f FOLDERPATH [-a]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -u FLEET_URL The Fleet server URL"
|
||||
echo " -t TEAM_ID The team ID"
|
||||
echo " -k API_TOKEN The API token for authentication"
|
||||
echo " -f FOLDERPATH Path to the folder containing packages"
|
||||
echo " -a Enable automatic installation (optional)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "u:t:k:f:" opt; do
|
||||
AUTO_INSTALL=false
|
||||
|
||||
while getopts "u:t:k:f:a" opt; do
|
||||
case ${opt} in
|
||||
u ) API_URL="$OPTARG" ;;
|
||||
t ) TEAM_ID="$OPTARG" ;;
|
||||
k ) API_TOKEN="$OPTARG" ;;
|
||||
f ) FOLDER="$OPTARG" ;;
|
||||
a ) AUTO_INSTALL=true ;;
|
||||
* ) usage ;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -44,6 +54,7 @@ for file in "${files[@]}"; do
|
|||
-H "Authorization: Bearer $API_TOKEN"
|
||||
-F "software=@${file}"
|
||||
-F "team_id=$TEAM_ID"
|
||||
-F "automatic_install=$AUTO_INSTALL"
|
||||
)
|
||||
|
||||
if [[ "$ext" == "exe" ]]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue