Skip to content

Instantly share code, notes, and snippets.

@smoser
Last active January 31, 2016 15:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smoser/4f7e9dd5aa3fa49e7667 to your computer and use it in GitHub Desktop.
Save smoser/4f7e9dd5aa3fa49e7667 to your computer and use it in GitHub Desktop.
build-pentadactyl: build pentadactyl from git or mercurial on ubuntu

Build Pentadactyl on Ubuntu

This builds pentadactl on Ubuntu in a simple './build-pentadactyl'. I use it since daily builds have been sporadic.

Issues

  • issue 95: not working entirely correctly on firefox 42
  • issue 79: signing enforcement of firefox 44 and later (warning only in 42, 43) will need to be addressed.
  • issue 99: Future development of Pentadactyl
#!/bin/sh
# https://gist.github.com/smoser/4f7e9dd5aa3fa49e7667
#
# as of december 2014 there are no daily builds of pentadactyl on http://5digits.org/nightlies
# and the ones available do not support firefox at version 35.0
# so this will build pentadactyl on an ubuntu system and write
# pentadactyl-1.2pre.xpi in the directory you run it in.
# then just point firefox at that via: file:///path/to/file.xpi to install
REPO="http://dactyl.googlecode.com/hg/"
REPO="https://github.com/5digits/dactyl.git"
_APT_UPDATED=false
TEMP_D=""
SUCCESS=0
error() { echo "$@" 1>&2; }
fail() { [ $# -eq 0 ] || error "$@"; exit 2; }
apt_get() {
local ret=""
if [ "$1" != "update" ] && ! $_APT_UPDATED; then
error "updating apt"
apt_get update >/dev/null || {
ret=$?;
error "failed to update apt [$ret]";
return $ret;
}
_APT_UPDATED=true
fi
sudo DEBIAN_FRONTEND=noninteractive apt-get --quiet --assume-yes "$@"
}
filter_installed_packages() {
# write to stdout, a list of packages not installed locally
local fmt='${Package} ${Version}\n'
LC_ALL=C dpkg-query --show "--showformat=${fmt}" "$@" 2>&1 | awk '
$0 ~ /[Nn]o packages/ {
sub("[.]$","",$NF);
pkgs[n]=$NF;
n=n+1;
}
$2 == "" {
pkgs[n]=$1;
n=n+1;
};
END { for(p in pkgs) {printf("%s ",pkgs[p])}; printf("\n"); }' n=0
}
apt_install() {
local needed
needed=$(filter_installed_packages "$@")
[ -z "$needed" ] && return 0
error "installing: $needed"
apt_get install "$@"
}
cleanup() {
[ -d "$TEMP_D" ] || return 0
if [ "${SUCCESS:-0}" = "0" ]; then
error "leaving '$TEMP_D' in place for failure"
else
rm -Rf "$TEMP_D"
fi
}
deps="zip make cloud-guest-utils"
apt_install $deps
TEMP_D=$(mktemp -d ${TMPDIR:-/tmp}/${0##*/}.XXXXXX)
trap cleanup EXIT
start=$PWD
## vcs-run is in trusty (via cloud-guest-utils)
vcs-run --deps --target=dactyl $REPO /bin/true ||
fail "failed clone of $REPO"
cd dactyl
# taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pentadactyl-git
sed -i 's/maxVersion="[^"]*/maxVersion="44/' pentadactyl/install.rdf
make -C pentadactyl xpi ||
fail "failed make -C pentadactyl xpi"
for out in downloads/*; do
[ -f "$out" ] || continue
cp "$out" "$start/${out##*/}"
wrote="${wrote} ${out##*/}"
done
wrote=${wrote# }
[ -n "$wrote" ] || fail "no files in download"
SUCCESS=1
error wrote "${wrote#,}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment