Created
November 7, 2020 08:20
-
-
Save DrJume/5a1be9b77e33d636bf05bd02d446bf22 to your computer and use it in GitHub Desktop.
Alpine script using ncurses dialog which helps with installing missing *-doc packages from apk
This file contains hidden or 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 | |
[ ! -x "$(command -v dialog)" ] && ( apk add dialog || exit) | |
installed_pkgs=$(apk list -I -q | awk '{ print $1 }' | sed -E 's/(.+)(-[[:digit:]]).+/\1/') | |
installed_pkgs_doc=$(echo "$installed_pkgs" | grep "\-doc") | |
installed_pkgs_without_doc=$(echo "$installed_pkgs" | grep -v '\-doc') | |
installed_pkgs_append_doc=$(echo "$installed_pkgs_without_doc" | awk '{ print $0"-doc" }') | |
potential_pkgs_doc=$(echo "$installed_pkgs_append_doc" | grep -E -v $(echo "$installed_pkgs_doc" | tr '\n' '|' | sed -E 's/\|$//')) | |
missing_pkgs_doc=$(echo "$potential_pkgs_doc" | xargs -n30 | xargs apk -v info -d) | |
checklist_missing_pkgs_doc=$(echo "$missing_pkgs_doc" | sed -E -e 's/([^:]+): (.*)/\1 "\2"/' -e 's/$/ 0/') | |
missing_pkgs_doc_to_install=$(echo "$checklist_missing_pkgs_doc" | xargs dialog --checklist "Select which missing doc packages you want to install:" 0 0 0 3>&1 1>&2 2>&3) | |
dialog --clear | |
clear | |
echo $missing_pkgs_doc_to_install | xargs -r -n30 apk add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://openbook.rheinwerk-verlag.de/shell_programmierung/shell_007_007.htm