Skip to content

Instantly share code, notes, and snippets.

@Botspot
Last active January 14, 2022 01:38
Show Gist options
  • Save Botspot/c8f05ca079622079b5550f4f5612e274 to your computer and use it in GitHub Desktop.
Save Botspot/c8f05ca079622079b5550f4f5612e274 to your computer and use it in GitHub Desktop.
Debian version of yad is ancient. This script downloads the debfile, copies in a fresh binary, and rebuilds the deb file.
#!/bin/bash
set -e
#compile yad
sudo apt install -y libgspell-1-dev libwebkit2gtk-4.0-dev intltool libgtksourceview-3.0-dev
cd /tmp
rm -rf ./yad
git clone https://github.com/v1cont/yad
cd ./yad
autoreconf -ivf
intltoolize
./configure
make
cd /tmp
#download yad package
apt download yad || (sudo apt purge -y yad && apt download yad)
#determine architecture of downloaded package
arch="$(echo /tmp/yad_0.40.0-1_*.deb | sed 's/.*_//g' | sed 's/\..*//g')"
#extract old deb
rm -rf /tmp/package
dpkg-deb -R /tmp/yad_0.40.0-1_$arch.deb /tmp/package
#copy newer yad binaries to apt package
cp -f ~/yad/src/yad /tmp/package/usr/bin
cp -f ~/yad/src/yad-icon-browser /tmp/package/usr/bin
cp -f ~/yad/src/yad-tools /tmp/package/usr/bin
cp -f ~/yad/src/yad-settings /tmp/package/usr/bin
chmod +x /tmp/package/usr/bin/yad-settings
#update version
version=$(grep '^AC_INIT' /tmp/yad/configure.ac | awk '{print $2}' | tr -dc '1234567890.\n')
sed -i "s/^Version: 0.40.0-1$/Version: $version/g" /tmp/package/DEBIAN/control
#package back into deb
dpkg-deb -b /tmp/package /tmp/yad_${version}_$arch.deb
#remove the extracted folder and old deb
rm -rf /tmp/package /tmp/yad_0.40.0-1_$arch.deb /tmp/yad
echo -e "\nDone. New package: /tmp/yad_${version}_$arch.deb"
unset arch
unset version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment