-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpackages.sh
51 lines (46 loc) · 1.72 KB
/
packages.sh
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
#!/usr/bin/env sh
# List of packages to install. This is obviously limited by the fact that
# packages are not called the same in all distributions. The variable has the
# PACKAGE word twice because of naming conventions.
PRIMER_STEP_PACKAGES_PACKAGES=${PRIMER_STEP_PACKAGES_PACKAGES:-}
# Should we freshen up the system with all pending and existing upgrades.
PRIMER_STEP_PACKAGES_FRESH=${PRIMER_STEP_PACKAGES_FRESH:-1}
primer_step_packages() {
case "$1" in
"option")
shift;
[ "$#" = "0" ] && echo "--packages --fresh"
while [ $# -gt 0 ]; do
case "$1" in
--packages)
PRIMER_STEP_PACKAGES_PACKAGES=$2; shift 2;;
--fresh)
PRIMER_STEP_PACKAGES_FRESH=$2; shift 2;;
-*)
yush_warn "Unknown option: $1 !"; shift 2;;
*)
break;;
esac
done
;;
"install")
# Update package index in system
primer_os_update
# Freshen up system to latest
if yush_is_true "$PRIMER_STEP_PACKAGES_FRESH"; then
yush_info "Upgrading and cleaning system"
primer_os_upgrade
fi
if [ -n "$PRIMER_STEP_PACKAGES_PACKAGES" ]; then
# shellcheck disable=SC2086
primer_os_packages add $PRIMER_STEP_PACKAGES_PACKAGES
fi
;;
"clean")
if [ -n "$PRIMER_STEP_PACKAGES_PACKAGES" ]; then
# shellcheck disable=SC2086
primer_os_packages del $PRIMER_STEP_PACKAGES_PACKAGES
fi
;;
esac
}