Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- CWD="$(realpath .)"
- output_file=${1:-./pkg_contents_list_files}
- if [ $# -eq 0 ]; then
- set -- /var/packages/user-installed-packages /var/packages/woof-installed-packages
- fi
- shift
- function replace_extension(){
- while read a_record; do
- case
- done
- }
- rm "$output_file"
- for a_file_path in "$@"; do
- a_file_path="$(realpath "$a_file")"
- a_file=$(basename "$a_file_path")
- a_dir="$(dirname "$a_file")"
- cd "$a_dir"
- #We can 't foward Standard error
- old_setting=${-//[^x]/} #https://stackoverflow.com/questions/14564746/in-bash-how-to-get-the-current-status-of-set-x
- case "$a_file" in
- */builtin_files)
- cut -f2,3,8 -d '|' "$a_file" | sed -n 's#$#\|builtin_files\|#g' | sed -r 's#(^.*)(\|[^[|]+)(.deb|.pet)\|#\2.list\1#g' >> output_file
- ;;
- */packages)
- cut -f2,3,8 -d '|' "$a_file" | sed -n 's#$#\|builtin_files\|#g' | sed -r 's#(^.*)(\|[^[|]+)(.deb|.pet)\|#\2.list\1#g' >> output_file
- ;;
- */dpkg)
- cut -f2,3,8 -d '|' "$a_file" | sed -n 's#$#\|builtin_files\|#g' | sed -r 's#(^.*)(\|[^[|]+)(.deb|.pet)\|#\2.list\1#g' >> output_file
- ;;
- esac
- if [[ -n "$old_setting" ]]; then set -x; else set +x; fi
- done
Advertisement
Add Comment
Please, Sign In to add comment