Created
April 26, 2019 10:17
-
-
Save kylejeske/782f7578123dbc85525ec7a787c61780 to your computer and use it in GitHub Desktop.
Alpine Linux with APK package manager: Get installed packages and turn them into an install command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# should print out: | |
# apk add [all packages installed] | |
{ | |
set -e; | |
packages=$(apk info -vv | sort | awk "{print $1}" | cut -d" " -f0 | tr "\n" " "); | |
printf "apk add %s" "$packages"; | |
exit 0; | |
} || echo "Something went wrong. Error: $!"; exit 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment