-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathshell.pkg
More file actions
executable file
·54 lines (43 loc) · 1.41 KB
/
Copy pathshell.pkg
File metadata and controls
executable file
·54 lines (43 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
:<<DOCUMENTATION
Description: Defines very basic functions for package management.
Author: Chris Wells (https://chriswells.io)
DOCUMENTATION
################################################################################
# Package Management for Hosts
################################################################################
# Parameters:
# $1 = name of the package to check for
# Returns:
# result code indicating whether the specified package is installed on the host
hasPackage() {
pkg info "$1" > /dev/null 2>&1
}
# Parameters:
# $1 = name of the package(s) to install
# Returns:
# result code indicating whether the specified package was installed on the host
installPackages() {
# shellcheck disable=SC2086
pkg install -y $1
}
################################################################################
# Package Management for Jails
################################################################################
# Parameters:
# $1 = name of the jail
# $2 = name of the package to check for
# Returns:
# result code indicating whether the specified package is installed in the jail
jailHasPackage() {
pkg -j "$1" info "$2" > /dev/null 2>&1
}
# Parameters:
# $1 = name of the jail
# $2 = name of the package(s) to install
# Returns:
# result code indicating whether the specified package was installed in the jail
jailPackages() {
# shellcheck disable=SC2086
pkg -j "$1" install -y $2
}