HOWTO: Easily modify dependencies of a .deb file – Ubuntu Forums

By , 2010-06-28 10:35
#!/bin/bash
 
if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi
 
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb
 
if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi
 
dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN
 
if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.
 
  rm -r "$TMPDIR"
  exit 1
fi
 
CONTROL="$TMPDIR"/DEBIAN/control
 
MOD=`stat -c "%y" "$CONTROL"`
vi "$CONTROL"
 
if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi
 
rm -r "$TMPDIR"

via HOWTO: Easily modify dependencies of a .deb file – Ubuntu Forums.

Leave a Reply

 

Custom theme by me. Based on Panorama by Themocracy