Skip to content

Instantly share code, notes, and snippets.

@carpntr
Created November 20, 2021 17:35
Show Gist options
  • Save carpntr/2766531f204b957ab723ea3647d2b047 to your computer and use it in GitHub Desktop.
Save carpntr/2766531f204b957ab723ea3647d2b047 to your computer and use it in GitHub Desktop.
rebuild (install) debian packages that depend on libappindicator with libayatana-appindicator (tested on debian 11 with discord and keeweb)
#!/bin/bash
function usage() {
cat <<USAGE
Usage: $0 [options] <package.deb>
Options:
--install: install after rebuild
--cleanup: remove tmpfiles after
USAGE
exit 1
}
INSTALL=false
CLEANUP=false
while [ "$1" != "" ]; do
case $1 in
--install)
INSTALL=true
;;
--cleanup)
CLEANUP=true
;;
*)
PKG=$1
NEWPKGNAME=`echo $PKG | awk 'BEGIN{FS=OFS="."}{NF--; print $0"-fixed.deb"}'`
;;
esac
shift
done
TMP=/tmp/tmp-replace-appindicator
rm -r $TMP
mkdir -p $TMP
dpkg-deb -x $PKG $TMP/unpacked
dpkg-deb -e $PKG $TMP/unpacked/DEBIAN
sed -i 's/libappindicator/libayatana-appindicator/g' $TMP/unpacked/DEBIAN/control
dpkg -b $TMP/unpacked $NEWPKGNAME
if [[ $INSTALL == true ]]; then
echo "installing $NEWPKGNAME"
sudo apt --yes --fix-broken install ./$NEWPKGNAME
fi
if [[ $CLEANUP == true ]]; then
echo "cleaning up $TMP"
rm -r $TMP
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment