- #!/usr/bin/ksh93
- #
- # xorg_proc_package_list.ksh - get list of packages used by Xorg process
- #
- #
- #
- set -o xtrace
- set -o errexit
- set -o nounset
- #
- # builtins&vars
- #
- builtin cat
- typeset s1
- typeset s2
- compound c=(
- integer xorg_pid
- typeset -a mapped_files_ar
- typeset -A package_list
- )
- c.xorg_pid="$(pgrep Xorg)"
- c.mapped_files_ar=(
- $(
- cat "/proc/${c.xorg_pid}/maps" | \
- sed -r 's/[[:xdigit:]]+?-[[:xdigit:]]+? [rwxp-]+ [[:xdigit:]]+? .+? (\/.+?$)/\1/' | \
- egrep '^/' |
- sort -u
- )
- )
- for s1 in "${c.mapped_files_ar[@]}" ; do
- s2="$(apt-file search "$s1" 2>'/dev/null' || true)"
- [[ $s2 != '' ]] || continue
- # extract package name
- s2="${s2/~(El)(.+?):.+/\1}"
- # add result, use package name as index to eliminate duplicates
- c.package_list["$s2"]="$s2"
- done
- #
- # debug data
- #
- print -v c
- #
- # print results
- #
- printf "# Package list:\n"
- printf "%s\n" "${c.package_list[@]}"
- # EOF.
Xorg: print Debian packages used by Xorg process
Posted by Anonymous on Mon 2nd May 2022 13:03
raw | new post
view followups (newest first): Xorg: print Debian packages used by Xorg process by Anonymous
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.