Add back accidentially deleted pkg sub-dir.

This commit is contained in:
David Murphy 2025-02-10 10:25:40 -07:00 committed by Daniel Wozniak
parent 3aec32f675
commit c2f129ac58
427 changed files with 30418 additions and 0 deletions

11
pkg/README Normal file
View file

@ -0,0 +1,11 @@
Salt packaging resources.
The contents of this directory are as follows
common/ - Files common to multiple packages.
debian/ - Debian (apt) based distro packaging.
rpm/ - Redhat (rpm) based distro packaging.
macos/ - MacOS packaging.
windows/ - Windows packaging.
old/ - Old and deperecated package files.

1359
pkg/common/conf/master Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,286 @@
---
common:
exclude_patterns: &common_exclude_patterns
- "**/site-packages/ansible/plugins/test"
- "**/site-packages/ansible/plugins/test/**"
dir_patterns: &common_dir_patterns
- "**/__pycache__"
- "**/lib/python3.*/test"
- "**/lib/python3.*/idlelib"
- "**/lib/python3.*/tkinter"
- "**/lib/python3.*/turtledemo"
- "**/site-packages/test"
- "**/site-packages/tests"
- "**/site-packages/*/test"
- "**/site-packages/*/tests"
- "**/site-packages/ansible_collections/*/*/test"
- "**/site-packages/ansible_collections/*/*/tests"
# Bundled Tornado Test Suite
- "**/salt/ext/tornado/test"
file_patterns: &common_file_patterns
- "*.pyc"
- "*.pyo"
- "**/test/test_*.py*"
- "**/test/**/test_*.py*"
- "**/tests/test_*.py*"
- "**/tests/**/test_*.py*"
ci:
darwin:
exclude_patterns: &ci_darwin_exclude_patterns
- *common_exclude_patterns
dir_patterns: &ci_darwin_dir_patterns
- *common_dir_patterns
file_patterns: &ci_darwin_file_patterns
- *common_file_patterns
linux:
exclude_patterns: &ci_linux_exclude_patterns
- *common_exclude_patterns
dir_patterns: &ci_linux_dir_patterns
- *common_dir_patterns
file_patterns: &ci_linux_file_patterns
- *common_file_patterns
windows:
exclude_patterns: &ci_windows_exclude_patterns
- *common_exclude_patterns
dir_patterns: &ci_windows_dir_patterns
- *common_dir_patterns
- "**/artifacts/salt/configs"
- "**/site-packages/adodbapi"
- "**/site-packages/isapi"
- "**/site-packages/pythonwin"
- "**/site-packages/win32/demos"
- "**/site-packages/tempora/tests"
- "**/site-packages/win32/test"
- "**/site-packages/win32com/test"
file_patterns: &ci_windows_file_patterns
- *common_file_patterns
# Help files
- "**/*.chm"
- "**/Scripts/wmitest*"
pkg:
darwin:
exclude_patterns:
- *ci_darwin_exclude_patterns
dir_patterns:
- *ci_darwin_dir_patterns
- "**/pkgconfig"
- "**/share"
- "**/artifacts/salt/opt"
- "**/artifacts/salt/etc"
- "**/artifacts/salt/Lib"
file_patterns:
- *ci_darwin_file_patterns
linux:
exclude_patterns:
- *ci_linux_exclude_patterns
dir_patterns:
- *ci_linux_dir_patterns
file_patterns:
- *ci_linux_file_patterns
windows:
exclude_patterns:
- *ci_windows_exclude_patterns
dir_patterns:
- *ci_windows_dir_patterns
- "**/salt/share"
- "**/site-packages/pywin32_system32"
file_patterns:
- *ci_windows_file_patterns
- "**/Scripts/py.exe"
- "**/Scripts/pyw.exe"
- "**/Scripts/venvlauncher.exe"
- "**/Scripts/venvwlauncher.exe"
- "**/Scripts/wheel*"
- "**/doc"
- "**/readme"
- "**/salt/salt-api*"
- "**/salt/salt-key*"
- "**/salt/salt-run*"
- "**/salt/salt-syndic*"
- "**/salt/salt-unity*"
- "**/salt/spm*"
- "**/salt/wheel*"
# Non Windows execution modules
- "**/site-packages/salt/modules/aacme.py*"
- "**/site-packages/salt/modules/aix.py*"
- "**/site-packages/salt/modules/alternatives.py*"
- "**/site-packages/salt/modules/apcups.py*"
- "**/site-packages/salt/modules/apf.py*"
- "**/site-packages/salt/modules/apt.py*"
- "**/site-packages/salt/modules/arista.py*"
- "**/site-packages/salt/modules/at.py*"
- "**/site-packages/salt/modules/bcache.py*"
- "**/site-packages/salt/modules/blockdev.py*"
- "**/site-packages/salt/modules/bluez.py*"
- "**/site-packages/salt/modules/bridge.py*"
- "**/site-packages/salt/modules/bsd.py*"
- "**/site-packages/salt/modules/btrfs.py*"
- "**/site-packages/salt/modules/ceph.py*"
- "**/site-packages/salt/modules/container_resource.py*"
- "**/site-packages/salt/modules/cron.py*"
- "**/site-packages/salt/modules/csf.py*"
- "**/site-packages/salt/modules/daemontools.py*"
- "**/site-packages/salt/modules/deb*.py*"
- "**/site-packages/salt/modules/devmap.py*"
- "**/site-packages/salt/modules/dpkg.py*"
- "**/site-packages/salt/modules/ebuild.py*"
- "**/site-packages/salt/modules/eix.py*"
- "**/site-packages/salt/modules/eselect.py*"
- "**/site-packages/salt/modules/ethtool.py*"
- "**/site-packages/salt/modules/extfs.py*"
- "**/site-packages/salt/modules/firewalld.py*"
- "**/site-packages/salt/modules/freebsd.py*"
- "**/site-packages/salt/modules/genesis.py*"
- "**/site-packages/salt/modules/gentoo.py*"
- "**/site-packages/salt/modules/glusterfs.py*"
- "**/site-packages/salt/modules/gnomedesktop.py*"
- "**/site-packages/salt/modules/groupadd.py*"
- "**/site-packages/salt/modules/grub_legacy.py*"
- "**/site-packages/salt/modules/guestfs.py*"
- "**/site-packages/salt/modules/htpasswd.py*"
- "**/site-packages/salt/modules/ilo.py*"
- "**/site-packages/salt/modules/img.py*"
- "**/site-packages/salt/modules/incron.py*"
- "**/site-packages/salt/modules/inspector.py*"
- "**/site-packages/salt/modules/ipset.py*"
- "**/site-packages/salt/modules/iptables.py*"
- "**/site-packages/salt/modules/iwtools.py*"
- "**/site-packages/salt/modules/k8s.py*"
- "**/site-packages/salt/modules/kapacitor.py*"
- "**/site-packages/salt/modules/keyboard.py*"
- "**/site-packages/salt/modules/keystone.py*"
- "**/site-packages/salt/modules/kmod.py*"
- "**/site-packages/salt/modules/layman.py*"
- "**/site-packages/salt/modules/linux.py*"
- "**/site-packages/salt/modules/localemod.py*"
- "**/site-packages/salt/modules/locate.py*"
- "**/site-packages/salt/modules/logadm.py*"
- "**/site-packages/salt/modules/logrotate.py*"
- "**/site-packages/salt/modules/lvs.py*"
- "**/site-packages/salt/modules/lxc.py*"
- "**/site-packages/salt/modules/mac.py*"
- "**/site-packages/salt/modules/makeconf.py*"
- "**/site-packages/salt/modules/mdadm.py*"
- "**/site-packages/salt/modules/mdata.py*"
- "**/site-packages/salt/modules/monit.py*"
- "**/site-packages/salt/modules/moosefs.py*"
- "**/site-packages/salt/modules/mount.py*"
- "**/site-packages/salt/modules/napalm.py*"
- "**/site-packages/salt/modules/netbsd.py*"
- "**/site-packages/salt/modules/netscaler.py*"
- "**/site-packages/salt/modules/neutron.py*"
- "**/site-packages/salt/modules/nfs3.py*"
- "**/site-packages/salt/modules/nftables.py*"
- "**/site-packages/salt/modules/nova.py*"
- "**/site-packages/salt/modules/nspawn.py*"
- "**/site-packages/salt/modules/openbsd.py*"
- "**/site-packages/salt/modules/openstack.py*"
- "**/site-packages/salt/modules/openvswitch.py*"
- "**/site-packages/salt/modules/opkg.py*"
- "**/site-packages/salt/modules/pacman.py*"
- "**/site-packages/salt/modules/parallels.py*"
- "**/site-packages/salt/modules/parted.py*"
- "**/site-packages/salt/modules/pcs.py*"
- "**/site-packages/salt/modules/pkgin.py*"
- "**/site-packages/salt/modules/pkgng.py*"
- "**/site-packages/salt/modules/pkgutil.py*"
- "**/site-packages/salt/modules/portage_config.py*"
- "**/site-packages/salt/modules/postfix.py*"
- "**/site-packages/salt/modules/poudriere.py*"
- "**/site-packages/salt/modules/powerpath.py*"
- "**/site-packages/salt/modules/pw_.py*"
- "**/site-packages/salt/modules/qemu_.py*"
- "**/site-packages/salt/modules/quota.py*"
- "**/site-packages/salt/modules/redismod.py*"
- "**/site-packages/salt/modules/restartcheck.py*"
- "**/site-packages/salt/modules/rh_.py*"
- "**/site-packages/salt/modules/riak.py*"
- "**/site-packages/salt/modules/rpm.py*"
- "**/site-packages/salt/modules/runit.py*"
- "**/site-packages/salt/modules/s6.py*"
- "**/site-packages/salt/modules/scsi.py*"
- "**/site-packages/salt/modules/sensors.py*"
- "**/site-packages/salt/modules/service.py*"
- "**/site-packages/salt/modules/shadow.py*"
- "**/site-packages/salt/modules/smartos.py*"
- "**/site-packages/salt/modules/smf.py*"
- "**/site-packages/salt/modules/snapper.py*"
- "**/site-packages/salt/modules/solaris.py*"
- "**/site-packages/salt/modules/solr.py*"
- "**/site-packages/salt/modules/ssh_.py*"
- "**/site-packages/salt/modules/supervisord.py*"
- "**/site-packages/salt/modules/sysbench.py*"
- "**/site-packages/salt/modules/sysfs.py*"
- "**/site-packages/salt/modules/sysrc.py*"
- "**/site-packages/salt/modules/system.py*"
- "**/site-packages/salt/modules/test_virtual.py*"
- "**/site-packages/salt/modules/timezone.py*"
- "**/site-packages/salt/modules/trafficserver.py*"
- "**/site-packages/salt/modules/tuned.py*"
- "**/site-packages/salt/modules/udev.py*"
- "**/site-packages/salt/modules/upstart.py*"
- "**/site-packages/salt/modules/useradd.py*"
- "**/site-packages/salt/modules/uswgi.py*"
- "**/site-packages/salt/modules/varnish.py*"
- "**/site-packages/salt/modules/vbox.py*"
- "**/site-packages/salt/modules/virt.py*"
- "**/site-packages/salt/modules/xapi.py*"
- "**/site-packages/salt/modules/xbpspkg.py*"
- "**/site-packages/salt/modules/xfs.py*"
- "**/site-packages/salt/modules/yum*.py*"
- "**/site-packages/salt/modules/zfs.py*"
- "**/site-packages/salt/modules/znc.py*"
- "**/site-packages/salt/modules/zpool.py*"
- "**/site-packages/salt/modules/zypper.py*"
# Non Windows state modules
- "**/site-packages/salt/states/acme.py*"
- "**/site-packages/salt/states/alternatives.py*"
- "**/site-packages/salt/states/apt.py*"
- "**/site-packages/salt/states/at.py*"
- "**/site-packages/salt/states/blockdev.py*"
- "**/site-packages/salt/states/ceph.py*"
- "**/site-packages/salt/states/cron.py*"
- "**/site-packages/salt/states/csf.py*"
- "**/site-packages/salt/states/deb.py*"
- "**/site-packages/salt/states/eselect.py*"
- "**/site-packages/salt/states/ethtool.py*"
- "**/site-packages/salt/states/firewalld.py*"
- "**/site-packages/salt/states/glusterfs.py*"
- "**/site-packages/salt/states/gnome.py*"
- "**/site-packages/salt/states/htpasswd.py*"
- "**/site-packages/salt/states/incron.py*"
- "**/site-packages/salt/states/ipset.py*"
- "**/site-packages/salt/states/iptables.py*"
- "**/site-packages/salt/states/k8s.py*"
- "**/site-packages/salt/states/kapacitor.py*"
- "**/site-packages/salt/states/keyboard.py*"
- "**/site-packages/salt/states/keystone.py*"
- "**/site-packages/salt/states/kmod.py*"
- "**/site-packages/salt/states/layman.py*"
- "**/site-packages/salt/states/linux.py*"
- "**/site-packages/salt/states/lxc.py*"
- "**/site-packages/salt/states/mac.py*"
- "**/site-packages/salt/states/makeconf.py*"
- "**/site-packages/salt/states/mdadm.py*"
- "**/site-packages/salt/states/monit.py*"
- "**/site-packages/salt/states/mount.py*"
- "**/site-packages/salt/states/nftables.py*"
- "**/site-packages/salt/states/pcs.py*"
- "**/site-packages/salt/states/pkgng.py*"
- "**/site-packages/salt/states/portage.py*"
- "**/site-packages/salt/states/powerpath.py*"
- "**/site-packages/salt/states/quota.py*"
- "**/site-packages/salt/states/redismod.py*"
- "**/site-packages/salt/states/smartos.py*"
- "**/site-packages/salt/states/snapper.py*"
- "**/site-packages/salt/states/ssh.py*"
- "**/site-packages/salt/states/supervisord.py*"
- "**/site-packages/salt/states/sysrc.py*"
- "**/site-packages/salt/states/trafficserver.py*"
- "**/site-packages/salt/states/tuned.py*"
- "**/site-packages/salt/states/vbox.py*"
- "**/site-packages/salt/states/virt.py.py*"
- "**/site-packages/salt/states/zfs.py*"
- "**/site-packages/salt/states/zpool.py*"

View file

@ -0,0 +1,23 @@
# salt-call completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null
# salt-call general options (from --help)
complete -c salt-call -r -l file-root -d "Set this directory as the base file root."
complete -c salt-call -f -s g -l grains -d "Return the information generated by the salt grains "
complete -c salt-call -f -l id -d "Specify the minion id to use. If this option is omitted, the id option from the minion config will be used."
complete -c salt-call -f -l local -d "Run salt-call locally, as if there was no master running."
complete -c salt-call -x -l master -d "Specify the master to use. The minion must be authenticated with the master. If this option is omitted, the master options from the minion config will be used. If multi masters are set up the first listed master that responds will be used."
complete -c salt-call -r -s m -l module-dirs -d "Specify an additional directory to pull modules from. Multiple directories can be provided by passing `-m /--module-dirs` multiple times."
complete -c salt-call -r -l pillar-root -d "Set this directory as the base pillar root."
complete -c salt-call -f -l refresh-grains-cache -d "Force a refresh of the grains cache"
complete -c salt-call -f -l retcode-passthrough -d "Exit with the salt call retcode and not the salt binary retcode"
complete -c salt-call -f -l skip-grains -d "Do not load grains."
# functions
complete -c salt-call -f -a '(__fish_salt_list_function)'
# complete -c salt -f -n 'not __fish_salt_extract_function' -a '(__fish_salt_list_function)'
# arguments and name values
complete -c salt-call -f -n '__fish_salt_extract_function' -a '(__fish_salt_list_arg_name) (__fish_salt_list_arg_value)'

View file

@ -0,0 +1,5 @@
# salt-cp completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common.fish completion
complete --do-complete='salt_common --' >/dev/null

View file

@ -0,0 +1,36 @@
# salt-key completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null
# salt-key general options (from --help)
complete -c salt-key -f -s A -l accept-all -d "Accept all pending keys"
complete -c salt-key -f -s a -l accept -d "Accept the specified public key (use --include-all to match rejected keys in addition to pending keys). Globs are supported."
complete -c salt-key -f -l auto-create -d "Auto-create a signing key-pair if it does not yet exist"
complete -c salt-key -f -s D -l delete-all -d "Delete all keys"
complete -c salt-key -f -s d -l delete -d "Delete the specified key. Globs are supported."
complete -c salt-key -f -s F -l finger-all -d "Print all keys' fingerprints"
complete -c salt-key -f -s f -l finger -d "Print the specified key's fingerprint"
complete -c salt-key -r -l gen-keys-dir -d "Set the directory to save the generated keypair, only works with \"gen_keys_dir\" option; default=."
complete -c salt-key -f -l gen-keys -d "Set a name to generate a keypair for use with salt"
complete -c salt-key -f -l gen-signature -d "Create a signature file of the masters public-key named master_pubkey_signature. The signature can be send to a minion in the masters auth-reply and enables the minion to verify the masters public-key cryptographically. This requires a new signing-key- pair which can be auto-created with the --auto-create parameter"
complete -c salt-key -f -l include-all -d "Include non-pending keys when accepting/rejecting"
complete -c salt-key -x -l keysize -d "Set the keysize for the generated key, only works with the \"--gen-keys\" option, the key size must be 2048 or higher, otherwise it will be rounded up to 2048; ; default=2048"
complete -c salt-key -f -s L -l list-all -d "List all public keys. (Deprecated: use \"--list all\")"
complete -c salt-key -x -s l -l list -d "List the public keys" -a "pre un unaccepted acc accepted rej rejected all"
complete -c salt-key -f -s P -l print-all -d "Print all public keys"
complete -c salt-key -f -s p -l print -d "Print the specified public key"
complete -c salt-key -r -l priv -d "The private-key file to create a signature with"
complete -c salt-key -r -l pub -d "The public-key file to create a signature for"
complete -c salt-key -f -s R -l reject-all -d "Reject all pending keys"
complete -c salt-key -f -s r -l reject -d "Reject the specified public key (use --include-all to match accepted keys in addition to pending keys). Globs are supported."
complete -c salt-key -r -l signature-path -d "The path where the signature file should be written"
# minions
complete -c salt-key -f -n '__fish_contains_opt -s a accept; and not __fish_salt_extract_minion' -a '(__fish_salt_list_minion unaccepted) (__fish_salt_list_minion rejected)'
complete -c salt-key -f -n '__fish_contains_opt -s d delete; and not __fish_salt_extract_minion' -a '(__fish_salt_list_minion all)'
complete -c salt-key -f -n '__fish_contains_opt -s f finger; and not __fish_salt_extract_minion' -a '(__fish_salt_list_minion all)'
complete -c salt-key -f -n '__fish_contains_opt -s p print; and not __fish_salt_extract_minion' -a '(__fish_salt_list_minion all)'
complete -c salt-key -f -n '__fish_contains_opt -s r reject; and not __fish_salt_extract_minion' -a '(__fish_salt_list_minion unaccepted) (__fish_salt_list_minion accepted)'

View file

@ -0,0 +1,5 @@
# salt-master completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null

View file

@ -0,0 +1,5 @@
# salt-minion completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null

View file

@ -0,0 +1,5 @@
# salt-run completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null

View file

@ -0,0 +1,5 @@
# salt completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null

View file

@ -0,0 +1,38 @@
# salt completion for fish shell
# See salt_common.fish in the same folder for the information
# hack to load functions from salt_common completion
complete --do-complete='salt_common --' >/dev/null
# salt general options (from --help)
for auth in auth eauth external-auth
complete -c salt -f -s a -l $auth -d "Specify an external authentication system to use."
end
for batch in batch batch-size
complete -c salt -f -s b -l $batch -d "Execute the salt job in batch mode, pass either the number of minions to batch at a time, or the percentage of minions to have runnin"
end
complete -c salt -x -l args-separator -d "Set the special argument used as a delimiter between command arguments of compound commands. This is useful when one wants to pass commas as arguments to some of the commands in a compound command."
complete -c salt -f -l async -d "Run the salt command but don't wait for a reply"
complete -c salt -f -s C -l compound -d "The compound target option allows for multiple target types to be evaluated, allowing for greater granularity in target matching. The compound target is space delimited, targets other than globs are preceded with an identifier matching the specific targets argument type: salt \"G@os:RedHat and webser* or E@database.*\""
complete -c salt -f -s S -l ipcidr -d "Match based on Subnet (CIDR notation) or IPv4 address."
complete -c salt -f -s T -l make-token -d "Generate and save an authentication token for re-use. The token is generated and made available for the period defined in the Salt Master."
complete -c salt -x -l password -d "Password for external authentication"
complete -c salt -f -s I -l pillar -d "Instead of using shell globs to evaluate the target use a pillar value to identify targets, the syntax for the target is the pillar key followed by a globexpression: \"role:production*\""
complete -c salt -f -l show-timeout -d "Display minions that timeout without the additional output of --verbose"
complete -c salt -f -l show-jid -d "Display jid without the additional output of --verbose"
complete -c salt -x -l state-output -d "Override the configured state_output value for minion output. Default: full"
complete -c salt -f -s s -l static -d "Return the data from minions as a group after they all return."
complete -c salt -x -l subset -d "Execute the routine on a random subset of the targeted minions. The minions will be verified that they have the named function before executing"
complete -c salt -f -l summary -d "Display summary information about a salt command"
complete -c salt -x -l username -d "Username for external authentication"
complete -c salt -f -s v -l verbose -d "Turn on command verbosity, display jid and active job queries"
# salt arguments
# minions
complete -c salt -f -n 'not __fish_salt_extract_minion' -a '(__fish_salt_list_minion accepted)' -d 'Minion'
# functions
complete -c salt -f -n '__fish_salt_extract_minion; and not __fish_salt_extract_function' -a '(__fish_salt_list_function)' -d 'Function'
# arguments names
complete -c salt -f -n '__fish_salt_extract_function' -a '(__fish_salt_list_arg_name)' -d 'Argument'
# arguments values
complete -c salt -f -n '__fish_salt_extract_function' -a '(__fish_salt_list_arg_value | __fish_salt_prefix_with_arg_name)'

View file

@ -0,0 +1,438 @@
# salt-call completion for fish shell
# This file contains common options and helper functions.
# README:
# Completion lines are structured as a table to make it easier edit them with
# vim or similar editors. Long lines (that are longer than the completion line
# until "-d 'help message'") are splitted. Descriptions are not splitted.
# TAB width is set to 4 chars!
# Completion lines are sorted by groups, in groups they are sorted by long
# option name (by alphabet).
# If you want to add some completions for arguments value you probably want to
# add line into __fish_salt_args_types variable. First column is the name of
# argument (_ is for unnamed arguments), second is the name of the function,
# last one is the type of the completion (you can use any types that have
# corresponding function __fish_salt_list_TYPE).
#
# VERSION:
# Generated from the help of salt programs on commit ad89a752f807d5ea00d3a9b3257d283ef6b69c10
#
# ISSUES:
# TODO: #1 add: salt-api salt-cloud salt-ssh
# TODO: #2 write tests (use https://github.com/terlar/fish-tank)
# TODO: #3 add completion for builtin states
# TODO: #4 use caching (see https://github.com/saltstack/salt/issues/15321)
# TODO: #5 add help to the positional arguments (like '(Minion)', '(Grain)')
# using __fish_salt_list function everythere)
# TODO: #6 add minion selection by grains (call "salt '*' grains.ls", use #4)
# BUG: #7 salt-call autocompletion and salt packages not works; it hangs. Ask
# fish devs?
# TODO: #8 sort with `sort` or leave as is?
# common general options (from --help)
set -l salt_programs \
salt salt-call salt-cp salt-key salt-master salt-minion \
salt-run salt-syndic
for program in $salt_programs
complete -c $program -f -l version -d "show program's version number and exit"
complete -c $program -f -l versions-report -d "show program's dependencies version number and exit"
complete -c $program -f -s h -l help -d "show help message and exit"
complete -c $program -r -s c -l config-dir -d "Pass in an alternative configuration directory. Default: /etc/salt"
# BUG: (log file is different for different programs)
complete -c $program -r -l log-file -d "Log file path. Default: /var/log/salt/master."
complete -c $program -x -l log-file-level -d "Logfile logging log level. Default: \"warning\"." -a "all garbage trace debug info warning error critical quiet"
complete -c $program -x -s l -l log-level -d "logging log level. Default: \"warning\"." -a "all garbage trace debug info warning error critical quiet"
end
set -l salt_programs_crash salt salt-call salt-cp \
salt-key salt-run
for program in $salt_programs_crash
complete -c $program -f -l hard-crash -d "Raise any original exception rather than exiting gracefully. Default: False"
end
set -l salt_programs_output_color salt salt-call \
salt-key salt-run
for program in $salt_programs_output_color
for color in color colour
complete -c $program -f -l force-$color -d "Force colored output"
complete -c $program -f -l no-$color -d "Disable all colored output"
end
end
set -l salt_programs_output salt salt-call salt-key
for program in $salt_programs_output
for out in out output
complete -c $program -x -l $out -d "Print the output from the \"$program\" command using the specified outputter" -a "raw compact no_return grains overstatestage pprint json nested yaml highstate quiet key txt virt_query newline_values_only"
complete -c $program -r -l $out-file -d "Write the output to the specified file"
complete -c $program -x -l $out-file-append -d "Append the output to the specified file"
complete -c $program -x -l $out-indent -d "Print the output indented by the provided value in spaces. Negative values disables indentation. Only applicable in outputters that support indentation."
end
end
set -l salt_programs_doc salt salt-call salt-run
for program in $salt_programs_doc
for doc in doc documentation
complete -c $program -f -s d -l $doc -d "Display documentation for runners, pass a runner or runner.function to see documentation on only that runner or function."
end
end
set -l salt_programs_select salt salt-cp
for program in $salt_programs_select
complete -c $program -f -s G -l grain -d "Instead of using shell globs to evaluate the target use a grain value to identify targets, the syntax for the target is the grain key followed by a globexpression: \"os:Arch*\""
complete -c $program -f -l grain-pcre -d "Instead of using shell globs to evaluate the target use a grain value to identify targets, the syntax for the target is the grain key followed by a pcre regular expression: \"os:Arch.*\""
complete -c $program -f -s L -l list -d "Instead of using shell globs to evaluate the target servers, take a comma or whitespace delimited list of servers."
complete -c $program -f -s N -l nodegroup -d "Instead of using shell globs to evaluate the target use one of the predefined nodegroups to identify a list of targets."
complete -c $program -f -s E -l pcre -d "Instead of using shell globs to evaluate the target servers, use pcre regular expressions"
complete -c $program -f -s R -l range -d "Instead of using shell globs to evaluate the target use a range expression to identify targets. Range expressions look like %cluster"
end
set -l salt_programs_user_daemon_pidfile \
salt-master salt-minion salt-syndic
for program in $salt_programs_user_daemon_pidfile
complete -c $program -x -s u -l user -d "Specify user to run $program"
complete -c $program -f -s d -l daemon -d "Run the $program as a daemon"
complete -c $program -l pid-file -d "Specify the location of the pidfile. Default: /var/run/$program.pid."
end
function __fish_salt_default_timeout
echo (echo $argv[1] | sed '
s/^salt$/5/g;
s/^salt-call$/60/g;
s/^salt-cp$/5/g;
s/^salt-run$/1/g
')
end
set -l salt_programs_timeout salt salt-call salt-cp \
salt-run
for program in $salt_programs_timeout
complete -c $program -x -s t -l timeout -d "Change the timeout, if applicable, for the running command; default="(__fish_salt_default_timeout $program)
end
set -l salt_programs_return salt salt-cp
for program in $salt_programs_return
complete -c $program -x -l return -d "Set an alternative return method. By default salt will send the return data from the command back to the master, but the return data can be redirected into any number of systems, databases or applications."
end
# convinience functions
function __fish_salt_log
echo $argv >&2
end
function __fish_salt_join
# remove empty elements
set a (echo $argv[2..-1] | sed 's/ /\n/g' | grep -Ev '^$')
set delimiter $argv[1]
printf "$delimiter%s" $a | cut -c 2-
end
function __fish_salt_clean_prefix
set prefix '^'$argv[1]
grep -E $prefix | sed "s/$prefix//g"
end
function __fish_salt_clean
if [ $argv[1] = yaml ]
__fish_salt_clean_prefix ' *- '
else if [ $argv[1] = nested ]
__fish_salt_clean_prefix ' *'
end
end
set -g __fish_salt_max_line_count_in_yaml_block 1024
function __fish_salt_lines_between
set max $__fish_salt_max_line_count_in_yaml_block
grep -A$max $argv[1] | grep -B$max $argv[2]
end
function __fish_salt_extract_first_yaml_block
set max $__fish_salt_max_line_count_in_yaml_block
sed '1d' | sed '$a\ stop' | grep -m 1 -B$max '^ \w' | sed '$d'
end
function __fish_salt_add_help
sed "s/\$/\t$argv/"
end
function __fish_salt_underscore_to_space
sed 's/^\w/\u&/g; s/_/ /g'
end
# information extraction from commandline
set -g __fish_salt_default_program 'salt'
# BUG: Completion doesn't work with correct commandline like
# salt --out raw server test.ping
# Consider rewriting using __fish_complete_subcommand
function __fish_salt_program
if status --is-interactive
set result (commandline -pco)
if test -n "$result"
if [ $result[1] = 'salt-call' ]; and contains -- '--local' $result
set options '--local'
end
set result $result[1] $options
end
end
set result $__fish_salt_default_program
echo $result
end
function __fish_salt_save_first_commandline_token_not_matching_args_to
if status --is-interactive
set -l cli (commandline -pco)
for i in $cli
if echo "$i" | grep -Ev (__fish_salt_join '|' $argv)
set -g $argv[1] $i
return 0
end
end
end
return 1
end
function __fish_salt_commandline_tokens_not_matching_args
if status --is-interactive
set tokens (commandline -pco)
set result 1
for token in $tokens
if echo "$token" | grep -Ev (__fish_salt_join '|' $argv)
set result 0
end
end
end
return $result
end
set __fish_salt_base_ignores (__fish_salt_join '|' $salt_programs '^-.*')
function __fish_salt_ignores_minion
echo $__fish_salt_base_ignores
end
function __fish_salt_extract_minion
__fish_salt_save_first_commandline_token_not_matching_args_to __fish_salt_extracted_minion (__fish_salt_ignores_minion)
end
function __fish_salt_minion
__fish_salt_extract_minion > /dev/null
echo $__fish_salt_extracted_minion
end
function __fish_salt_ignores_function
__fish_salt_join '|' $__fish_salt_base_ignores (__fish_salt_minion)
end
function __fish_salt_extract_function
__fish_salt_save_first_commandline_token_not_matching_args_to __fish_salt_extracted_function (__fish_salt_ignores_function)
end
function __fish_salt_function
__fish_salt_extract_function > /dev/null
echo $__fish_salt_extracted_function
end
function __fish_salt_ignores_args
__fish_salt_join '|' (__fish_salt_ignores_function) (__fish_salt_function)
end
function __fish_salt_args
__fish_salt_commandline_tokens_not_matching_args (__fish_salt_ignores_args)
end
set __fish_salt_arg_name_re '\w*='
function __fish_salt_arg_name
set result (commandline -ct | grep -E --only-matching $__fish_salt_arg_name_re)
if test -z $result
set result '_='
end
echo $result | sed 's/=$//g'
end
function __fish_salt_arg_value
commandline -ct | sed "s/$__fish_salt_arg_name_re//g"
end
function __fish_salt_arg_value_by_name
set arg_name "$argv="
__fish_salt_args | __fish_salt_clean_prefix $arg_name
end
# getting info from salt
set -g __fish_salt_format_options --no-color --log-level=quiet
function __fish_salt_exec
set -l program (__fish_salt_program)
set -l exe $program $__fish_salt_format_options $__fish_salt_format_options_temp
if [ $program = salt ]
set exe $exe (__fish_salt_minion)
end
eval $exe $argv
end
function __fish_salt_exec_output
set -g __fish_salt_format_options_temp "--output=$argv[1]"
__fish_salt_exec $argv[2..-1]
set -e __fish_salt_format_options_temp
end
function __fish_salt_exec_and_clean
__fish_salt_exec_output $argv | __fish_salt_clean $argv[1]
end
function __fish_salt_list
begin
for arg_type in $argv
set f_list '__fish_salt_list_'$arg_type
eval $f_list | __fish_salt_add_help (echo $arg_type | __fish_salt_underscore_to_space)
end
end
end
set -g __fish_salt_args_types '
_ cmd.retcode : minion_cmd
cmd cmd.retcode : minion_cmd
shell cmd.retcode : minion_file
_ cmd.run : minion_cmd
cmd cmd.run : minion_cmd
shell cmd.run : minion_file
_ cmd.run_all : minion_cmd
cmd cmd.run_all : minion_cmd
shell cmd.run_all : minion_file
_ cmd.run_stderr : minion_cmd
cmd cmd.run_stderr : minion_cmd
shell cmd.run_stderr : minion_file
_ cmd.run_stdout : minion_cmd
cmd cmd.run_stdout : minion_cmd
shell cmd.run_stdout : minion_file
shell cmd.script : minion_file
shell cmd.script_retcode : minion_file
_ cmd.which : minion_cmd
cmd cmd.which : minion_cmd
_ cp.get_dir : master_file
_ cp.get_dir : minion_file
path cp.get_dir : master_file
dest cp.get_dir : minion_file
_ cp.get_file : master_file
_ cp.get_file : minion_file
path cp.get_file : master_file
dest cp.get_file : minion_file
_ file.copy : minion_file
src file.copy : minion_file
dst file.copy : minion_file
_ grains.append : grain
key grains.append : grain
_ grains.delval : grain
key grains.delval : grain
_ grains.get : grain
key grains.get : grain
_ grains.get_or_set_hash : grain
name grains.get_or_set_hash : grain
_ grains.has_value : grain
key grains.has_value : grain
_ grains.item : grain
_ grains.items : grain
_ grains.remove : grain
key grains.remove : grain
_ grains.setval : grain
key grains.setval : grain
exclude state.highstate : state
_ state.sls : state
_ state.show_sls : state
_ state.sls : state
exclude state.sls : state
_ sys.argspec : function
_ sys.argspec : module
module sys.argspec : module
_ sys.doc : function
_ sys.doc : module
'
#_ pkg.remove : package
function __fish_salt_argspec_function
set function_line '^\s*'$argv[1]:
set max $__fish_salt_max_line_count_in_yaml_block
grep -A$max $function_line | __fish_salt_extract_first_yaml_block
end
function __fish_salt_argspec_args
__fish_salt_lines_between '^\s*args:' '^\s*defaults:' | grep -v ':'
end
function __fish_salt_list_arg_name
__fish_salt_exec_output yaml sys.argspec (__fish_salt_function) | __fish_salt_argspec_function (__fish_salt_function) | __fish_salt_argspec_args | __fish_salt_clean yaml | sed 's/$/=/g'
end
function __fish_salt_list_arg_value
set arg_path_re (__fish_salt_arg_name)'\s*'(__fish_salt_function)'\s*:\s*'
set arg_types (echo $__fish_salt_args_types | __fish_salt_clean_prefix $arg_path_re)
__fish_salt_list $arg_types
end
function __fish_salt_list_function
__fish_salt_exec_and_clean yaml sys.list_functions $argv
end
function __fish_salt_list_grain
__fish_salt_exec_and_clean yaml grains.ls $argv
end
function __fish_salt_list_master_file_abs
__fish_salt_exec_and_clean yaml cp.list_master
end
function __fish_salt_list_master_file
__fish_salt_list_master_file_abs | sed 's/^/salt:\/\//g'
end
function __fish_salt_list_minion
salt-key --no-color --list=$argv[1] | grep -Ev '^(Accepted|Unaccepted|Rejected) Keys:$'
end
function __fish_salt_list_minion_cmd
set cmd (__fish_salt_arg_value | sed 's/^[\'"]//')
set complete_cmd_exe '"complete --do-complete=\''$cmd'\'"'
set cmd_without_last_word (echo $cmd | sed -E 's/\S*$//')
# BUG: Static paths. Do we need to use which?
set bash_shell '/bin/bash'
set fish_shell '/usr/bin/fish'
set sh_shell '/bin/sh'
set zsh_shell '/usr/bin/zsh'
set shell (__fish_salt_arg_value_by_name shell); and test -z $shell; and set shell $sh_shell
switch $shell
case $fish_shell
__fish_salt_exec_and_clean nested cmd.run shell=$fish_shell cmd=$complete_cmd_exe | awk -v prefix="$cmd_without_last_word" '{print prefix $0}'
case $bash_shell $zsh_shell
# Not implemented; See
# https://github.com/fish-shell/fish-shell/issues/1679#issuecomment-55487388
case $sh_shell
# sh doesn't have completions
end
end
function __fish_salt_list_minion_file
if [ (count $argv) -eq 0 ]
set file (__fish_salt_arg_value)
else
set file $argv[1]
end
set exe '"ls --directory --file-type '$file'* 2> /dev/null"'
__fish_salt_exec_output nested cmd.run $exe | __fish_salt_clean nested
end
function __fish_salt_list_module
__fish_salt_exec_and_clean yaml sys.list_modules $argv
end
function __fish_salt_list_package
__fish_salt_exec_and_clean yaml pkg.list_pkgs $argv | sed 's/:.*//g'
end
function __fish_salt_list_state
__fish_salt_list_master_file_abs | grep '.sls' | sed 's/\//./g;s/\.init\.sls/.sls/g;s/\.sls//g'
end
function __fish_salt_prefix_with_arg_name
set arg_name (__fish_salt_arg_name)
if [ $arg_name != '_' ]
sed "p;s/^/$arg_name=/g"
else
# leave stdout as is; don't remove this line, because if construction
# clears stdout if condition fails
tee
end
end

View file

@ -0,0 +1,53 @@
/var/log/salt/master {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}
/var/log/salt/minion {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}
/var/log/salt/key {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}
/var/log/salt/api {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}
/var/log/salt/syndic {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}
/var/log/salt/proxy {
weekly
missingok
rotate 7
compress
notifempty
create 0640
}

View file

@ -0,0 +1 @@
import _salt_onedir_extras; _salt_onedir_extras.setup(__file__)

View file

@ -0,0 +1,18 @@
import pathlib
import sys
def setup(pth_file_path):
# Discover the extras-<py-major>.<py-minor> directory
extras_parent_path = pathlib.Path(pth_file_path).resolve().parent.parent
if not sys.platform.startswith("win"):
extras_parent_path = extras_parent_path.parent
extras_path = str(extras_parent_path / "extras-{}.{}".format(*sys.version_info))
if extras_path in sys.path and sys.path[0] != extras_path:
# The extras directory must come first
sys.path.remove(extras_path)
if extras_path not in sys.path:
sys.path.insert(0, extras_path)

View file

@ -0,0 +1,14 @@
[Unit]
Description=The Salt API
Documentation=man:salt-api(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
After=network.target
[Service]
Type=notify
NotifyAccess=all
LimitNOFILE=8192
ExecStart=/usr/bin/salt-api
TimeoutStopSec=3
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,10 @@
description "Salt API"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
script
exec salt-api
end script

View file

@ -0,0 +1,13 @@
[Unit]
Description=The Salt Master Server
Documentation=man:salt-master(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
After=network.target
[Service]
LimitNOFILE=100000
Type=notify
NotifyAccess=all
ExecStart=/usr/bin/salt-master
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,17 @@
description "Salt Master"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
limit nofile 100000 100000
script
# Read configuration variable file if it is present
[ -f /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
# Activate the virtualenv if defined
[ -f $SALT_USE_VIRTUALENV/bin/activate ] && . $SALT_USE_VIRTUALENV/bin/activate
exec salt-master
end script

View file

@ -0,0 +1,14 @@
[Unit]
Description=The Salt Minion
Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
After=network.target salt-master.service
[Service]
KillMode=process
Type=notify
NotifyAccess=all
LimitNOFILE=8192
ExecStart=/usr/bin/salt-minion
[Install]
WantedBy=multi-user.target

16
pkg/common/salt-minion.sleep Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
markerfile=/var/run/stopped-salt-minion-on-suspend
if [ "$1" = pre ] ; then
if systemctl is-active salt-minion ; then
systemctl stop salt-minion
echo 1 > $markerfile
fi
fi
if [ "$1" = post ] && [ -e $markerfile ] ; then
rm -f $markerfile
systemctl start salt-minion
fi

View file

@ -0,0 +1,23 @@
description "Salt Minion"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
# The respawn in the minion is known to cause problems
# because if the main minion process dies it has done
# so most likely for a good reason. Uncomment these
# two lines to enable respawn
#respawn
#respawn limit 10 5
script
# Read configuration variable file if it is present
[ -f /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
# Activate the virtualenv if defined
[ -f $SALT_USE_VIRTUALENV/bin/activate ] && . $SALT_USE_VIRTUALENV/bin/activate
exec salt-minion
end script

View file

@ -0,0 +1,13 @@
[Unit]
Description=salt-proxy service for %i
Documentation=man:salt-proxy(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
After=network.target
[Service]
ExecStart=/usr/bin/salt-proxy --proxyid=%i
Type=simple
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,14 @@
[Unit]
Description=The Salt Master Server
Documentation=man:salt-syndic(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltproject.io/en/latest/contents.html
After=network.target
PartOf=salt-master.service
[Service]
Type=notify
NotifyAccess=all
LimitNOFILE=8192
ExecStart=/usr/bin/salt-syndic
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,16 @@
description "salt-syndic"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
script
# Read configuration variable file if it is present
[ -f /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
# Activate the virtualenv if defined
[ -f $SALT_USE_VIRTUALENV/bin/activate ] && . $SALT_USE_VIRTUALENV/bin/activate
exec salt-syndic
end script

55
pkg/common/salt.postrm Normal file
View file

@ -0,0 +1,55 @@
#!/bin/sh -e
# Purge config files, logs, and directories created after package install.
# Note that user-specified alternate locations for these are not affected.
#
# rename to salt-'common|master|minion|syndic'.postrm and call with "purge"
clean_common() {
# remove shared job cache and other runtime directories
rm -rf \
/var/cache/salt \
/var/log/salt \
/var/run/salt \
2> /dev/null
}
clean_conf() {
# remove config and log file for master, minion, or syndic
rm -rf \
/etc/salt/pki/$1 \
/var/cache/salt/$1 \
/var/log/salt/$1 \
/var/run/salt/$1 \
2> /dev/null
}
purgefiles() {
case "$pkg" in
master|minion|syndic)
clean_conf $pkg ;;
common)
clean_common ;;
*)
echo "$0 unknown package \`$1'" 1>&2
exit 1 ;;
esac
}
pkg=`echo $0 | cut -f1 -d. | cut -f2 -d-`
case "$1" in
remove)
;;
purge)
purgefiles
;;
upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
;;
*)
echo "$0 unknown action \`$1'" 1>&2
exit 1 ;;
esac
# This tag is required:
#DEBHELPER#
exit 0

6
pkg/common/salt.ufw Normal file
View file

@ -0,0 +1,6 @@
# Install into /etc/ufw/applications.d/ and run 'ufw app update' to add salt
# firewall rules to systems with UFW. Activate with 'ufw allow salt'
[Salt]
title=salt
description=fast and powerful configuration management and remote execution
ports=4505,4506/tcp

279
pkg/common/salt.zsh Normal file
View file

@ -0,0 +1,279 @@
#compdef salt salt-call salt-cp salt-run salt-key
# The use-cache style is checked in a few places to allow caching minions, modules,
# or the directory salt is installed in.
# you can cache those three with:
# zstyle ':completion:*:salt(|-cp|-call|-run|-key):*' use-cache true
# and/or selectively:
# zstyle ':completion::complete:salt-key:set-option-a-1:' use-cache false
# zstyle ':completion::complete:salt(|-cp|-call):minions:' use-cache true
# zstyle ':completion::complete:salt(|-call):modules:' use-cache true
# zstyle ':completion::complete:salt(|-cp|-call|-run|-key):salt_dir:' use-cache true
#
# cache validation can be controlled with the style cache-ttl.
# it expects two arguments: number (days|hours|weeks|months)
# to invalidate the minion cache after four days:
# zstyle ':completion::complete:salt(|-cp|-call):minions:' cache-ttl 4 days
local state line curcontext="$curcontext" salt_dir
_modules(){
local _funcs expl curcontext=${curcontext%:*}:modules
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/modules || ! _retrieve_cache salt/modules; then
_funcs=( ${${(Q)${${${(s. .)"$(_call_program salt-call-cmd salt-call --local --log-level error --out txt sys.list_functions)"}%%[],]##}#\[#u}#\[}:#local:} )
_store_cache salt/modules _funcs
fi
_wanted modules expl modules _multi_parts "$@" . _funcs
}
_runners(){
local _runs expl curcontext=${curcontext%:*}:runners
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/runners || ! _retrieve_cache salt/runners; then
_runs=( ${${(Q)${${${(s. .)"$(_call_program salt-call-cmd salt-call --local --log-level error --out txt sys.list_runner_functions)"}%%[],]##}#\[#u}#\[}:#local:} )
_store_cache salt/runners _runs
fi
_wanted modules expl runners _multi_parts "$@" . _runs
}
_minions(){
local type requested_type include_all key expl; typeset -A _peons
# when completing the minion argument for salt and salt-cp, set the argument section
# of the context to `minion' not `argument-1'
if [[ $service = salt(|-cp) ]]; then
curcontext=${curcontext%:*}:minions
fi
# only pass the argument accepted, unaccepted, rejected, denied or all to -t/-T
# the argument is used as part of an tag, accepted-minions, rejected-minions, etc.
# while un, acc, den, etc will work, you will possibly ignore user customized tags.
zparseopts -D -E 't+:=requested_type' 'T+:=include_all'
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/minions || ! _retrieve_cache salt/minions; then
# it would be awesome if salt-key could prefix or suffix a word to denote
# the key's state. It would remove the need for this loop, calling salt-key N times.
for type in accepted unaccepted rejected denied; do
salt-key -l $type 2>/dev/null | while read -r key; do
[[ $key == *' Keys:' ]] && continue
_peons+=( "$key" $type )
done
done
_store_cache salt/minions _peons
fi
# if salt-key's --include-all option isn't on the line, ignore the -T options
(( words[(I)--include-all] )) || unset include_all
if (( requested_type[(I)all] )); then
requested_type=( -t accepted -t unaccepted -t rejected -t denied )
unset include_all
fi
for type in ${${requested_type:#-t}:-accepted} ${include_all:#-T}; do
_wanted $type-minions expl minion compadd "$@" -M 'r:|.=* r:|=*' ${(k)_peons[(R)$~type]}
done
}
(( $+functions[_salt_caching_policy] )) ||
_salt_caching_policy() {
local oldp ttl d t
zstyle -a ":completion:$curcontext:" cache-ttl ttl
if (( $#ttl >= 2 )); then
[[ $ttl[1] == <-> ]] && integer t=$ttl[1]
case $ttl[2] in
seconds#)d=s;;
months#) d=M;;
weeks#) d=w;;
hours#) d=h;;
*) d=d;;
esac
fi
oldp=( "$1"(Nm${d:-d}+${t:-1}) )
(( $#oldp ))
}
local -a _{target,master,logging,minion}_options _{common,out}_opts _target_opt_pat
_target_opt_pat=(
'(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
'(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
)
_target_options=(
"$_target_opt_pat[2]"{-E,--pcre}'[use pcre regular expressions]:pcre:'
"$_target_opt_pat[2]"{-L,--list}'[take a comma or whitespace delimited list of servers.]:list:'
"$_target_opt_pat[2]"{-G,--grain}'[use a grain value to identify targets]:Grains:'
"$_target_opt_pat[2]--grain-pcre[use a grain value to identify targets.]:pcre:"
"$_target_opt_pat[2]"{-N,--nodegroup}'[use one of the predefined nodegroups to identify a list of targets.]:Nodegroup:'
"$_target_opt_pat[2]"{-R,--range}'[use a range expression to identify targets.]:Range:'
"$_target_opt_pat[2]"{-C,--compound}'[Use multiple targeting options.]:Compound:'
"$_target_opt_pat[2]"{-I,--pillar}'[use a pillar value to identify targets.]:Pillar:'
"$_target_opt_pat[2]"{-S,--ipcidr}'[Match based on Subnet (CIDR notation) or IPv4 address.]:Cidr:'
)
_common_opts=(
"--version[show program's version number and exit]"
"--versions-report[show program's dependencies version number and exit]"
'(-h --help)'{-h,--help}'[show this help message and exit]'
'(-c --config-dir)'{-c,--config-dir}'[Pass in an alternative configuration directory.(default: /etc/salt/)]:Config Directory:_files -/'
'(-t --timeout)'{-t,--timeout}'[Change the timeout for the running command; default=5]:Timeout (seconds):'
)
_master_options=(
'(-s --static)'{-s,--static}'[Return the data from minions as a group after they all return.]'
"--async[Run the salt command but don't wait for a reply]"
'(--state-output --state_output)'{--state-output,--state_output}'[Override the configured state_output value for minion output. Default: full]:Outputs:(full terse mixed changes)'
'--subset[Execute the routine on a random subset of the targeted minions]:Subset:'
'(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]'
'--hide-timeout[Hide minions that timeout]'
'(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:'
'(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:'
'(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]'
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'--args-separator[Set the special argument used as a delimiter between command arguments of compound commands.]:Arg separator:'
)
_minion_options=(
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir"/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'(-g --grains)'{-g,--grains}'[Return the information generated by the salt grains]'
{*-m,*--module-dirs}'[Specify an additional directory to pull modules from.]:Module Dirs:_files -/'
'--master[Specify the master to use.]:Master:'
'--local[Run salt-call locally, as if there was no master running.]'
'--file-root[Set this directory as the base file root.]:File Root:_files -/'
'--pillar-root[Set this directory as the base pillar root.]:Pillar Root:_files -/'
'--retcode-passthrough[Exit with the salt call retcode and not the salt binary retcode]'
'--id[Specify the minion id to use.]:Minion ID:'
'--skip-grains[Do not load grains.]'
'--refresh-grains-cache[Force a refresh of the grains cache]'
)
_runner_options=(
'--hard-crash[raise any original exception rather than exiting gracefully]'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
)
_key_options=(
'(-u --user)'{-u+,--user=}'[specify user to run salt-key]:user:_users'
'--hard-crash[raise any original exception rather than exiting gracefully]'
'(-q --quiet)'{-q,--quiet}'[quiet mode]'
'(-y --yes)'{-y,--yes}'[assume yes]'
'--rotate-aes-key[prevents the master from refreshing the key session when keys are deleted or rejected]:boolean:(true false)'
'--gen-keys=[set a name to generate a keypair for use with salt]:key name'
'--gen-keys-dir=[set the directory to save the generated keypair]: : _directories'
'--keysize=[set the size for keypair]:key size'
'--gen-signature[create a signature file of the masters public-key]'
'--priv=[the private-key file to create a signature with]:private key:_files'
'--signature-path=[the path where the signature file should be written]: : _directories'
'--pub=[the public-key file to create a signature for]:public key:_files'
'--auto-create[auto-create a signing key-pair if it does not yet exist]'
'--include-all[include non-pending keys when accepting/rejecting]'
- '(set)'
{-l+,--list=}'[list public keys]:key type:((
preaccepted\:"unaccepted/unsigned keys" unaccepted\:"unaccepted/unsigned keys" un\:"unaccepted/unsigned keys"
accepted\:"accepted/signed keys" acc\:"accepted/signed keys"
rejected\:"rejected keys" rej\:"rejected keys"
den\:"denied keys" denied\:"denied keys" all
))'
{-a+,--accept=}'[accept key]:key:_minions -t unaccepted -T rejected'
{-A,--accept-all}'[accept all keys]'
{-r+,--reject=}'[reject key]:key:_minions -t rejected -T accepted'
{-p+,--print=}'[print the specified public key]:key:_minions -t all'
{-P,--print-all}'[print all public keys]'
{-d+,--delete=}'[delete the specified public key]:key:_minions -t all'
{-D,--delete-all}'[delete all public keys]'
{-f+,--finger=}'[print the specified key'\''s fingerprint]:key:_minions -t all'
{-F,--finger-all}'[print the fingerprint of all keys]'
)
_logging_options=(
'(-l --log-level)'{-l,--log-level}'[Console logging log level.(default: warning)]:Log Level:(all garbage trace debug info warning error critical quiet)'
'--log-file[Log file path. Default: /var/log/salt/master.]:Log File:_files'
'--log-file-level=[Logfile logging log level.Default: warning]:Log Level:(all garbage trace debug info warning error critical quiet)'
)
_out_opts=(
'(--out --output)'{--out,--output}'[Print the output using the specified outputter.]:Outputters:_path_files -W "$salt_dir/output" -g "[^_]*.py(\:r)"'
'(--out-indent --output-indent)'{--out-indent,--output-indent}'[Print the output indented by the provided value in spaces.]:Number:'
'(--out-file --output-file)'{--out-file,--output-file}'[Write the output to the specified file]:Output File:_files'
'(--no-color --no-colour)'{--no-color,--no-colour}'[Disable all colored output]'
'(--force-color --force-colour)'{--force-color,--force-colour}'[Force colored output]'
)
_salt_comp(){
case "$service" in
salt)
_arguments -C \
"${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
':modules:_modules' \
"$_target_options[@]" \
"$_common_opts[@]" \
"$_master_options[@]" \
"$_logging_options[@]" \
"$_out_opts[@]"
;;
salt-call)
_arguments -C \
':modules:_modules' \
"$_minion_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]" \
"$_out_opts[@]"
;;
salt-cp)
_arguments -C \
"${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
"$_target_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]" \
':Source File:_files' \
':Destination File:_files'
;;
salt-run)
_arguments -C \
":runners:_runners" \
"$_runner_options[@]" \
"$_common_opts[@]" \
"$_logging_options[@]"
;;
salt-key)
_arguments -C \
"$_key_options[@]" \
"${_common_opts[@]:#'-t --timeout\)'*}" \
"${_logging_options[@]:#'(-l --log-level)'*}"
;;
esac
}
() {
local curcontext=${curcontext%:*}:salt_dir
if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
_store_cache salt/salt_dir salt_dir
fi
}
_salt_comp "$@"

1912
pkg/debian/changelog Normal file

File diff suppressed because it is too large Load diff

1
pkg/debian/compat Normal file
View file

@ -0,0 +1 @@
10

182
pkg/debian/control Normal file
View file

@ -0,0 +1,182 @@
Source: salt
Section: admin
Priority: optional
Maintainer: Debian Salt Team <pkg-salt-team@lists.alioth.debian.org>
Uploaders: Joe Healy <joehealy@gmail.com>,
Franklin G Mendoza <franklin.g.mendoza@gmail.com>,
Andriy Senkovych <jolly_roger@itblog.org.ua>,
David Murphy <dmurphy@saltstack.com>
Build-Depends: bash-completion,
debhelper (>= 10)
Standards-Version: 4.1.3
Homepage: http://saltproject.io/
Vcs-Browser: https://github.com/saltstack/salt.git
Vcs-Git: git://github.com/saltstack/salt.git
Package: salt-dbg
Architecture: amd64 arm64
Section: debug
Priority: extra
Homepage: http://saltproject.io/
Description: Salt debug symbols
Package: salt-common
Architecture: amd64 arm64
Depends: ${misc:Depends}
Breaks: salt-minion (<= 3006.4)
Suggests: ifupdown
Recommends: lsb-release
Description: shared libraries that salt requires for all packages
salt is a powerful remote execution manager that can be used to
administer servers in a fast and efficient way.
.
It allows commands to be executed across large groups of
servers. This means systems can be easily managed, but data can
also be easily gathered. Quick introspection into running
systems becomes a reality.
.
Remote execution is usually used to set up a certain state on a
remote system. Salt addresses this problem as well, the salt
state system uses salt state files to define the state a server
needs to be in.
.
Between the remote execution system, and state management Salt
addresses the backbone of cloud and data center management.
.
This particular package provides shared libraries that
salt-master, salt-minion, and salt-syndic require to function.
Package: salt-master
Architecture: amd64 arm64
Replaces: salt-common (<= 3006.4)
Breaks: salt-common (<= 3006.4)
Depends: salt-common (= ${source:Version}),
${misc:Depends}
Description: remote manager to administer servers via salt
salt is a powerful remote execution manager that can be used to
administer servers in a fast and efficient way.
.
It allows commands to be executed across large groups of
servers. This means systems can be easily managed, but data can
also be easily gathered. Quick introspection into running
systems becomes a reality.
.
Remote execution is usually used to set up a certain state on a
remote system. Salt addresses this problem as well, the salt
state system uses salt state files to define the state a server
needs to be in.
.
Between the remote execution system, and state management Salt
addresses the backbone of cloud and data center management.
.
This particular package provides the salt controller.
Package: salt-minion
Architecture: amd64 arm64
Replaces: salt-common (<= 3006.4)
Breaks: salt-common (<= 3006.4)
Depends: bsdmainutils,
dctrl-tools,
salt-common (= ${source:Version}),
${misc:Depends}
Recommends: debconf-utils, dmidecode, net-tools
Description: client package for salt, the distributed remote execution system
salt is a powerful remote execution manager that can be used to
administer servers in a fast and efficient way.
.
It allows commands to be executed across large groups of
servers. This means systems can be easily managed, but data can
also be easily gathered. Quick introspection into running
systems becomes a reality.
.
Remote execution is usually used to set up a certain state on a
remote system. Salt addresses this problem as well, the salt
state system uses salt state files to define the state a server
needs to be in.
.
Between the remote execution system, and state management Salt
addresses the backbone of cloud and data center management.
.
This particular package provides the worker / agent for salt.
Package: salt-syndic
Architecture: amd64 arm64
Depends: salt-master (= ${source:Version}),
${misc:Depends}
Description: master-of-masters for salt, the distributed remote execution system
salt is a powerful remote execution manager that can be used to
administer servers in a fast and efficient way.
.
It allows commands to be executed across large groups of
servers. This means systems can be easily managed, but data can
also be easily gathered. Quick introspection into running
systems becomes a reality.
.
Remote execution is usually used to set up a certain state on a
remote system. Salt addresses this problem as well, the salt
state system uses salt state files to define the state a server
needs to be in.
.
Between the remote execution system, and state management Salt
addresses the backbone of cloud and data center management.
.
This particular package provides the master of masters for salt
- it enables the management of multiple masters at a time.
Package: salt-ssh
Architecture: amd64 arm64
Breaks: salt-common (<= 3006.4)
Depends: salt-common (= ${source:Version}),
openssh-client,
${misc:Depends}
Description: remote manager to administer servers via Salt SSH
salt is a powerful remote execution manager that can be used to
administer servers in a fast and efficient way.
.
It allows commands to be executed across large groups of
servers. This means systems can be easily managed, but data can
also be easily gathered. Quick introspection into running
systems becomes a reality.
.
Remote execution is usually used to set up a certain state on a
remote system. Salt addresses this problem as well, the salt
state system uses salt state files to define the state a server
needs to be in.
.
Between the remote execution system, and state management Salt
addresses the backbone of cloud and data center management.
.
This particular package provides the salt ssh controller. It
is able to run salt modules and states on remote hosts via ssh.
No minion or other salt specific software needs to be installed
on the remote host.
Package: salt-cloud
Architecture: amd64 arm64
Breaks: salt-common (<= 3006.4)
Depends: salt-common (= ${source:Version}),
${misc:Depends}
Description: public cloud VM management system
provision virtual machines on various public clouds via a cleanly
controlled profile and mapping system.
Package: salt-api
Architecture: amd64 arm64
Depends: salt-master,
${misc:Depends}
Description: Generic, modular network access system
a modular interface on top of Salt that can provide a variety of entry points
into a running Salt system. It can start and manage multiple interfaces
allowing a REST API to coexist with XMLRPC or even a Websocket API.
.
The Salt API system is used to expose the fundamental aspects of Salt control
to external sources. salt-api acts as the bridge between Salt itself and
REST, Websockets, etc.

485
pkg/debian/copyright Normal file
View file

@ -0,0 +1,485 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: salt
Upstream-Contact: salt-users@googlegroups.com
Source: https://github.com/saltstack/salt
The relationship between source and minified js libraries is not clear in
the upstream sources. The debian/repack script repacks the archive to make
this clear.
Files: *
Copyright: 2013 SaltStack Team
License: Apache-2.0
Files: debian/*
Copyright: 2013 Joe Healy <joehealy@gmail.com>
2012 Michael Prokop <mika@debian.org>
2012 Christian Hofstaedtler <christian@hofstaedtler.name>
2012 Ulrich Dangel <mru@spamt.net>
2012 Corey Quinn <corey@sequestered.net>
2011 Aaron Toponce <aaron.toponce@gmail.com>
License: Apache-2.0
Files: debian/repack
Copyright: 2013-2014 Ben Finney <ben+debian@benfinney.id.au>
License: MIT-License
Files: salt/auth/pam.py
Copyright: 2007 Chris AtLee <chris@atlee.ca>
License: MIT-License
Files: salt/utils/ipaddr.py
Copyright: 2007 Google Inc.
License: Apache-2.0
Files: salt/cloud/clouds/gce.py
Copyright: 2013 Google Inc. All Rights Reserved
License: Apache-2.0
Files: doc/_ext/youtube.py
Copyright: 2009 Chris Pickel <sfiera@gmail.com>
License: BSD-2-clause
Files: doc/_static/book_open.png
doc/_static/film_link.png
doc/_static/page_white_acrobat.png
Copyright: Mark James of <http://famfamfam.com/>
License: CC-BY-3.0
Files: doc/_themes/saltstack/static/img/glyphicons-halflings-white.png
doc/_themes/saltstack/static/img/glyphicons-halflings.png
Copyright: 2010-2012 Jan Kovarik <glyphicons@gmail.com>
License: CC-BY-3.0
Files: doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js
Copyright: 2005-2012 jQuery Foundation, Inc and other contributors
License: MIT-License
Files: doc/_themes/saltstack/static/js/vendor/modernizr.custom.20463.js
doc/_themes/saltstack/static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js
Copyright: © 2009-2012, Faruk Ates
© 2009-2012, Paul Irish
© 2009-2012, Alex Sexton
Ralph Holzmann, ralphholzmann[at]gmail.com
License: MIT-License and BSD-2-clause, and WTFPL or MIT-License or BSD-2-clause
Comment: Files include yepnope1.5.4 which is authored by Alex Sexton
and Ralph Holzmann.
Files: doc/_themes/saltstack/static/css/bootstrap.css
doc/_themes/saltstack/static/css/bootstrap.min.css
doc/_themes/saltstack/static/css/bootstrap-responsive.css
doc/_themes/saltstack/static/css/bootstrap-responsive.min.css
Copyright: 2011-2012 Twitter, Inc.
License: Apache-2.0
Files: pkg/ebuild/salt-0.7.0.ebuild
pkg/ebuild/salt-0.8.7.ebuild
Copyright: 1999-2011 Gentoo Foundation
License: GPL-2
Files: pkg/suse/salt.spec
Copyright: 2013 SUSE LINUX Products GmbH, Nuernberg, Germany
License: Apache-2.0
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache License, Version 2.0 can be
found in the file
`/usr/share/common-licenses/Apache-2.0'.
License: BSD-2-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: CC-BY-3.0
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK
OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED.
.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS
LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE
RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS
AND CONDITIONS.
.
1. Definitions
.
1. "Adaptation" means a work based upon the Work, or upon the Work
and other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and
includes cinematographic adaptations or any other form in which
the Work may be recast, transformed, or adapted including in any
form recognizably derived from the original, except that a work
that constitutes a Collection will not be considered an Adaptation
for the purpose of this License. For the avoidance of doubt, where
the Work is a musical work, performance or phonogram, the
synchronization of the Work in timed-relation with a moving image
("synching") will be considered an Adaptation for the purpose of
this License.
2. "Collection" means a collection of literary or artistic works,
such as encyclopedias and anthologies, or performances, phonograms
or broadcasts, or other works or subject matter other than works
listed in Section 1(f) below, which, by reason of the selection
and arrangement of their contents, constitute intellectual
creations, in which the Work is included in its entirety in
unmodified form along with one or more other contributions, each
constituting separate and independent works in themselves, which
together are assembled into a collective whole. A work that
constitutes a Collection will not be considered an Adaptation (as
defined above) for the purposes of this License.
3. "Distribute" means to make available to the public the original
and copies of the Work or Adaptation, as appropriate, through sale
or other transfer of ownership.
4. "Licensor" means the individual, individuals, entity or entities
that offer(s) the Work under the terms of this License.
5. "Original Author" means, in the case of a literary or artistic
work, the individual, individuals, entity or entities who created
the Work or if no individual or entity can be identified, the
publisher; and in addition (i) in the case of a performance the
actors, singers, musicians, dancers, and other persons who act,
sing, deliver, declaim, play in, interpret or otherwise perform
literary or artistic works or expressions of folklore; (ii) in the
case of a phonogram the producer being the person or legal entity
who first fixes the sounds of a performance or other sounds; and,
(iii) in the case of broadcasts, the organization that transmits
the broadcast.
6. "Work" means the literary and/or artistic work offered under the
terms of this License including without limitation any production
in the literary, scientific and artistic domain, whatever may be
the mode or form of its expression including digital form, such as
a book, pamphlet and other writing; a lecture, address, sermon or
other work of the same nature; a dramatic or dramatico-musical
work; a choreographic work or entertainment in dumb show; a
musical composition with or without words; a cinematographic work
to which are assimilated works expressed by a process analogous to
cinematography; a work of drawing, painting, architecture,
sculpture, engraving or lithography; a photographic work to which
are assimilated works expressed by a process analogous to
photography; a work of applied art; an illustration, map, plan,
sketch or three-dimensional work relative to geography,
topography, architecture or science; a performance; a broadcast; a
phonogram; a compilation of data to the extent it is protected as
a copyrightable work; or a work performed by a variety or circus
performer to the extent it is not otherwise considered a literary
or artistic work.
7. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License
with respect to the Work, or who has received express permission
from the Licensor to exercise rights under this License despite a
previous violation.
8. "Publicly Perform" means to perform public recitations of the Work
and to communicate to the public those public recitations, by any
means or process, including by wire or wireless means or public
digital performances; to make available to the public Works in
such a way that members of the public may access these Works from
a place and at a place individually chosen by them; to perform the
Work to the public by any means or process and the communication
to the public of the performances of the Work, including by public
digital performance; to broadcast and rebroadcast the Work by any
means including signs, sounds or images.
9. "Reproduce" means to make copies of the Work by any means
including without limitation by sound or visual recordings and the
right of fixation and reproducing fixations of the Work, including
storage of a protected performance or phonogram in digital form or
other electronic medium.
.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising
from limitations or exceptions that are provided for in connection
with the copyright protection under copyright law or other
applicable laws.
.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
.
1. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
2. to create and Reproduce Adaptations provided that any such
Adaptation, including any translation in any medium, takes
reasonable steps to clearly label, demarcate or otherwise identify
that changes were made to the original Work. For example, a
translation could be marked "The original work was translated from
English to Spanish," or a modification could indicate "The
original work has been modified.";
3. to Distribute and Publicly Perform the Work including as
incorporated in Collections; and,
4. to Distribute and Publicly Perform Adaptations.
5.
.
For the avoidance of doubt:
1. Non-waivable Compulsory License Schemes. In those
jurisdictions in which the right to collect royalties
through any statutory or compulsory licensing scheme cannot
be waived, the Licensor reserves the exclusive right to
collect such royalties for any exercise by You of the rights
granted under this License;
2. Waivable Compulsory License Schemes. In those jurisdictions
in which the right to collect royalties through any
statutory or compulsory licensing scheme can be waived, the
Licensor waives the exclusive right to collect such
royalties for any exercise by You of the rights granted
under this License; and,
3. Voluntary License Schemes. The Licensor waives the right to
collect royalties, whether individually or, in the event
that the Licensor is a member of a collecting society that
administers voluntary licensing schemes, via that society,
from any exercise by You of the rights granted under this
License.
.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights
in other media and formats. Subject to Section 8(f), all rights not
expressly granted by Licensor are hereby reserved.
.
4. Restrictions. The license granted in Section 3 above is expressly
made subject to and limited by the following restrictions:
.
1. You may Distribute or Publicly Perform the Work only under the
terms of this License. You must include a copy of, or the Uniform
Resource Identifier (URI) for, this License with every copy of the
Work You Distribute or Publicly Perform. You may not offer or
impose any terms on the Work that restrict the terms of this
License or the ability of the recipient of the Work to exercise
the rights granted to that recipient under the terms of the
License. You may not sublicense the Work. You must keep intact all
notices that refer to this License and to the disclaimer of
warranties with every copy of the Work You Distribute or Publicly
Perform. When You Distribute or Publicly Perform the Work, You may
not impose any effective technological measures on the Work that
restrict the ability of a recipient of the Work from You to
exercise the rights granted to that recipient under the terms of
the License. This Section 4(a) applies to the Work as incorporated
in a Collection, but this does not require the Collection apart
from the Work itself to be made subject to the terms of this
License. If You create a Collection, upon notice from any Licensor
You must, to the extent practicable, remove from the Collection
any credit as required by Section 4(b), as requested. If You
create an Adaptation, upon notice from any Licensor You must, to
the extent practicable, remove from the Adaptation any credit as
required by Section 4(b), as requested.
2. If You Distribute, or Publicly Perform the Work or any Adaptations
or Collections, You must, unless a request has been made pursuant
to Section 4(a), keep intact all copyright notices for the Work
and provide, reasonable to the medium or means You are utilizing:
(i) the name of the Original Author (or pseudonym, if applicable)
if supplied, and/or if the Original Author and/or Licensor
designate another party or parties (e.g., a sponsor institute,
publishing entity, journal) for attribution ("Attribution
Parties") in Licensor's copyright notice, terms of service or by
other reasonable means, the name of such party or parties; (ii)
the title of the Work if supplied; (iii) to the extent reasonably
practicable, the URI, if any, that Licensor specifies to be
associated with the Work, unless such URI does not refer to the
copyright notice or licensing information for the Work; and (iv) ,
consistent with Section 3(b), in the case of an Adaptation, a
credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or
"Screenplay based on original Work by Original Author"). The
credit required by this Section 4 (b) may be implemented in any
reasonable manner; provided, however, that in the case of a
Adaptation or Collection, at a minimum such credit will appear,
if a credit for all contributing authors of the Adaptation or
Collection appears, then as part of these credits and in a manner
at least as prominent as the credits for the other contributing
authors. For the avoidance of doubt, You may only use the credit
required by this Section for the purpose of attribution in the
manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original
Author, Licensor and/or Attribution Parties, as appropriate, of
You or Your use of the Work, without the separate, express prior
written permission of the Original Author, Licensor and/or
Attribution Parties.
3. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce,
Distribute or Publicly Perform the Work either by itself or as
part of any Adaptations or Collections, You must not distort,
mutilate, modify or take other derogatory action in relation to
the Work which would be prejudicial to the Original Author's honor
or reputation. Licensor agrees that in those jurisdictions (e.g.
Japan), in which any exercise of the right granted in Section 3(b)
of this License (the right to make Adaptations) would be deemed to
be a distortion, mutilation, modification or other derogatory
action prejudicial to the Original Author's honor and reputation,
the Licensor will waive or not assert, as appropriate, this
Section, to the fullest extent permitted by the applicable
national law, to enable You to reasonably exercise Your right
under Section 3(b) of this License (right to make Adaptations) but
not otherwise.
.
5. Representations, Warranties and Disclaimer
.
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF
ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW
THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO
YOU.
.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY
FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY
DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF
LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
.
7. Termination
.
1. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or
Collections from You under this License, however, will not have
their licenses terminated provided such individuals or entities
remain in full compliance with those licenses. Sections 1, 2, 5,
6, 7, and 8 will survive any termination of this License.
2. Subject to the above terms and conditions, the license granted
here is perpetual (for the duration of the applicable copyright in
the Work). Notwithstanding the above, Licensor reserves the right
to release the Work under different license terms or to stop
distributing the Work at any time; provided, however that any such
election will not serve to withdraw this License (or any other
license that has been, or is required to be, granted under the
terms of this License), and this License will continue in full
force and effect unless terminated as stated above.
.
8. Miscellaneous
.
1. Each time You Distribute or Publicly Perform the Work or a
Collection, the Licensor offers to the recipient a license to the
Work on the same terms and conditions as the license granted to
You under this License.
2. Each time You Distribute or Publicly Perform an Adaptation,
Licensor offers to the recipient a license to the original Work on
the same terms and conditions as the license granted to You under
this License.
3. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability
of the remainder of the terms of this License, and without further
action by the parties to this agreement, such provision shall be
reformed to the minimum extent necessary to make such provision
valid and enforceable.
4. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in
writing and signed by the party to be charged with such waiver or
consent.
5. This License constitutes the entire agreement between the parties
with respect to the Work licensed here. There are no
understandings, agreements or representations with respect to the
Work not specified here. Licensor shall not be bound by any
additional provisions that may appear in any communication from
You. This License may not be modified without the mutual written
agreement of the Licensor and You.
6. The rights granted under, and the subject matter referenced, in
this License were drafted utilizing the terminology of the Berne
Convention for the Protection of Literary and Artistic Works (as
amended on September 28, 1979), the Rome Convention of 1961, the
WIPO Copyright Treaty of 1996, the WIPO Performances and
Phonograms Treaty of 1996 and the Universal Copyright Convention
(as revised on July 24, 1971). These rights and subject matter
take effect in the relevant jurisdiction in which the License
terms are sought to be enforced according to the corresponding
provisions of the implementation of those treaty provisions in the
applicable national law. If the standard suite of rights granted
under applicable copyright law includes additional rights not
granted under this License, such additional rights are deemed to
be included in the License; this License is not intended to
restrict the license of any rights under applicable law.
License: GPL-2
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.
License: MIT-License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
License: WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
.
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
.
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
.
0. You just DO WHAT THE FUCK YOU WANT TO.

64
pkg/debian/rules Executable file
View file

@ -0,0 +1,64 @@
#!/usr/bin/make -f
DH_VERBOSE = 1
.PHONY: override_dh_strip
%:
dh $@ --with bash-completion,systemd
# dh_auto_clean tries to invoke distutils causing failures.
override_dh_auto_clean:
rm -rf build
rm -rf debian/salt-common
rm -rf debian/salt-minion
rm -rf debian/salt-master
rm -rf debian/salt-syndic
rm -rf debian/salt-ssh
ifeq ("${SALT_ONEDIR_ARCHIVE}", "")
override_dh_auto_build:
export FETCH_RELENV_VERSION=$${SALT_RELENV_VERSION}
mkdir -p build/onedir
python3 -m venv --clear --copies build/onedir/venv
build/onedir/venv/bin/python3 -m pip install relenv==$${SALT_RELENV_VERSION}
export FETCH_RELENV_VERSION=$${SALT_RELENV_VERSION}
export PY=$$(build/onedir/venv/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
&& build/onedir/venv/bin/python3 -m pip install -r requirements/static/ci/py$${PY}/tools.txt
build/onedir/venv/bin/relenv fetch --python=$${SALT_PYTHON_VERSION}
build/onedir/venv/bin/relenv toolchain fetch
build/onedir/venv/bin/tools pkg build onedir-dependencies --arch $${SALT_PACKAGE_ARCH} --relenv-version=$${SALT_RELENV_VERSION} --python-version $${SALT_PYTHON_VERSION} --package-name build/onedir/salt --platform linux
# Fix any hardcoded paths to the relenv python binary on any of the scripts installed in the <onedir>/bin directory
find build/onedir/salt/bin/ -type f -exec sed -i 's:#!/\(.*\)salt/bin/python3:#!/bin/sh\n"exec" "$$(dirname $$(readlink -f $$0))/python3" "$$0" "$$@":g' {} \;
build/onedir/venv/bin/tools pkg build salt-onedir . --package-name build/onedir/salt --platform linux
build/onedir/venv/bin/tools pkg pre-archive-cleanup --pkg build/onedir/salt
else
override_dh_auto_build:
# The relenv onedir is being provided, all setup up until Salt is installed
# is expected to be done
mkdir -p build/onedir
cd build/onedir; tar xvf ${SALT_ONEDIR_ARCHIVE}
# Fix any hardcoded paths to the relenv python binary on any of the scripts installed in the <onedir>/bin directory
find build/onedir/salt/bin/ -type f -exec sed -i 's:#!/\(.*\)salt/bin/python3:#!/bin/sh\n"exec" "$$(dirname $$(readlink -f $$0))/python3" "$$0" "$$@":g' {} \;
endif
# dh_auto_install tries to invoke distutils causing failures.
override_dh_auto_install:
override_dh_install:
mkdir -p debian/salt-common/opt/saltstack
cp -R build/onedir/salt debian/salt-common/opt/saltstack/
# Generate master config
mkdir -p debian/salt-master/etc/salt
sed 's/#user: root/user: salt/g' conf/master > debian/salt-master/etc/salt/master
dh_install
override_dh_strip:
dh_strip --dbg-package=salt-dbg

View file

@ -0,0 +1 @@
pkg/common/salt-api.service /lib/systemd/system

View file

@ -0,0 +1 @@
opt/saltstack/salt/salt-api /usr/bin/salt-api

View file

@ -0,0 +1 @@
doc/man/salt-api.1

View file

@ -0,0 +1,37 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
configure)
db_get salt-api/user
if [ "$RET" != "root" ]; then
if [ ! -e "/var/log/salt/api" ]; then
touch /var/log/salt/api
chmod 640 /var/log/salt/api
fi
chown $RET:$RET /var/log/salt/api
fi
if command -v systemctl; then
db_get salt-api/active
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" != 10 ]; then
systemctl daemon-reload
if [ "$RESLT" = "active" ]; then
systemctl restart salt-api
fi
db_get salt-api/enabled
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" = "disabled" ]; then
systemctl disable salt-api
else
systemctl enable salt-api
fi
else
systemctl daemon-reload
systemctl restart salt-api
systemctl enable salt-api
fi
fi
;;
esac

View file

@ -0,0 +1,27 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
# Reset permissions to fix previous installs
CUR_USER=$(ls -dl /run/salt-api.pid | cut -d ' ' -f 3)
CUR_GROUP=$(ls -dl /run/salt-api.pid | cut -d ' ' -f 4)
db_set salt-api/user $CUR_USER
chown -R $CUR_USER:$CUR_GROUP /var/log/salt/api
if command -v systemctl; then
SM_ENABLED=$(systemctl show -p UnitFileState salt-api | cut -d '=' -f 2)
db_set salt-api/enabled $SM_ENABLED
SM_ACTIVE=$(systemctl is-active salt-api)
db_set salt-api/active $SM_ACTIVE
else
db_set salt-api/enabled enabled
db_set salt-api/active active
fi
;;
esac

View file

@ -0,0 +1,17 @@
Template: salt-api/user
Type: string
Default: salt
Description: User for salt-api
User to run the salt-api process as
Template: salt-api/enabled
Type: string
Default: enabled
Description: Systemd enable state for salt-api
default enable state for salt-api systemd state
Template: salt-api/active
Type: string
Default: active
Description: Systemd active state for salt-api
default active state for salt-api systemd state

View file

@ -0,0 +1,5 @@
/etc/salt/cloud.conf.d/
/etc/salt/cloud.deploy.d/
/etc/salt/cloud.maps.d/
/etc/salt/cloud.profiles.d/
/etc/salt/cloud.providers.d/

View file

@ -0,0 +1 @@
conf/cloud /etc/salt

View file

@ -0,0 +1 @@
opt/saltstack/salt/salt-cloud /usr/bin/salt-cloud

View file

@ -0,0 +1 @@
doc/man/salt-cloud.1

View file

@ -0,0 +1,13 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
configure)
db_get salt-master/user
if [ "$RET" != "root" ]; then
PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;")
chown -R $RET:$RET /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy
fi
;;
esac

View file

@ -0,0 +1,332 @@
# written by David Pravec
# - feel free to /msg alekibango on IRC if you want to talk about this file
# TODO: check if --config|-c was used and use configured config file for queries
# TODO: solve somehow completion for salt -G pythonversion:[tab]
# (not sure what to do with lists)
# TODO: --range[tab] -- how?
# TODO: -E --exsel[tab] -- how?
# TODO: --compound[tab] -- how?
# TODO: use history to extract some words, esp. if ${cur} is empty
# TODO: TEST EVERYTING a lot
# TODO: cache results of some functions? where? how long?
# TODO: is it ok to use '--timeout 2' ?
_salt_get_grains(){
if [ "$1" = 'local' ] ; then
salt-call --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
else
salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
fi
}
_salt_get_grain_values(){
if [ "$1" = 'local' ] ; then
salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
else
salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
fi
}
_salt(){
local cur prev opts _salt_grains _salt_coms pprev ppprev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [ ${COMP_CWORD} -gt 2 ]; then
pprev="${COMP_WORDS[COMP_CWORD-2]}"
fi
if [ ${COMP_CWORD} -gt 3 ]; then
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
fi
opts="-h --help -d --doc --documentation --version --versions-report -c \
--config-dir= -v --verbose -t --timeout= -s --static -b --batch= \
--batch-size= -E --pcre -L --list -G --grain --grain-pcre -N \
--nodegroup -R --range -C --compound -X --exsel -I --pillar \
--return= -a --auth= --eauth= --extended-auth= -T --make-token -S \
--ipcidr --out=pprint --out=yaml --out=overstatestage --out=json \
--out=raw --out=highstate --out=key --out=txt --no-color --out-indent= "
if [[ "${cur}" == -* ]] ; then
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
# 2 special cases for filling up grain values
case "${pprev}" in
-G|--grain|--grain-pcre)
if [ "${cur}" = ":" ]; then
COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" ))
return 0
fi
;;
esac
case "${ppprev}" in
-G|--grain|--grain-pcre)
if [ "${prev}" = ":" ]; then
COMPREPLY=( $(compgen -W "`_salt_get_grain_values ${pprev}`" -- ${cur}) )
return 0
fi
;;
esac
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
cur=""
fi
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
prev="${pprev}"
fi
case "${prev}" in
-c|--config)
COMPREPLY=($(compgen -f -- ${cur}))
return 0
;;
salt)
COMPREPLY=($(compgen -W "\'*\' ${opts} `salt-key --no-color -l acc`" -- ${cur}))
return 0
;;
-E|--pcre)
COMPREPLY=($(compgen -W "`salt-key --no-color -l acc`" -- ${cur}))
return 0
;;
-G|--grain|--grain-pcre)
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
return 0
;;
-C|--compound)
COMPREPLY=() # TODO: finish this one? how?
return 0
;;
-t|--timeout)
COMPREPLY=($( compgen -W "1 2 3 4 5 6 7 8 9 10 15 20 30 40 60 90 120 180" -- ${cur}))
return 0
;;
-b|--batch|--batch-size)
COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9 10 15 20 30 40 50 60 70 80 90 100 120 150 200"))
return 0
;;
-X|--exsel) # TODO: finish this one? how?
return 0
;;
-N|--nodegroup)
MASTER_CONFIG='/etc/salt/master'
COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur}))
return 0
;;
esac
_salt_coms="$(salt '*' --timeout 2 --out=txt -- sys.list_functions | sed 's/^.*\[//' | tr -d ",']" )"
all="${opts} ${_salt_coms}"
COMPREPLY=( $(compgen -W "${all}" -- ${cur}) )
return 0
}
complete -F _salt salt
_saltkey(){
local cur prev opts prev pprev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-c --config-dir= -h --help --version --versions-report -q --quiet \
-y --yes --gen-keys= --gen-keys-dir= --keysize= --key-logfile= \
-l --list= -L --list-all -a --accept= -A --accept-all \
-r --reject= -R --reject-all -p --print= -P --print-all \
-d --delete= -D --delete-all -f --finger= -F --finger-all \
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
--out=highstate --out=key --out=txt --no-color --out-indent= "
if [ ${COMP_CWORD} -gt 2 ]; then
pprev="${COMP_WORDS[COMP_CWORD-2]}"
fi
if [ ${COMP_CWORD} -gt 3 ]; then
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
fi
if [[ "${cur}" == -* ]] ; then
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
cur=""
fi
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
prev="${pprev}"
fi
case "${prev}" in
-a|--accept)
COMPREPLY=($(compgen -W "$(salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
return 0
;;
-r|--reject)
COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color)" -- ${cur}))
return 0
;;
-d|--delete)
COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color; salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
return 0
;;
-c|--config)
COMPREPLY=($(compgen -f -- ${cur}))
return 0
;;
--keysize)
COMPREPLY=($(compgen -W "2048 3072 4096 5120 6144" -- ${cur}))
return 0
;;
--gen-keys)
return 0
;;
--gen-keys-dir)
COMPREPLY=($(compgen -d -- ${cur}))
return 0
;;
-p|--print)
COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color; salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
return 0
;;
-l|--list)
COMPREPLY=($(compgen -W "pre un acc accepted unaccepted rej rejected all" -- ${cur}))
return 0
;;
--accept-all)
return 0
;;
esac
COMPREPLY=($(compgen -W "${opts} " -- ${cur}))
return 0
}
complete -F _saltkey salt-key
_saltcall(){
local cur prev opts _salt_coms pprev ppprev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-h --help -d --doc --documentation --version --versions-report \
-m --module-dirs= -g --grains --return= --local -c --config-dir= -l --log-level= \
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
--out=highstate --out=key --out=txt --no-color --out-indent= "
if [ ${COMP_CWORD} -gt 2 ]; then
pprev="${COMP_WORDS[COMP_CWORD-2]}"
fi
if [ ${COMP_CWORD} -gt 3 ]; then
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
fi
if [[ "${cur}" == -* ]] ; then
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
if [ "${cur}" = "=" ] && [[ ${prev} == --* ]]; then
cur=""
fi
if [ "${prev}" = "=" ] && [[ ${pprev} == --* ]]; then
prev="${pprev}"
fi
case ${prev} in
-m|--module-dirs)
COMPREPLY=( $(compgen -d ${cur} ))
return 0
;;
-l|--log-level)
COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur}))
return 0
;;
-g|grains)
return 0
;;
salt-call)
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
;;
esac
_salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )"
COMPREPLY=( $(compgen -W "${opts} ${_salt_coms}" -- ${cur} ))
return 0
}
complete -F _saltcall salt-call
_saltcp(){
local cur prev opts target prefpart postpart helper filt pprev ppprev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-t --timeout= -s --static -b --batch= --batch-size= \
-h --help --version --versions-report -c --config-dir= \
-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup \
-R --range -C --compound -X --exsel -I --pillar \
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
--out=highstate --out=key --out=txt --no-color --out-indent= "
if [[ "${cur}" == -* ]] ; then
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
cur=""
fi
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
prev=${pprev}
fi
case ${prev} in
salt-cp)
COMPREPLY=($(compgen -W "${opts} `salt-key -l acc --no-color`" -- ${cur}))
return 0
;;
-t|--timeout)
# those numbers are just a hint
COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} ))
return 0
;;
-E|--pcre)
COMPREPLY=($(compgen -W "`salt-key -l acc --no-color`" -- ${cur}))
return 0
;;
-L|--list)
# IMPROVEMENTS ARE WELCOME
prefpart="${cur%,*},"
postpart=${cur##*,}
filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$"
helper=($(salt-key -l acc --no-color | grep -v "${filt}" | sed "s/^/${prefpart}/"))
COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur}))
return 0
;;
-G|--grain|--grain-pcre)
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
return 0
;;
# FIXME
-R|--range)
# FIXME ??
return 0
;;
-C|--compound)
# FIXME ??
return 0
;;
-c|--config)
COMPREPLY=($(compgen -f -- ${cur}))
return 0
;;
esac
# default is using opts:
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -F _saltcp salt-cp

View file

@ -0,0 +1 @@
/etc/logrotate.d/salt-common

View file

@ -0,0 +1,7 @@
/var/cache/salt
/var/log/salt
/var/run/salt
/usr/share/fish/vendor_completions.d
/opt/saltstack/salt
/etc/salt
/etc/logrotate.d

View file

@ -0,0 +1,12 @@
#! /usr/bin/dh-exec
pkg/common/logrotate/salt-common /etc/logrotate.d
pkg/common/fish-completions/salt-cp.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-call.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-syndic.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt_common.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-minion.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-key.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-master.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-run.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt.fish /usr/share/fish/vendor_completions.d

View file

@ -0,0 +1,9 @@
# permissions on /var/log/salt to permit adm group ownership
salt-common: non-standard-dir-perm
# minor formatting error in table in man page
salt-common: manpage-has-errors-from-man
opt/saltstack/salt/salt-pip /usr/bin/salt-pip
opt/saltstack/salt/salt-call /usr/bin/salt-call
usr/share/bash-completion/completions/salt-common usr/share/bash-completion/completions/salt-call

View file

@ -0,0 +1,2 @@
doc/man/salt-call.1
doc/man/salt.7

View file

@ -0,0 +1,4 @@
#!/bin/sh
set -e
/opt/saltstack/salt/bin/python3 -m compileall -qq /opt/saltstack/salt/lib

View file

@ -0,0 +1,39 @@
case "$1" in
install|upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
[ -z "$SALT_SHELL" ] && SALT_SHELL=/usr/sbin/nologin
# create user to avoid running server as root
# 1. create group if not existing
if ! getent group | grep -q "^$SALT_GROUP:" ; then
echo -n "Adding group $SALT_GROUP.."
addgroup --quiet --system $SALT_GROUP 2>/dev/null ||true
echo "..done"
fi
# 2. create homedir if not existing
test -d $SALT_HOME || mkdir -p $SALT_HOME
# 3. create user if not existing
if ! getent passwd | grep -q "^$SALT_USER:"; then
echo -n "Adding system user $SALT_USER.."
useradd --system \
--no-create-home \
-s $SALT_SHELL \
-g $SALT_GROUP \
$SALT_USER 2>/dev/null || true
echo "..done"
fi
# 4. adjust passwd entry
usermod -c "$SALT_NAME" \
-d $SALT_HOME \
-s $SALT_SHELL \
-g $SALT_GROUP \
$SALT_USER
# Remove incorrectly installed logrotate config - issue 65231
test -d /etc/logrotate.d/salt && rm -r /etc/logrotate.d/salt || /bin/true
;;
esac

View file

@ -0,0 +1,5 @@
#!/bin/sh
set -e
dpkg -L salt-common | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)'
find /opt/saltstack/salt -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir

View file

@ -0,0 +1,15 @@
/etc/salt/master.d
/etc/salt/pki/master/minions
/etc/salt/pki/master/minions_autosign
/etc/salt/pki/master/minions_denied
/etc/salt/pki/master/minions_pre
/etc/salt/pki/master/minions_rejected
/var/cache/salt/master
/var/cache/salt/minion
/var/cache/salt/master/jobs
/var/cache/salt/master/proc
/var/cache/salt/master/queues
/var/cache/salt/master/roots
/var/cache/salt/master/syndics
/var/cache/salt/master/tokens
/var/run/salt/master

View file

@ -0,0 +1,2 @@
pkg/common/salt-master.service /lib/systemd/system
pkg/common/salt.ufw /etc/ufw/applications.d

View file

@ -0,0 +1,9 @@
opt/saltstack/salt/salt-master /usr/bin/salt-master
opt/saltstack/salt/salt /usr/bin/salt
opt/saltstack/salt/salt-cp /usr/bin/salt-cp
opt/saltstack/salt/salt-key /usr/bin/salt-key
opt/saltstack/salt/salt-run /usr/bin/salt-run
opt/saltstack/salt/spm /usr/bin/spm
usr/share/bash-completion/completions/salt-common usr/share/bash-completion/completions/salt
usr/share/bash-completion/completions/salt-common usr/share/bash-completion/completions/salt-cp
usr/share/bash-completion/completions/salt-common usr/share/bash-completion/completions/salt-key

View file

@ -0,0 +1,5 @@
doc/man/salt.1
doc/man/salt-cp.1
doc/man/salt-key.1
doc/man/salt-master.1
doc/man/salt-run.1

View file

@ -0,0 +1,41 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
configure)
db_get salt-master/user
if [ "$RET" != "root" ]; then
if [ ! -e "/var/log/salt/master" ]; then
touch /var/log/salt/master
chmod 640 /var/log/salt/master
fi
if [ ! -e "/var/log/salt/key" ]; then
touch /var/log/salt/key
chmod 640 /var/log/salt/key
fi
chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master
fi
if command -v systemctl; then
db_get salt-master/active
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" != 10 ]; then
systemctl daemon-reload
if [ "$RESLT" = "active" ]; then
systemctl restart salt-master
fi
db_get salt-master/enabled
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" = "disabled" ]; then
systemctl disable salt-master
else
systemctl enable salt-master
fi
else
systemctl daemon-reload
systemctl restart salt-master
systemctl enable salt-master
fi
fi
;;
esac

View file

@ -0,0 +1,47 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
install)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();")
# Reset permissions to fix previous installs
find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \
\! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path \
/opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \( -user ${SALT_USER} \
-o -group ${SALT_GROUP} \) -exec chown ${SALT_USER}:${SALT_GROUP} \{\} \;
;;
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();")
# Reset permissions to fix previous installs
CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3)
CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4)
db_set salt-master/user $CUR_USER
chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \
/var/log/salt/key /var/cache/salt/master /var/run/salt/master
if command -v systemctl; then
SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2)
db_set salt-master/enabled $SM_ENABLED
SM_ACTIVE=$(systemctl is-active salt-master)
db_set salt-master/active $SM_ACTIVE
else
db_set salt-master/enabled enabled
db_set salt-master/active active
fi
;;
esac
# remove incorrectly installed ufw salt-master directory - issue 57712
test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true

View file

@ -0,0 +1,17 @@
Template: salt-master/user
Type: string
Default: salt
Description: User for salt-master
User to run the salt-master process as
Template: salt-master/enabled
Type: string
Default: enabled
Description: Systemd enable state for salt-master
default enable state for salt-master systemd state
Template: salt-master/active
Type: string
Default: active
Description: Systemd active state for salt-master
default active state for salt-master systemd state

View file

@ -0,0 +1,2 @@
/etc/salt/minion.d/
/etc/salt/proxy.d/

View file

@ -0,0 +1,4 @@
conf/minion /etc/salt
conf/proxy /etc/salt
pkg/common/salt-minion.service /lib/systemd/system
pkg/common/salt-proxy@.service /lib/systemd/system

View file

@ -0,0 +1,2 @@
opt/saltstack/salt/salt-minion /usr/bin/salt-minion
opt/saltstack/salt/salt-proxy /usr/bin/salt-proxy

View file

@ -0,0 +1,2 @@
doc/man/salt-minion.1
doc/man/salt-proxy.1

View file

@ -0,0 +1,41 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
configure)
db_get salt-minion/user
if [ "$RET" != "root" ]; then
if [ ! -e "/var/log/salt/minion" ]; then
touch /var/log/salt/minion
chmod 640 /var/log/salt/minion
fi
if [ ! -e "/var/log/salt/key" ]; then
touch /var/log/salt/key
chmod 640 /var/log/salt/key
fi
chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion
fi
if command -v systemctl; then
db_get salt-minion/active
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" != 10 ]; then
systemctl daemon-reload
if [ "$RESLT" = "active" ]; then
systemctl restart salt-minion
fi
db_get salt-minion/enabled
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" = "disabled" ]; then
systemctl disable salt-minion
else
systemctl enable salt-minion
fi
else
systemctl daemon-reload
systemctl restart salt-minion
systemctl enable salt-minion
fi
fi
;;
esac

View file

@ -0,0 +1,29 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();")
# Reset permissions to fix previous installs
CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3)
CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4)
db_set salt-minion/user $CUR_USER
chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \
/var/cache/salt/minion /var/run/salt/minion
if command -v systemctl; then
SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2)
db_set salt-minion/enabled $SM_ENABLED
SM_ACTIVE=$(systemctl is-active salt-minion)
db_set salt-minion/active $SM_ACTIVE
else
db_set salt-minion/enabled enabled
db_set salt-minion/active active
fi
;;
esac

View file

@ -0,0 +1,17 @@
Template: salt-minion/user
Type: string
Default: root
Description: User for salt-minion
User to run the salt-minion process as
Template: salt-minion/enabled
Type: string
Default: enabled
Description: Systemd enable state for salt-minion
default enable state for salt-minion systemd state
Template: salt-minion/active
Type: string
Default: active
Description: Systemd active state for salt-minion
default active state for salt-minion systemd state

View file

@ -0,0 +1 @@
conf/roster /etc/salt

View file

@ -0,0 +1 @@
opt/saltstack/salt/salt-ssh /usr/bin/salt-ssh

View file

@ -0,0 +1 @@
doc/man/salt-ssh.1

View file

@ -0,0 +1 @@
pkg/common/salt-syndic.service /lib/systemd/system

View file

@ -0,0 +1 @@
opt/saltstack/salt/salt-syndic /usr/bin/salt-syndic

View file

@ -0,0 +1 @@
doc/man/salt-syndic.1

View file

@ -0,0 +1,37 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
configure)
db_get salt-syndic/user
if [ "$RET" != "root" ]; then
if [ ! -e "/var/log/salt/syndic" ]; then
touch /var/log/salt/syndic
chmod 640 /var/log/salt/syndic
fi
chown $RET:$RET /var/log/salt/syndic
fi
if command -v systemctl; then
db_get salt-syndic/active
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" != 10 ]; then
systemctl daemon-reload
if [ "$RESLT" = "active" ]; then
systemctl restart salt-syndic
fi
db_get salt-syndic/enabled
RESLT=$(echo "$RET" | cut -d ' ' -f 1)
if [ "$RESLT" = "disabled" ]; then
systemctl disable salt-syndic
else
systemctl enable salt-syndic
fi
else
systemctl daemon-reload
systemctl restart salt-syndic
systemctl enable salt-syndic
fi
fi
;;
esac

View file

@ -0,0 +1,27 @@
#!/bin/sh
. /usr/share/debconf/confmodule
case "$1" in
upgrade)
[ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt
[ -z "$SALT_USER" ] && SALT_USER=salt
[ -z "$SALT_NAME" ] && SALT_NAME="Salt"
[ -z "$SALT_GROUP" ] && SALT_GROUP=salt
# Reset permissions to fix previous installs
CUR_USER=$(ls -dl /run/salt-syndic.pid | cut -d ' ' -f 3)
CUR_GROUP=$(ls -dl /run/salt-syndic.pid | cut -d ' ' -f 4)
db_set salt-syndic/user $CUR_USER
chown -R $CUR_USER:$CUR_GROUP /var/log/salt/syndic
if command -v systemctl; then
SM_ENABLED=$(systemctl show -p UnitFileState salt-syndic | cut -d '=' -f 2)
db_set salt-syndic/enabled $SM_ENABLED
SM_ACTIVE=$(systemctl is-active salt-syndic)
db_set salt-syndic/active $SM_ACTIVE
else
db_set salt-syndic/enabled enabled
db_set salt-syndic/active active
fi
;;
esac

View file

@ -0,0 +1,17 @@
Template: salt-syndic/user
Type: string
Default: salt
Description: User for salt-syndic
User to run the salt-syndic process as
Template: salt-syndic/enabled
Type: string
Default: enabled
Description: Systemd enable state for salt-syndic
default enable state for salt-syndic systemd state
Template: salt-syndic/active
Type: string
Default: active
Description: Systemd active state for salt-syndic
default active state for salt-syndic systemd state

1
pkg/debian/source/format Normal file
View file

@ -0,0 +1 @@
3.0 (native)

3
pkg/macos/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/build
*.pkg
distribution.xml

39
pkg/macos/README.md Normal file
View file

@ -0,0 +1,39 @@
Building Native Packages on macOS
=================================
Salt runs well on the macOS, but does have some limitations.
In this directory you will find scripts and collateral to build a macOS
.pkg-style package that uses a custom-built Python. This process has been
tested on macOS Catalina (10.15) and later.
This approach enables Salt users to potentially add items to their Salt install
via 'pip install' without interfering with the rest of their system's Python
packages.
In addition, because of changes in launchd from version to version of the OS, a
simpler approach is taken for the launchd plist files.
To build a native package you will need the following installed:
- Xcode, or the Xcode Command Line Tools
- git
The native package will install program files into ``/opt/salt``. Configuration
files will be installed to ``etc/salt``, but will have '.dist' appended to
them.
Launchd plists will be placed in /Library/LaunchDaemons. By default, salt-minion
will NOT be enabled or started.
The process has been automated via the ``build.sh`` script in the directory with
this README file. Checkout the Salt repo from GitHub, chdir into the base repo
directory, and run the following:
./build.sh
References:
http://crushbeercrushcode.org/2014/01/using-pkgbuild-and-productbuild-on-os-x-10-7/
http://stackoverflow.com/questions/11487596/making-os-x-installer-packages-like-a-pro-xcode-developer-id-ready-pkg

272
pkg/macos/build.sh Executable file
View file

@ -0,0 +1,272 @@
#!/bin/bash
################################################################################
#
# Title: Build Salt Package Script for macOS
# Authors: CR Oldham, Shane Lee
# Date: December 2015
#
# Description: This script downloads and installs all dependencies and build
# tools required to create a .pkg file for installation on macOS.
# Salt and all dependencies will be installed to a Relenv Python
# environment in the ./build directory relevant to this script. A
# .pkg file will then be created. The pkg will be signed and
# notarized
#
# If this script is run with sudo, you must pass the `-E` option
# in order for the environment variables to be available. For
# example:
#
# sudo -E ./build.sh 3003
#
# Requirements:
# - Xcode
#
# NOTE: Previous versions of this script were able to run with just the
# Xcode command line tools. However, now that we are notarizing these
# packages, we require a full Xcode installation.
#
# Usage:
# This script can be passed 3 positional arguments:
# $1 : <version> : the version of salt to build
# (defaults to git-repo state)
#
# Example:
# # The following will build a Salt 3006.1-1 package:
# ./build.sh 3006.1-1
#
# # The following will build whatever version of salt is checked out:
# ./build.sh
#
# # The following will ensure environment variables are passed to the
# # sudo environment:
# sudo -E ./build.sh 3006.1-1
#
# This script calls out to the following scripts:
#
# build_python.sh
# Builds python using the relenv project:
# https://github.com/saltstack/relative-environment-for-python
#
# install_salt.sh
# Installs Salt into the python environment
#
# sign_binaries.sh
# Signs all the binaries with the Developer App certificate specified in
# the DEV_APP_CERT environment variable. It signs all binaries in the
# ./build directory. It also signs all .dylib and .so files.
#
# prep_salt.sh
# Prepare the build environment for packaging. Stages config files and
# service definitions. Removes files we don't want in the package.
#
# package.sh
# Builds a package file from the contents of ./build and signs it with
# the Developer Installer certificate specified in the DEV_INSTALL_CERT
# environment variable.
#
# notarize.sh
# Uploads the package to be notarized by Apple and staples the
# notarization to the installer pkg. It uses the Apple Account name
# specified in the APPLE_ACCT environment variable and the app-specific
# password for that account specified in the APP_SPEC_PWD environment
# variable.
#
# Environment Setup:
# These scripts require certificates and environment variables be present on
# the system. Details can be found in the individual scripts that use them.
#
# Import Certificates:
# Import the Salt Developer Application and Installer Signing
# certificates using the following commands:
#
# security import "developerID_application.p12" -k ~/Library/Keychains/login.keychain
# security import "developerID_installer.p12" -k ~/Library/Keychains/login.keychain
#
# Define Environment Variables:
# Define the environment variables using the following commands (replace
# with the actual values):
#
# export DEV_APP_CERT="Developer ID Application: Salt Stack, Inc. (AB123ABCD1)"
# export DEV_INSTALL_CERT="Developer ID Installer: Salt Stack, Inc. (AB123ABCD1)"
# export APPLE_ACCT="username@domain.com"
# export APP_SPEC_PWD="abcd-efgh-ijkl-mnop"
#
# Don't forget to pass the `-E` option when running with Sudo so that
# the environment variables are passed to the `package.sh`,
# `notarize.sh`, and `sign_binaries.sh` scripts under the sudo
# environment.
#
################################################################################
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CPU_ARCH=$(uname -m)
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to build a Salt package for macOS:"
echo ""
echo "usage: ${0}"
echo " [-h|--help] [-v|--version]"
echo ""
echo " -h, --help Display this message"
echo " -v, --version Version of Salt to display in the package"
echo " -p, --python-version Version of python to install using relenv."
echo " The python version is tied to the relenv"
echo " version"
echo " -r, --relenv-version Version of relenv to install"
echo ""
echo " Build a Salt package:"
echo " example: $0 3006.1-1"
}
function _parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-v | --version )
shift
VERSION="$*"
shift
;;
-p | --python-version )
shift
PY_VERSION="$1"
shift
;;
-r | --relenv-version )
shift
RELENV_VERSION="$1"
shift
;;
-*)
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
VERSION="$*"
shift
;;
esac
done
if [ -z "$VERSION" ]; then
VERSION=$(git describe)
fi
VERSION=${VERSION#"v"}
# Get defaults from workflows. This defines $python_version and $relenv_version
eval "$(_parse_yaml "$SRC_DIR/cicd/shared-gh-workflows-context.yml")"
if [ -z "$PY_VERSION" ]; then
PY_VERSION=$python_version
fi
if [ -z "$RELENV_VERSION" ]; then
RELENV_VERSION=$relenv_version
fi
#-------------------------------------------------------------------------------
# Quit on error
#-------------------------------------------------------------------------------
quit_on_error() {
echo "$(basename "$0") caught error on line : $1 command was: $2"
echo -en "\033]0;\a"
exit 1
}
trap 'quit_on_error $LINENO $BASH_COMMAND' ERR
#-------------------------------------------------------------------------------
# Make sure this is the Salt Repository
#-------------------------------------------------------------------------------
if [[ ! -e "$SRC_DIR/.git" ]] && [[ ! -e "$SRC_DIR/scripts/salt" ]]; then
echo "This directory doesn't appear to be a Salt git repository."
echo "The macOS build process needs some files from a Git checkout of Salt."
echo -en "\033]0;\a"
exit 1
fi
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "#%.0s" {1..80}; printf "\n"
echo "Build Salt Package for macOS"
echo "- Python Version: $PY_VERSION"
echo "- Relenv Version: $RELENV_VERSION"
printf "v%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Build Python
#-------------------------------------------------------------------------------
"$SCRIPT_DIR/build_python.sh" -v $PY_VERSION -r $RELENV_VERSION
#-------------------------------------------------------------------------------
# Install Salt
#-------------------------------------------------------------------------------
"$SCRIPT_DIR/install_salt.sh"
#-------------------------------------------------------------------------------
# Sign Binaries built by Salt
#-------------------------------------------------------------------------------
"$SCRIPT_DIR/sign_binaries.sh"
#-------------------------------------------------------------------------------
# Prepare the Salt environment for packaging
#-------------------------------------------------------------------------------
"$SCRIPT_DIR/prep_salt.sh"
#-------------------------------------------------------------------------------
# Build and Sign Package
#-------------------------------------------------------------------------------
if [ "$(id -un)" != "root" ]; then
sudo "$SCRIPT_DIR/package.sh" "$VERSION" -s
else
"$SCRIPT_DIR/package.sh" "$VERSION" -s
fi
#-------------------------------------------------------------------------------
# Notarize Package
#-------------------------------------------------------------------------------
"$SCRIPT_DIR/notarize.sh" "salt-$VERSION-py3-$CPU_ARCH.pkg"
#-------------------------------------------------------------------------------
# Script Completed
#-------------------------------------------------------------------------------
printf "^%.0s" {1..80}; printf "\n"
echo "Build Salt Package for macOS Complete"
printf "#%.0s" {1..80}; printf "\n"

280
pkg/macos/build_python.sh Executable file
View file

@ -0,0 +1,280 @@
#!/bin/bash
################################################################################
#
# Title: Build Python
# Author: Twangboy
#
# Description: This script builds Python from source using the Relative
# Environment for Python project (relenv):
#
# https://github.com/saltstack/relative-environment-for-python
#
# The build is placed in the ./build directory relative to this
# script.
#
# For more information, run this script with the -h option.
################################################################################
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
# The default version to be built
# TODO: The is not selectable via RELENV yet. This has to match whatever relenv
# TODO: is building
# Locations
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SYS_PY_BIN="$(which python3)"
BUILD_DIR="$SCRIPT_DIR/build"
BLD_PY_BIN="$BUILD_DIR/opt/salt/bin/python3"
RELENV_DIR="$HOME/.local/relenv"
BUILD=0
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to build Python using the Relenv library:"
echo ""
echo "usage: ${0}"
echo " [-h|--help] [-v|--version]"
echo ""
echo " -h, --help this message"
echo " -b, --build build python instead of fetching"
echo " -v, --version version of python to install, must be a"
echo " version available in relenv"
echo " -r, --relenv-version version of relenv to install"
echo ""
echo " To build python 3.10.13 you need to use relenv 0.13.5:"
echo " example: $0 --relenv-version 0.13.5 --version 3.10.13"
}
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf '\e[32m%s\e[0m\n' "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf '\e[31m%s\e[0m\n' "Failure"
exit 1
}
function _parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-v | --version )
shift
PY_VERSION="$1"
shift
;;
-r | --relenv-version )
shift
RELENV_VERSION="$1"
shift
;;
-b | --build )
BUILD=1
shift
;;
-*)
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
echo "Invalid Arguments: $*"
_usage
exit 1
;;
esac
done
# Get defaults from workflows. This defines $python_version and $relenv_version
eval "$(_parse_yaml "$SRC_DIR/cicd/shared-gh-workflows-context.yml")"
if [ -z "$PY_VERSION" ]; then
PY_VERSION=$python_version
fi
if [ -z "$RELENV_VERSION" ]; then
RELENV_VERSION=$relenv_version
fi
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
if [ $BUILD -gt 0 ]; then
echo "Build Python with Relenv"
else
echo "Fetch Python with Relenv"
fi
echo "- Python Version: $PY_VERSION"
echo "- Relenv Version: $RELENV_VERSION"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Cleaning Environment
#-------------------------------------------------------------------------------
if [ -d "$BUILD_DIR" ]; then
_msg "Removing build directory"
rm -rf "$BUILD_DIR"
if ! [ -d "$BUILD_DIR" ]; then
_success
else
_failure
fi
fi
if [ -n "${VIRTUAL_ENV}" ]; then
_msg "Deactivating virtual environment"
deactivate
if [ -z "${VIRTUAL_ENV}" ]; then
_success
else
_failure
fi
fi
if [ -d "$SCRIPT_DIR/venv" ]; then
_msg "Removing virtual environment directory"
rm -rf "$SCRIPT_DIR/venv"
if ! [ -d "$SCRIPT_DIR/venv" ]; then
_success
else
_failure
fi
fi
if [ -d "$RELENV_DIR" ]; then
_msg "Removing relenv directory"
rm -rf "$RELENV_DIR"
if ! [ -d "$RELENV_DIR" ]; then
_success
else
_failure
fi
fi
#-------------------------------------------------------------------------------
# Setting Up Virtual Environment
#-------------------------------------------------------------------------------
_msg "Setting up virtual environment"
$SYS_PY_BIN -m venv "$SCRIPT_DIR/venv"
if [ -d "$SCRIPT_DIR/venv" ]; then
_success
else
_failure
fi
_msg "Activating virtual environment"
source "$SCRIPT_DIR/venv/bin/activate"
if [ -n "${VIRTUAL_ENV}" ]; then
_success
else
_failure
fi
#-------------------------------------------------------------------------------
# Installing Relenv
#-------------------------------------------------------------------------------
_msg "Installing relenv"
if [ -n "${RELENV_VERSION}" ]; then
pip install relenv==${RELENV_VERSION}
else
pip install relenv
fi
if [ -n "$(relenv --version)" ]; then
_success
else
_failure
fi
export RELENV_FETCH_VERSION=$(relenv --version)
#-------------------------------------------------------------------------------
# Building Python with Relenv
#-------------------------------------------------------------------------------
if [ $BUILD -gt 0 ]; then
echo "- Building python (relenv):"
relenv build --clean --python=$PY_VERSION
else
# We want to suppress the output here so it looks nice
# To see the output, remove the output redirection
_msg "Fetching python (relenv)"
relenv fetch --python=$PY_VERSION && _success || _failure
fi
_msg "Extracting python environment"
relenv create --python=$PY_VERSION "$BUILD_DIR/opt/salt"
if [ -f "$BLD_PY_BIN" ]; then
_success
else
_failure
fi
#-------------------------------------------------------------------------------
# Removing Unneeded Libraries from Python
#-------------------------------------------------------------------------------
PY_VERSION_MINOR=$($BLD_PY_BIN -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info))')
REMOVE=(
"idlelib"
"test"
"tkinter"
"turtledemo"
)
for i in "${REMOVE[@]}"; do
TEST_DIR="$BUILD_DIR/opt/salt/lib/python${PY_VERSION_MINOR}/$i"
if [ -d "$TEST_DIR" ]; then
_msg "Removing $i directory"
rm -rf "$TEST_DIR" && _success || _failure
fi
done
#-------------------------------------------------------------------------------
# Finished
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Build Python with Relenv Completed"
printf "=%.0s" {1..80}; printf "\n"

123
pkg/macos/clean.sh Executable file
View file

@ -0,0 +1,123 @@
#!/bin/bash
################################################################################
# Title: Clean Environment Script
# Author: Twangboy
#
# Description: This script cleans up build artifacts from the package directory.
# Run this script with the -h option for more information
################################################################################
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REMOVE_DIRS=(
"$SCRIPT_DIR/relative-environment-for-python"
"$HOME/.local/relenv"
"$SCRIPT_DIR/build"
"$SCRIPT_DIR/venv"
"$SRC_DIR/build"
"$SRC_DIR/dist"
)
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to clean the package directory and build environment:"
echo ""
echo "usage: ${0}"
echo " [-h|--help]"
echo ""
echo " -h, --help this message"
echo ""
echo " To clean the package directory:"
echo " example: $0"
}
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf "\e[32m%s\e[0m\n" "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf "\e[31m%s\e[0m\n" "Failure"
exit 1
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-*)
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
shift
;;
esac
done
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
echo "Cleaning Build Environment"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Cleaning Environment
#-------------------------------------------------------------------------------
if [ -n "${VIRTUAL_ENV}" ]; then
_msg "Deactivating virtual environment"
deactivate
if [ -z "${VIRTUAL_ENV}" ]; then
_success
else
_failure
fi
fi
for dir in "${REMOVE_DIRS[@]}"; do
if [ -d "$dir" ]; then
_msg "Removing $dir"
rm -rf "$dir"
if [ -d "$dir" ]; then
_failure
else
_success
fi
fi
done
#-------------------------------------------------------------------------------
# Script Complete
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Cleaning Build Environment Complete"
printf "=%.0s" {1..80}; printf "\n"

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<title>@TITLE@</title>
<organization>com.saltstack.salt</organization>
<!-- Define minimum system requirements -->
<volume-check>
<allowed-os-versions>
<os-version min="10.9" />
</allowed-os-versions>
</volume-check>
<options rootVolumeOnly="true"
hostArchitectures="@CPU_ARCH@" />
<domains enable_localSystem="true" />
<!-- Define background image -->
<background file="logo.png"
mime-type="image/png"
scaling="proportional"
alignment="bottomleft" />
<background-darkAqua file="logo.png"
mime-type="image/png"
scaling="proportional"
alignment="bottomleft" />
<!-- Define documents displayed at various steps -->
<welcome file="welcome.rtf"
mime-type="text/rtf" />
<license file="license.rtf"
mime-type="text/rtf" />
<conclusion file="conclusion.rtf"
mime-type="text/rtf" />
<!-- List all component packages -->
<pkg-ref id="com.saltstack.salt"
version="@VERSION@"
auth="root">salt-src-@VERSION@-py3-@CPU_ARCH@.pkg</pkg-ref>
<!-- List them again here. They can now be organized
as a hierarchy if you want. -->
<choices-outline>
<line choice="com.saltstack.salt" />
</choices-outline>
<!-- Define each choice above -->
<choice id="com.saltstack.salt"
visible="false"
title="@TITLE@"
description="@DESC@"
start_selected="true">
<pkg-ref id="com.saltstack.salt" />
</choice>
</installer-gui-script>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>

154
pkg/macos/install_salt.sh Executable file
View file

@ -0,0 +1,154 @@
#!/bin/bash
################################################################################
#
# Title: Install Salt
# Author: Twangboy
#
# Description: This script installs Salt into the Python environment for
# packaging. Checkout the version of Salt you want to install.
# Then run this script. For more information, run this script with
# the -h option.
################################################################################
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/build/opt/salt"
PIP_BIN="$BUILD_DIR/bin/pip3"
PYTHON_BIN="$BUILD_DIR/bin/python3"
PYTHON_VER="$($PYTHON_BIN -c 'import platform; print(platform.python_version())')"
PYTHON_DOT_VER=${PYTHON_VER%.*}
REQ_FILE="$SRC_DIR/requirements/static/pkg/py$PYTHON_DOT_VER/darwin.txt"
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to install Salt into the Python environment:"
echo ""
echo "usage: ${0}"
echo " [-h|--help]"
echo ""
echo " -h, --help this message"
echo ""
echo " Install Salt:"
echo " example: $0"
}
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf "\e[32m%s\e[0m\n" "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf "\e[31m%s\e[0m\n" "Failure"
exit 1
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-*)
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
shift
;;
esac
done
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
echo "Install Salt into Build Environment"
echo "Python Version: $PYTHON_DOT_VER"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Cleaning Environment
#-------------------------------------------------------------------------------
REMOVE_DIRS=(
"$SRC_DIR/build"
"$SRC_DIR/dist"
)
for dir in "${REMOVE_DIRS[@]}"; do
if [ -d "$dir" ]; then
_msg "Removing $dir"
rm -rf "$dir"
if [ -d "$dir" ]; then
_failure
else
_success
fi
fi
done
TEST_DIR="$SCRIPT_DIR/build/opt/salt/lib/python3.*/site-packages/salt*/"
if compgen -G "$TEST_DIR" > /dev/null; then
_msg "Removing salt directory"
find "$TEST_DIR" -type d -exec rm -rf {} +
if ! compgen -G "$TEST_DIR" > /dev/null; then
_success
else
_failure
fi
fi
#-------------------------------------------------------------------------------
# Install Requirements into the Python Environment
#-------------------------------------------------------------------------------
_msg "Installing Salt requirements"
$PIP_BIN install -r "$REQ_FILE" > /dev/null 2>&1
if [ -f "$BUILD_DIR/bin/distro" ]; then
_success
else
_failure
fi
#-------------------------------------------------------------------------------
# Install Salt into the Python Environment
#-------------------------------------------------------------------------------
_msg "Installing Salt"
RELENV_PIP_DIR="yes" $PIP_BIN install "$SRC_DIR" > /dev/null 2>&1
TEST_DIR="$SCRIPT_DIR/build/opt/salt/lib/python3.*/site-packages/salt*"
if compgen -G "$TEST_DIR" > /dev/null; then
_success
else
_failure
fi
#-------------------------------------------------------------------------------
# Script Complete
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Install Salt into Build Environment Completed"
printf "=%.0s" {1..80}; printf "\n"

159
pkg/macos/notarize.sh Executable file
View file

@ -0,0 +1,159 @@
#!/bin/bash
################################################################################
#
# Title: Notarize Package Script for macOS
# Author: Shane Lee
# Date: December 2020
#
# Description: This notarizes the macOS Installer Package (.pkg). It uses the
# `notarytool` xcode utility which became available in Xcode 13.
# Xcode 13 requires macOS Big Sur 11.3 or higher. However, the
# notarytool binary can be extracted and run on macOS Catalina
# 10.15.7 and higher. It is not available in Command Line Tools.
#
# This script will upload a copy of the package to Apple and wait
# for the notarization to return. This can take several minutes.
#
# This script requires the presence of some environment variables.
# If running this script with sudo, be sure to pass the `-E`
# option.
#
# sudo -E ./notarize.sh salt-3006.2-signed.pkg
#
# Requirements:
# - Full Xcode Installation
# I had issues installing Xcode after installing Command Line Tools. This
# works better when it is a clean machine and only Xcode is installed.
# The Xcode installation includes the Command Line Tools.
#
# Usage:
# This script must be passed 1 parameter
#
# $1 : <package>
# The package that will be notarized (must be signed)
#
# Example:
# The following will notarize the 'salt-3006.2-signed.pkg' file:
#
# ./notarize.sh salt-3006.2-signed.pkg
#
# Environment Setup:
#
# Define Environment Variables:
# Create three environment variables for the apple account, apple team
# ID, and the app-specific password associated with that account. To
# generate the app-specific password see:
# https://support.apple.com/en-us/HT204397
#
# export APPLE_ACCT="username@domain.com"
# export APPLE_TEAM_ID="AB283DVDS5"
# export APP_SPEC_PWD="abcd-efgh-ijkl-mnop"
#
################################################################################
#-------------------------------------------------------------------------------
# Check input parameters
#-------------------------------------------------------------------------------
if [ "$1" == "" ]; then
echo "Must supply a package to notarize"
exit 1
else
PACKAGE=$1
fi
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf "\e[32m%s\e[0m\n" "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf "\e[31m%s\e[0m\n" "Failure"
echo "output >>>>>>"
cat "$NOTARIZE_LOG" 1>&2
echo "<<<<<< output"
exit 1
}
#-------------------------------------------------------------------------------
# Environment Variables
#-------------------------------------------------------------------------------
_msg "Setting Variables"
NOTARIZE_LOG=$(mktemp -t notarize-app.log)
NOTARY_TOOL=$(xcrun --find notarytool)
_success
#-------------------------------------------------------------------------------
# Check for notarytool
#-------------------------------------------------------------------------------
if [ ! -f "$NOTARY_TOOL" ]; then
echo "This script requires the NotaryTool binary"
exit 1
fi
#-------------------------------------------------------------------------------
# Delete temporary files on exit
#-------------------------------------------------------------------------------
function finish {
rm "$NOTARIZE_LOG"
}
trap finish EXIT
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
echo "Notarize Salt Package"
echo "- This can take up to 30 minutes"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Submit app for notarization
#-------------------------------------------------------------------------------
_msg "Submitting Package for Notarization"
if $NOTARY_TOOL submit \
--apple-id "$APPLE_ACCT" \
--team-id "$APPLE_TEAM_ID" \
--password "$APP_SPEC_PWD" \
--wait \
"$PACKAGE" > "$NOTARIZE_LOG" 2>&1; then
_success
else
_failure
fi
# Make sure the status is "Accepted", then staple
_msg "Verifying accepted status"
if grep -q "status: Accepted" "$NOTARIZE_LOG"; then
_success
else
_failure
fi
_msg "Stapling Notarization to the Package"
if xcrun stapler staple "$PACKAGE" > "$NOTARIZE_LOG"; then
_success
else
_failure
fi
#-------------------------------------------------------------------------------
# Script Completed
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Notarize Salt Package Completed"
printf "=%.0s" {1..80}; printf "\n"

321
pkg/macos/package.sh Executable file
View file

@ -0,0 +1,321 @@
#!/bin/bash
################################################################################
#
# Title: Build Package Script for macOS
# Authors: CR Oldham, Shane Lee
# Date: December 2015
#
# Description: This creates a macOS package for Salt from the contents of
# ./build and signs it
#
# Requirements:
# - Xcode Command Line Tools (xcode-select --install)
# or
# - Xcode
#
# Usage:
# This script can be passed the following parameter:
# $1 : <version> : the version name to give the package. Defaults to the
# git repo version
#
# Example:
# The following will build Salt version 3006.1-1 and stage all files in
# the ./build directory relative to this script
#
# ./package.sh 3006.1-1
#
# Environment Setup:
#
# Import Certificates:
# Import the Salt Developer Installer Signing certificate using the
# following command:
#
# security import "developerID_installer.p12" -k ~/Library/Keychains/login.keychain
#
# NOTE: The .p12 certificate is required as the .cer certificate is
# missing the private key. This can be created by exporting the
# certificate from the machine it was created on
#
# Define Environment Variables:
# Create an environment variable with the name of the certificate to use
# from the keychain for installer signing. Use the following command
# (The actual value must match what is provided in the certificate):
#
# export DEV_INSTALL_CERT="Developer ID Installer: Salt Stack, Inc. (AB123ABCD1)"
#
################################################################################
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
CPU_ARCH="$(uname -m)"
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIST_XML="$SCRIPT_DIR/distribution.xml"
BUILD_DIR="$SCRIPT_DIR/build"
CMD_OUTPUT=$(mktemp -t cmd_log.XXX)
SCRIPTS_DIR="$SCRIPT_DIR/dist_scripts"
# Get the python version from the relenv python
BLD_PY_BIN="$BUILD_DIR/opt/salt/bin/python3"
PY_VER=$($BLD_PY_BIN -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
#-------------------------------------------------------------------------------
# Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to build the Salt package:"
echo ""
echo "usage: ${0}"
echo " [-h|--help] [-v|--version]"
echo ""
echo " -h, --help this message"
echo " -v, --version version of Salt display in the package"
echo " -s, --sign Sign the package"
echo ""
echo " To build the Salt package:"
echo " example: $0 3006.1-1"
}
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf "\e[32m%s\e[0m\n" "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf "\e[31m%s\e[0m\n" "Failure"
echo "output >>>>>>"
cat "$CMD_OUTPUT" 1>&2
echo "<<<<<< output"
exit 1
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
SIGN=0
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-s | --sign )
SIGN=1
shift
;;
-v | --version )
shift
VERSION="$1"
shift
;;
-* )
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
VERSION="$1"
shift
;;
esac
done
if [ -z "$VERSION" ]; then
VERSION=$(git describe)
fi
VERSION=${VERSION#"v"}
#-------------------------------------------------------------------------------
# Delete temporary files on exit
#-------------------------------------------------------------------------------
function finish {
rm "$CMD_OUTPUT"
}
trap finish EXIT
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
echo "Building Salt Package"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Make sure this is the Salt Repository
#-------------------------------------------------------------------------------
if [[ ! -e "$SRC_DIR/.git" ]] && [[ ! -e "$SRC_DIR/scripts/salt" ]]; then
echo "This directory doesn't appear to be a git repository."
echo "The macOS build process needs some files from a Git checkout of Salt."
echo "Run this script from the 'pkg/macos' directory of the Git checkout."
exit 1
fi
#-------------------------------------------------------------------------------
# Add Title, Description, Version and CPU Arch to distribution.xml
#-------------------------------------------------------------------------------
if [ -f "$DIST_XML" ]; then
_msg "Removing existing distribution.xml"
rm -f "$DIST_XML"
if ! [ -f "$DIST_XML" ]; then
_success
else
_failure
fi
fi
_msg "Creating distribution.xml"
cp "$SCRIPT_DIR/distribution.xml.dist" "$DIST_XML"
if [ -f "$DIST_XML" ]; then
_success
else
CMD_OUTPUT="Failed to copy: $DIST_XML"
_failure
fi
# We need to do version first because Title contains version and we need to
# be able to check it
_msg "Setting package version"
SED_STR="s/@VERSION@/$VERSION/g"
sed -i "" "$SED_STR" "$DIST_XML"
if grep -q "$VERSION" "$DIST_XML"; then
_success
else
CMD_OUTPUT="Failed to set: $VERSION"
_failure
fi
_msg "Setting package title"
TITLE="Salt $VERSION (Python 3)"
SED_STR="s/@TITLE@/$TITLE/g"
sed -i "" "$SED_STR" "$DIST_XML"
if grep -q "$TITLE" "$DIST_XML"; then
_success
else
CMD_OUTPUT="Failed to set: $TITLE"
_failure
fi
_msg "Setting package description"
DESC="Salt $VERSION with Python 3"
SED_STR="s/@DESC@/$DESC/g"
sed -i "" "$SED_STR" "$DIST_XML"
if grep -q "$DESC" "$DIST_XML"; then
_success
else
CMD_OUTPUT="Failed to set: $DESC"
_failure
fi
_msg "Setting package architecture"
SED_STR="s/@CPU_ARCH@/$CPU_ARCH/g"
sed -i "" "$SED_STR" "$DIST_XML"
if grep -q "$CPU_ARCH" "$DIST_XML"; then
_success
else
CMD_OUTPUT="Failed to set: $CPU_ARCH"
_failure
fi
if [ -d "$SCRIPTS_DIR" ]; then
_msg "Removing existing scripts directory"
rm -f "$SCRIPTS_DIR"
if ! [ -d "$SCRIPTS_DIR" ]; then
_success
else
_failure
fi
fi
_msg "Creating scripts directory"
cp -r "$SCRIPT_DIR/pkg-scripts" "$SCRIPTS_DIR"
if [ -d "$SCRIPTS_DIR" ]; then
_success
else
CMD_OUTPUT="Failed to copy: $SCRIPTS_DIR"
_failure
fi
_msg "Setting python version for preinstall"
SED_STR="s/@PY_VER@/$PY_VER/g"
sed -i "" "$SED_STR" "$SCRIPTS_DIR/preinstall"
if grep -q "$PY_VER" "$SCRIPTS_DIR/preinstall"; then
_success
else
CMD_OUTPUT="Failed to set: $PY_VER"
_failure
fi
#-------------------------------------------------------------------------------
# Build and Sign the Package
#-------------------------------------------------------------------------------
_msg "Building the source package"
# Build the src package
FILE="$SCRIPT_DIR/salt-src-$VERSION-py3-$CPU_ARCH.pkg"
if pkgbuild --root="$BUILD_DIR" \
--scripts="$SCRIPTS_DIR" \
--identifier=com.saltstack.salt \
--version="$VERSION" \
--ownership=recommended \
"$FILE" > "$CMD_OUTPUT" 2>&1; then
_success
else
_failure
fi
PKG_FILE="$SCRIPT_DIR/salt-$VERSION-py3-$CPU_ARCH.pkg"
if [ "${SIGN}" -eq 1 ]; then
_msg "Building the product package (signed)"
# This is not a nightly build, so we want to sign it
FILE="$SCRIPT_DIR/salt-$VERSION-py3-$CPU_ARCH.pkg"
if productbuild --resources="$SCRIPT_DIR/pkg-resources" \
--distribution="$DIST_XML" \
--package-path="$SCRIPT_DIR/salt-src-$VERSION-py3-$CPU_ARCH.pkg" \
--version="$VERSION" \
--sign "$DEV_INSTALL_CERT" \
--timestamp \
"$PKG_FILE" > "$CMD_OUTPUT" 2>&1; then
_success
else
_failure
fi
else
_msg "Building the product package (unsigned)"
# This is a nightly build, so we don't sign it
if productbuild --resources="$SCRIPT_DIR/pkg-resources" \
--distribution="$DIST_XML" \
--package-path="$SCRIPT_DIR/salt-src-$VERSION-py3-$CPU_ARCH.pkg" \
--version="$VERSION" \
"$PKG_FILE" > "$CMD_OUTPUT" 2>&1; then
_success
else
_failure
fi
fi
#-------------------------------------------------------------------------------
# Script Completed
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Building Salt Package Completed"
printf "=%.0s" {1..80}; printf "\n"

View file

@ -0,0 +1,44 @@
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue233;}
{\*\expandedcolortbl;;\csgenericrgb\c0\c0\c91373;}
\vieww12000\viewh14900\viewkind0
\deftab720
\pard\pardeftab720\sa321\partightenfactor0
{\field{\*\fldinst{HYPERLINK "http://saltstack.com/"}}{\fldrslt
\f0\fs24 \cf2 \ul \ulc2 Salt}}
\f0\fs24 has been installed into
\f1 /opt/salt.
\f0 \
Sample configuration files (
\f1 master.dist
\f0 and
\f1 minion.dist
\f0 ) have been installed to
\f1 /etc/salt
\f0 . Create copies of them without the '
\f1 .dist
\f0 ' file extension and edit as you see fit.\
You can also use the
\f1 salt-config.sh
\f0 script to configure Salt. The script is located in the
\f1 /opt/salt/bin
\f0 directory. A symlink to that file is created in
\f1 /usr/local/sbin
\f0 . If
\f1 /usr/local/sbin
\f0 is part of the path you can type
\f1 salt-config --help
\f0 in a bash shell to get config options.\
This Salt package uses its own compiled Python that is not linked to the system Python. To install additional Python modules to Salt's Python environment, use Salt's '
\f1 pip
\f0 ' binary. For example, if you need LDAP support in Salt you will need the '
\f1 python-ldap
\f0 ' module. Install it with the following command:\
\pard\pardeftab720\sa321\partightenfactor0
\f1 \cf0 /opt/salt/bin/pip install python-ldap
\f0 \
Note: Some Python modules need to be compiled. Installing Apple's Xcode Command Line Tools should provide the necessary utilities. Alternatively, {\field{\*\fldinst{HYPERLINK "http://macports.org/"}}{\fldrslt \cf2 \ul \ulc2 MacPorts}}, {\field{\*\fldinst{HYPERLINK "http://finkproject.org/"}}{\fldrslt \cf2 \ul \ulc2 Fink}}, or {\field{\*\fldinst{HYPERLINK "http://brew.sh/"}}{\fldrslt \cf2 \ul \ulc2 Homebrew}} may provide what you need.\
More documentation for Salt is available at {\field{\*\fldinst{HYPERLINK "https://docs.saltproject.io"}}{\fldrslt https://docs.saltproject.io}}\
}

View file

@ -0,0 +1,17 @@
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\vieww12000\viewh14900\viewkind0
\deftab720
\pard\pardeftab720\sl560\sa321\partightenfactor0
\f0\b\fs48 \cf0 Salt - Remote execution system\
\pard\pardeftab720\sl280\sa240\partightenfactor0
\f1\b0\fs24 \cf0 Copyright 2023 SaltProject\
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:\
{\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt http://www.apache.org/licenses/LICENSE-2.0}}\
\pard\pardeftab720\sl276\slmult1\sa200\partightenfactor0
\cf0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

View file

@ -0,0 +1,36 @@
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue233;}
{\*\expandedcolortbl;;\csgenericrgb\c0\c0\c91373;}
\vieww12000\viewh14900\viewkind0
\deftab720
\pard\pardeftab720\sa240\partightenfactor0
{\field{\*\fldinst{HYPERLINK "http://saltstack.com/"}}{\fldrslt
\f0\fs24 \cf2 \ul \ulc2 Salt}}
\f0\fs24 is extremely fast and scalable systems and configuration management software for predictive orchestration, cloud and data center automation, server provisioning, application deployment and more.\
\pard\pardeftab720\sl280\sa240\partightenfactor0
\cf0 This package will install Salt on your Mac. Salt installs into
\f1 /opt/salt
\f0 .\
Sample configuration files (
\f1 master.dist
\f0 and
\f1 minion.dist
\f0 ) will be installed to
\f1 /etc/salt
\f0 . Create copies of them without the '
\f1 .dist
\f0 ' file extension and edit as you see fit.\
\pard\pardeftab720\sa321\partightenfactor0
\cf0 This Salt package uses its own compiled Python that is not linked to the system Python. To install additional Python modules to Salt's Python environment, use Salt's '
\f1 pip
\f0 ' binary. For example, if you need LDAP support in Salt you will need the '
\f1 python-ldap
\f0 ' module. Install it with the following command:\
\f1 /opt/salt/bin/pip install python-ldap
\f0 \
\pard\pardeftab720\sl280\sa240\partightenfactor0
\cf0 Note: Some Python modules need to be compiled. Installing Apple's Xcode Command Line Tools should provide the necessary utilities. Alternatively, {\field{\*\fldinst{HYPERLINK "http://macports.org/"}}{\fldrslt \cf2 \ul \ulc2 MacPorts}}, {\field{\*\fldinst{HYPERLINK "http://finkproject.org/"}}{\fldrslt \cf2 \ul \ulc2 Fink}}, or {\field{\*\fldinst{HYPERLINK "http://brew.sh/"}}{\fldrslt \cf2 \ul \ulc2 Homebrew}} may provide what you need.\
Documentation for Salt is available at {\field{\*\fldinst{HYPERLINK "https://docs.saltproject.io/"}}{\fldrslt \cf2 \ul \ulc2 https://docs.saltproject.io}}\
}

237
pkg/macos/pkg-scripts/postinstall Executable file
View file

@ -0,0 +1,237 @@
#!/bin/bash
###############################################################################
#
# Title: Post Script for Salt Installation
# Authors: Shane Lee
# Date: December 2015
#
# Description: This script copies the minion config file and starts the salt
# service. It also adds /opt/salt to the path.
#
# Requirements:
# - None
#
# Usage:
# This script is run as a part of the macOS Salt Installation
#
###############################################################################
#-------------------------------------------------------------------------------
# Define Variables
#-------------------------------------------------------------------------------
INSTALL_DIR="/opt/salt"
BIN_DIR="$INSTALL_DIR/bin"
CONFIG_DIR="/etc/salt"
TEMP_DIR="/tmp"
SBIN_DIR="/usr/local/sbin"
#-------------------------------------------------------------------------------
# Define Functions
#-------------------------------------------------------------------------------
log () {
if [ -f "$TEMP_DIR/postinstall.txt" ]; then
echo "$1" >> "$TEMP_DIR/postinstall.txt"
else
echo "$1" > "$TEMP_DIR/postinstall.txt"
fi
}
quit_on_error() {
log "$(basename "$0") caught error: $1 on line : $2 command was: $3"
exit 1
}
#-------------------------------------------------------------------------------
# Set up logging and error handling
#-------------------------------------------------------------------------------
log "Post install script started on: $(date '+%Y/%m/%d %H:%M:%S')"
trap 'quit_on_error $? $LINENO $BASH_COMMAND' ERR
#-------------------------------------------------------------------------------
# Check for existing minion config, copy if it doesn't exist
#-------------------------------------------------------------------------------
if [ ! -f "$CONFIG_DIR/minion" ]; then
log "Config: Copy Started..."
cp "$CONFIG_DIR/minion.dist" "$CONFIG_DIR/minion"
if [ -f "$CONFIG_DIR/minion" ]; then
log "Config: Copied Successfully"
else
log "Config: Failed to copy minion config"
log "Config: $CONFIG_DIR/minion"
fi
fi
#-------------------------------------------------------------------------------
# Create symlink to salt-config.sh
#-------------------------------------------------------------------------------
if [ ! -d "$SBIN_DIR" ]; then
log "Symlink: Creating $SBIN_DIR..."
mkdir "$SBIN_DIR"
if [ -d "$SBIN_DIR" ]; then
log "Symlink: Created $SBIN_DIR"
else
log "Symlink: Failed to create $SBIN_DIR"
fi
fi
# This is a special tool to make it easier for the user to get started setting
# up salt
log "Symlink: Creating symlink for salt-config..."
ln -sf "$INSTALL_DIR/salt-config.sh" "$SBIN_DIR/salt-config"
if [ -f "$SBIN_DIR/salt-config" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt..."
ln -sf "$INSTALL_DIR/salt" "$SBIN_DIR/salt"
if [ -f "$SBIN_DIR/salt" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-api..."
ln -sf "$INSTALL_DIR/salt-api" "$SBIN_DIR/salt-api"
if [ -f "$SBIN_DIR/salt-api" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-call..."
ln -sf "$INSTALL_DIR/salt-call" "$SBIN_DIR/salt-call"
if [ -f "$SBIN_DIR/salt-call" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-cloud..."
ln -sf "$INSTALL_DIR/salt-cloud" "$SBIN_DIR/salt-cloud"
if [ -f "$SBIN_DIR/salt-cloud" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-cp..."
ln -sf "$INSTALL_DIR/salt-cp" "$SBIN_DIR/salt-cp"
if [ -f "$SBIN_DIR/salt-cp" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-key..."
ln -sf "$INSTALL_DIR/salt-key" "$SBIN_DIR/salt-key"
if [ -f "$SBIN_DIR/salt-key" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-master..."
ln -sf "$INSTALL_DIR/salt-master" "$SBIN_DIR/salt-master"
if [ -f "$SBIN_DIR/salt-master" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-minion..."
ln -sf "$INSTALL_DIR/salt-minion" "$SBIN_DIR/salt-minion"
if [ -f "$SBIN_DIR/salt-minion" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-proxy..."
ln -sf "$INSTALL_DIR/salt-proxy" "$SBIN_DIR/salt-proxy"
if [ -f "$SBIN_DIR/salt-proxy" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-run..."
ln -sf "$INSTALL_DIR/salt-run" "$SBIN_DIR/salt-run"
if [ -f "$SBIN_DIR/salt-run" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for spm..."
ln -sf "$INSTALL_DIR/spm" "$SBIN_DIR/spm"
if [ -f "$SBIN_DIR/salt-spm" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-ssh..."
ln -sf "$INSTALL_DIR/salt-ssh" "$SBIN_DIR/salt-ssh"
if [ -f "$SBIN_DIR/salt-ssh" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
log "Symlink: Creating symlinks for salt-syndic..."
ln -sf "$INSTALL_DIR/salt-syndic" "$SBIN_DIR/salt-syndic"
if [ -f "$SBIN_DIR/salt-syndic" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi
#-------------------------------------------------------------------------------
# Add salt to paths.d
#-------------------------------------------------------------------------------
if [ ! -d "/etc/paths.d" ]; then
log "Path: Creating paths.d directory..."
mkdir /etc/paths.d
log "Path: Created Successfully"
fi
log "Path: Adding salt to the path..."
sh -c "echo \"$INSTALL_DIR\" > /etc/paths.d/salt"
sh -c "echo \"$INSTALL_DIR\" >> /etc/paths.d/salt"
log "Path: Added Successfully"
#-------------------------------------------------------------------------------
# Register Salt as a service
#-------------------------------------------------------------------------------
log "Service: Configuring..."
log "Service: Enabling salt-minion..."
launchctl enable system/com.saltstack.salt.minion
log "Service: Enabled Successfully"
log "Service: Bootstrapping salt-minion..."
launchctl bootstrap system /Library/LaunchDaemons/com.saltstack.salt.minion.plist
log "Service: Bootstrapped Successfully"
if /bin/launchctl list "com.saltstack.salt.minion" &> /dev/null; then
log "Service: Service Running"
else
log "Service: Kickstarting Service..."
launchctl kickstart -kp system/com.saltstack.salt.minion
log "Service: Kickstarted Successfully"
fi
log "Service: Started Successfully"
log "Service: Disabling Master, Syndic, and API services"
launchctl disable system/com.saltstack.salt.master
launchctl disable system/com.saltstack.salt.syndic
launchctl disable system/com.saltstack.salt.api
log "Service: Disabled Successfully"
log "Service: Configured Successfully"
log "Post install completed successfully on: $(date '+%Y/%m/%d %H:%M:%S')"
exit 0

128
pkg/macos/pkg-scripts/preinstall Executable file
View file

@ -0,0 +1,128 @@
#!/bin/bash
###############################################################################
#
# Title: Pre Install Script for Salt Installation
# Authors: Shane Lee
# Date: December 2015
#
# Description: This script stops the salt minion service before attempting to
# install Salt on macOS. It also removes the /opt/salt
# directory, symlink to salt-config, and salt from paths.d.
#
# Requirements:
# - None
#
# Usage:
# This script is run as a part of the macOS Salt Installation
#
###############################################################################
#-------------------------------------------------------------------------------
# Define Variables
#-------------------------------------------------------------------------------
# Path Variables
INSTALL_DIR="/opt/salt"
BIN_DIR="$INSTALL_DIR/bin"
TEMP_DIR="/tmp"
SBIN_DIR="/usr/local/sbin"
#-------------------------------------------------------------------------------
# Define Functions
#-------------------------------------------------------------------------------
log () {
if [ -f "$TEMP_DIR/preinstall.txt" ]; then
echo "$1" >> "$TEMP_DIR/preinstall.txt"
else
echo "$1" > "$TEMP_DIR/preinstall.txt"
fi
}
quit_on_error() {
# Launchctl returns error code 36 when bootout is in progress, so just return
test "$1" == 36 && return;
log "$(basename "$0") caught error: $1 on line : $2 command was: $3"
exit 1
}
trap 'quit_on_error $? $LINENO $BASH_COMMAND' ERR
#-------------------------------------------------------------------------------
# Start Script
#-------------------------------------------------------------------------------
log "Preinstall started on: $(date '+%Y/%m/%d %H:%M:%S')"
#-------------------------------------------------------------------------------
# Stop the service
#-------------------------------------------------------------------------------
log "Service: Configuring..."
while /bin/launchctl list "com.saltstack.salt.minion" &> /dev/null; do
log "Service: Stopping minion..."
launchctl disable system/com.saltstack.salt.minion
launchctl bootout system /Library/LaunchDaemons/com.saltstack.salt.minion.plist
sleep 1
log "Service: Stopped Successfully"
done
while /bin/launchctl list "com.saltstack.salt.master" &> /dev/null; do
log "Service: Stopping master..."
launchctl disable system/com.saltstack.salt.master
launchctl bootout system /Library/LaunchDaemons/com.saltstack.salt.master.plist
sleep 1
log "Service: Stopped Successfully"
done
while /bin/launchctl list "com.saltstack.salt.syndic" &> /dev/null; do
log "Service: Stopping syndic..."
launchctl disable system/com.saltstack.salt.syndic
launchctl bootout system /Library/LaunchDaemons/com.saltstack.salt.syndic.plist
sleep 1
log "Service: Stopped Successfully"
done
while /bin/launchctl list "com.saltstack.salt.api" &> /dev/null; do
log "Service: Stopping api..."
launchctl disable system/com.saltstack.salt.api
launchctl bootout system /Library/LaunchDaemons/com.saltstack.salt.api.plist
sleep 1
log "Service: Stopped Successfully"
done
log "Service: Configured Successfully"
#-------------------------------------------------------------------------------
# Remove the Symlink to salt-config.sh
#-------------------------------------------------------------------------------
if [ -L "$SBIN_DIR/salt-config" ]; then
log "Cleanup: Removing Symlink $BIN_DIR/salt-config"
rm "$SBIN_DIR/salt-config"
log "Cleanup: Removed Successfully"
fi
#-------------------------------------------------------------------------------
# Remove folders and files from the INSTALL_DIR
# Don't remove extras-3.##
# The part wrapped in `@` will be replaced by the correct version of python
# during packaging using SED
#-------------------------------------------------------------------------------
for dir in "$INSTALL_DIR"/*/; do
if [[ "$dir" != *"extras-@PY_VER@"* ]]; then
log "Cleanup: Removing $dir"
rm -rf "$dir"
fi
done
log "Cleanup: Removed Directories Successfully"
if [ -f "$INSTALL_DIR/salt-minion" ]; then
find $INSTALL_DIR -maxdepth 1 -type f -delete
log "Cleanup: Removed Files Successfully"
fi
#-------------------------------------------------------------------------------
# Remove the salt from the paths.d
#-------------------------------------------------------------------------------
if [ -f "/etc/paths.d/salt" ]; then
log "Path: Removing salt from the path..."
rm "/etc/paths.d/salt"
log "Path: Removed Successfully"
fi
log "Preinstall Completed Successfully on: $(date '+%Y/%m/%d %H:%M:%S')"
exit 0

247
pkg/macos/prep_salt.sh Executable file
View file

@ -0,0 +1,247 @@
#!/bin/bash
################################################################################
#
# Title: Prep the Salt environment for Packaging
#
# Description: This prepares the Salt environment for packaging by removing
# unneeded files, staging configs and plist files, etc.
#
# Requirements:
# - Xcode Command Line Tools (xcode-select --install)
# or
# - Xcode
#
# Usage:
# This script takes no parameters:
#
# Example:
# The following will prepare the Salt environment for packaging:
#
# ./prep_salt.sh
#
################################################################################
#-------------------------------------------------------------------------------
# Script Functions
#-------------------------------------------------------------------------------
# _usage
#
# Prints out help text
_usage() {
echo ""
echo "Script to prep the Salt package:"
echo ""
echo "usage: ${0}"
echo " [-h|--help]"
echo ""
echo " -h, --help this message"
echo " -b, --build-dir the location of the build directory"
echo ""
echo " To build the Salt package:"
echo " example: $0"
}
# _msg
#
# Prints the message with a dash... no new line
_msg() {
printf -- "- %s: " "$1"
}
# _success
#
# Prints a green Success
_success() {
printf "\e[32m%s\e[0m\n" "Success"
}
# _failure
#
# Prints a red Failure and exits
_failure() {
printf "\e[31m%s\e[0m\n" "Failure"
echo "output >>>>>>"
cat "$CMD_OUTPUT" 1>&2
echo "<<<<<< output"
exit 1
}
#-------------------------------------------------------------------------------
# Get Parameters
#-------------------------------------------------------------------------------
while true; do
if [[ -z "$1" ]]; then break; fi
case "$1" in
-h | --help )
_usage
exit 0
;;
-b | --build-dir )
shift
BUILD_DIR="$*"
shift
;;
-* )
echo "Invalid Option: $1"
echo ""
_usage
exit 1
;;
* )
shift
;;
esac
done
#-------------------------------------------------------------------------------
# Script Variables
#-------------------------------------------------------------------------------
SRC_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR="$SCRIPT_DIR/build"
fi
CONF_DIR="$BUILD_DIR/etc/salt"
CMD_OUTPUT=$(mktemp -t cmd.log)
#-------------------------------------------------------------------------------
# Delete temporary files on exit
#-------------------------------------------------------------------------------
function finish {
rm "$CMD_OUTPUT"
}
trap finish EXIT
#-------------------------------------------------------------------------------
# Script Start
#-------------------------------------------------------------------------------
printf "=%.0s" {1..80}; printf "\n"
echo "Prepping Salt Package"
printf -- "-%.0s" {1..80}; printf "\n"
#-------------------------------------------------------------------------------
# Make sure this is the Salt Repository
#-------------------------------------------------------------------------------
if [[ ! -e "$SRC_DIR/.git" ]] && [[ ! -e "$SRC_DIR/scripts/salt" ]]; then
echo "This directory doesn't appear to be a git repository."
echo "The macOS build process needs some files from a Git checkout of Salt."
echo "Run this script from the 'pkg/macos' directory of the Git checkout."
exit 1
fi
#-------------------------------------------------------------------------------
# Copy salt-config from Salt Repo to /opt/salt
#-------------------------------------------------------------------------------
SALT_DIR="$BUILD_DIR/opt/salt"
if ! [ -d "$SALT_DIR" ]; then
# We only need this for relenv builds
mkdir -p "$SALT_DIR"
fi
if ! [ -f "$SALT_DIR/salt-config.sh" ]; then
_msg "Staging Salt config script"
cp "$SCRIPT_DIR/scripts/salt-config.sh" "$SALT_DIR/"
if [ -f "$SALT_DIR/salt-config.sh" ]; then
_success
else
_failure
fi
fi
#-------------------------------------------------------------------------------
# Copy Service Definitions from Salt Repo to the Package Directory
#-------------------------------------------------------------------------------
if ! [ -d "$BUILD_DIR/Library/LaunchDaemons" ]; then
_msg "Creating LaunchDaemons directory"
mkdir -p "$BUILD_DIR/Library/LaunchDaemons"
if [ -d "$BUILD_DIR/Library/LaunchDaemons" ]; then
_success
else
_failure
fi
fi
ITEMS=(
"minion"
"master"
"syndic"
"api"
)
for i in "${ITEMS[@]}"; do
FILE="$BUILD_DIR/Library/LaunchDaemons/com.saltstack.salt.$i.plist"
if ! [ -f "$FILE" ]; then
_msg "Copying $i service definition"
cp "$SCRIPT_DIR/scripts/com.saltstack.salt.$i.plist" "$FILE"
if [ -f "$FILE" ]; then
_success
else
_failure
fi
fi
done
#-------------------------------------------------------------------------------
# Remove unnecessary files from the package
#-------------------------------------------------------------------------------
ITEMS=(
"pkgconfig"
"share"
"__pycache__"
)
for i in "${ITEMS[@]}"; do
if [[ -n $(find "$BUILD_DIR" -name "$i" -type d) ]]; then
_msg "Removing $i directories"
find "$BUILD_DIR" -name "$i" -type d -prune -exec rm -rf {} \;
if [[ -z $(find "$BUILD_DIR" -name "$i" -type d) ]]; then
_success
else
_failure
fi
fi
done
if [[ -n $(find "$BUILD_DIR" -name "*.pyc" -type f) ]]; then
_msg "Removing *.pyc files"
find "$BUILD_DIR" -name "*.pyc" -type f -delete
if [[ -z $(find "$BUILD_DIR" -name "*.pyc" -type f) ]]; then
_success
else
_failure
fi
fi
#-------------------------------------------------------------------------------
# Copy Config Files from Salt Repo to the Package Directory
#-------------------------------------------------------------------------------
if ! [ -d "$CONF_DIR" ]; then
_msg "Creating config directory"
mkdir -p "$CONF_DIR"
if [ -d "$CONF_DIR" ]; then
_success
else
_failure
fi
fi
ITEMS=(
"minion"
"master"
)
for i in "${ITEMS[@]}"; do
if ! [ -f "$CONF_DIR/$i.dist" ]; then
_msg "Copying $i config"
cp "$SRC_DIR/conf/$i" "$CONF_DIR/$i.dist"
if [ -f "$CONF_DIR/$i.dist" ]; then
_success
else
_failure
fi
fi
done
#-------------------------------------------------------------------------------
# Script Completed
#-------------------------------------------------------------------------------
printf -- "-%.0s" {1..80}; printf "\n"
echo "Prepping Salt Package Completed"
printf "=%.0s" {1..80}; printf "\n"

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.saltstack.salt.api</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/opt/salt/salt-api</string>
</array>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<!-- uncomment the lines below to debug launchd issues -->
<!--
<key>StandardOutPath</key>
<string>/tmp/salt-minion.out</string>
<key>StandardErrorPath</key>
<string>/tmp/salt-minion.err</string>
-->
</dict>
</plist>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.saltstack.salt.master</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/opt/salt/salt-master</string>
</array>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<!-- uncomment the lines below to debug launchd issues -->
<!--
<key>StandardOutPath</key>
<string>/tmp/salt-minion.out</string>
<key>StandardErrorPath</key>
<string>/tmp/salt-minion.err</string>
-->
</dict>
</plist>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.saltstack.salt.minion</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/opt/salt/salt-minion</string>
</array>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<!-- uncomment the lines below to debug launchd issues -->
<!--
<key>StandardOutPath</key>
<string>/tmp/salt-minion.out</string>
<key>StandardErrorPath</key>
<string>/tmp/salt-minion.err</string>
-->
</dict>
</plist>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.saltstack.salt.syndic</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/opt/salt/salt-syndic</string>
</array>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>100000</integer>
</dict>
<!-- uncomment the lines below to debug launchd issues -->
<!--
<key>StandardOutPath</key>
<string>/tmp/salt-minion.out</string>
<key>StandardErrorPath</key>
<string>/tmp/salt-minion.err</string>
-->
</dict>
</plist>

108
pkg/macos/scripts/salt-config.sh Executable file
View file

@ -0,0 +1,108 @@
#!/bin/bash
############################################################################
# Commandline Help
############################################################################
display_help() {
echo "################################################################"
echo "Salt Minion Configuration Script"
echo
echo "Use this script to configure the minion id as well as the master"
echo "the minion should connect to. The settings will be changed and"
echo "the service will be restarted. Must be run as sudo"
echo
echo "This script accepts the following parameters:"
echo
echo " -i, --minion-id The ID to assign this minion"
echo " -m, --master The hostname/IP address of the master"
echo " -h, --help Display this help message"
echo
echo "Examples:"
echo
echo " sudo salt-config -i mac_minion -m master.apple.com"
echo
echo " sudo salt-config --minion-id mac_minion --master 10.10.1.10"
echo
echo "################################################################"
exit 1
}
############################################################################
# Parameters
############################################################################
# Initialize Parameters
master=''
minion_id=''
changed=0
CONF_DIR="/etc/salt"
############################################################################
# Check for parameters
############################################################################
# Check for no parameters
if [ $# -eq 0 ] ; then
echo "ERROR: No Parameters Passed"
echo " To see help use --help"
exit 1
fi
# Check for valid parameters
while [ $# -gt 0 ]; do
case "$1" in
-i | --minion-id)
minion_id="$2"
shift 2
;;
-m | --master)
master="$2"
shift 2
;;
-h | --help) # Display Help
display_help
;;
*)
break
esac
done
# Check for additional parameters
if [ -n "$1" ] ; then
echo "ERROR: Unknown Parameter Passed: $1"
echo " To see help use --help"
exit 1
fi
############################################################################
# minion.d directory
############################################################################
if [ ! -d "$CONF_DIR/minion.d" ]; then
mkdir "$CONF_DIR/minion.d"
fi
############################################################################
# Minion ID
############################################################################
if [ -n "$minion_id" ]; then
echo "Changing minion ID: $minion_id"
sed -i '' -e '/id:/ s/^#*/#/' $CONF_DIR/minion
echo "id: $minion_id" > $CONF_DIR/minion.d/minion_id.conf
changed=1
fi
############################################################################
# Master ID
############################################################################
if [ ! -z "$master" ]; then
echo "Changing master: $master"
sed -i '' -e '/master:/ s/^#*/#/' $CONF_DIR/minion
echo "master: $master" > $CONF_DIR/minion.d/master_id.conf
changed=1
fi
############################################################################
# Restart Minion
############################################################################
if (( changed == 1 )); then
echo "Restarting the minion service..."
launchctl kickstart -k system/com.saltstack.salt.minion
fi
exit 0

Some files were not shown because too many files have changed in this diff Show more