Merge "Support declarative package installs/uninstalls"
This commit is contained in:
commit
dde3360057
3 changed files with 43 additions and 0 deletions
8
elements/package-installs/README.rst
Normal file
8
elements/package-installs/README.rst
Normal file
|
@ -0,0 +1,8 @@
|
|||
The package-installs element allows for a declarative method of installing and
|
||||
uninstalling packages for an image build. Adding a file under your elements
|
||||
install.d directory called package-installs-<element-name> will cause the list
|
||||
of packages in that file to be installed at the beginning of the install.d
|
||||
phase.
|
||||
|
||||
If the package name in the file starts with a "-", then that package will be
|
||||
removed at the end of the install.d phase.
|
17
elements/package-installs/install.d/00-package-installs
Executable file
17
elements/package-installs/install.d/00-package-installs
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
PACKAGES=
|
||||
|
||||
for PACKAGEFILE in $(find $(dirname $0) -maxdepth 1 -name "package-installs-*" ); do
|
||||
while read pkg; do
|
||||
if [ ${pkg:0:1} = "-" ]; then
|
||||
pkg=${pkg:1}
|
||||
fi
|
||||
PACKAGES="$PACKAGES $pkg"
|
||||
done < $PACKAGEFILE
|
||||
done
|
||||
|
||||
install-packages $PACKAGES
|
18
elements/package-installs/install.d/99-package-uninstalls
Executable file
18
elements/package-installs/install.d/99-package-uninstalls
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
PACKAGES=
|
||||
|
||||
for PACKAGEFILE in $(find $(dirname $0) -maxdepth 1 -name "package-installs-*" ); do
|
||||
while read pkg; do
|
||||
if [ ! ${pkg:0:1} = "-" ]; then
|
||||
continue
|
||||
fi
|
||||
pkg=${pkg:1}
|
||||
PACKAGES="$PACKAGES $pkg"
|
||||
done < $PACKAGEFILE
|
||||
done
|
||||
|
||||
install-packages -e $PACKAGES
|
Loading…
Reference in a new issue