Skip to content

Instantly share code, notes, and snippets.

@Low-power
Last active September 26, 2019 09:15
Show Gist options
  • Save Low-power/543b6db305855776543c84564943697f to your computer and use it in GitHub Desktop.
Save Low-power/543b6db305855776543c84564943697f to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
[ -n "$BASH" ] && set +H
if ! grep -q -e ^9\\. -e ^10\\. /etc/debian_version; then
echo "Should be Debian 9 or 10" 1>&2
exit 1
fi
if [ "`dpkg --print-architecture`" != amd64 ]; then
echo "Should be amd64" 1>&2
exit 1
fi
for f in /usr/bin/vim /usr/bin/vim.basic /usr/bin/vim.gtk /usr/bin/vim.tiny; do
[ -x $f ] || continue
if ! $f --version | sed 1!d | grep -q '^VIM - Vi IMproved 8\.'; then
echo "Not VIM 8" 1>&2
exit 0
fi
apt-get --yes remove vim vim-tiny vim-common vim-runtime xxd
break
done
cd /tmp
#wget http://ftp.cn.debian.org/debian/pool/main/v/vim/vim_7.4.488-7+deb8u3_amd64.deb http://ftp.cn.debian.org/debian/pool/main/v/vim/vim-common_7.4.488-7+deb8u3_amd64.deb http://ftp.cn.debian.org/debian/pool/main/v/vim/vim-runtime_7.4.488-7+deb8u3_all.deb
[ -f vim_7.4.488-7+deb8u3_amd64.deb ] || wget http://ftp.cn.debian.org/debian/pool/main/v/vim/vim_7.4.488-7+deb8u3_amd64.deb
[ -f vim-common_7.4.488-7+deb8u3_amd64.deb ] || wget http://ftp.cn.debian.org/debian/pool/main/v/vim/vim-common_7.4.488-7+deb8u3_amd64.deb
[ -f vim-runtime_7.4.488-7+deb8u3_all.deb ] || wget http://ftp.cn.debian.org/debian/pool/main/v/vim/vim-runtime_7.4.488-7+deb8u3_all.deb
dpkg --unpack --force-confold vim-runtime_7.4.488-7+deb8u3_all.deb vim-common_7.4.488-7+deb8u3_amd64.deb vim_7.4.488-7+deb8u3_amd64.deb || true
apt-mark hold vim vim-common vim-runtime
apt-get --option Dpkg::Options::=--force-confold --yes --fix-broken install
dpkg --configure --force-confold vim-runtime vim-common vim
rm -f vim_7.4.488-7+deb8u3_amd64.deb vim-common_7.4.488-7+deb8u3_amd64.deb vim-runtime_7.4.488-7+deb8u3_all.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment