Skip to content

Instantly share code, notes, and snippets.

@kylejeske
Created April 26, 2019 10:17
Show Gist options
  • Save kylejeske/782f7578123dbc85525ec7a787c61780 to your computer and use it in GitHub Desktop.
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
#!/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