diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-09-09 13:24:45 -0300 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-09-09 13:53:51 -0400 |
commit | bf0378257afcb8fa2542e5cf904691ec5fdd74b1 (patch) | |
tree | 75f40e2d5544632a0eae7137ca394181f36ab369 | |
parent | b567cded32e58388f4c88ea04e15bdc86e585a13 (diff) |
[feat] use docker to test .deb packages
Add scripts to easily test (stable or unstable) debian packages.
- Resolves: #6715
-rwxr-xr-x | docker/debian/apt-bitmask.sh | 122 | ||||
-rwxr-xr-x | docker/debian/bitmask-on-docker.sh | 23 | ||||
-rw-r--r-- | docker/debian/leap-experimental.key | 52 | ||||
-rwxr-xr-x | docker/debian/run-docker-for-bitmask.sh | 22 |
4 files changed, 219 insertions, 0 deletions
diff --git a/docker/debian/apt-bitmask.sh b/docker/debian/apt-bitmask.sh new file mode 100755 index 00000000..68430aff --- /dev/null +++ b/docker/debian/apt-bitmask.sh @@ -0,0 +1,122 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +distro(){ + # for ubuntu/mint: + name=`lsb_release -a 2>&1 | grep Codename | cut -f2` + + # for debian: + [[ -z $name ]] && name=`grep -oP "VERSION=.*\(\K\w+" /etc/os-release` + + # for debian sid + [[ -z $name ]] && name=`grep -o sid /etc/debian_version` + + declare -A distros + distros=( + ['nadia']='quantal' + ['olivia']='raring' + ['petra']='saucy' + ['qiana']='trusty' + ['rebecca']='trusty' + ['rafaela']='trusty' + ) + + # if name is in the above list -> replace + [ ${distros[$name]+abc} ] && name=${distros[$name]} + + echo $name | tr "[A-Z]" "[a-z]" +} + +is_supported(){ + distros=( + 'wheezy' # Debian 7 - stable + 'jessie' # Debian 8 - testing + 'sid' # Debian unstable + 'quantal' # Ubuntu 12.10 + 'raring' # Ubuntu 13.04 + 'saucy' # Ubuntu 13.10 + 'trusty' # Ubuntu 14.04 + 'utopic' # Ubuntu 14.10 + 'vivid' # Ubuntu 15.04 + ) + + my_distro=`distro` + + for p in "${distros[@]}"; do + if [[ $my_distro = ${p}* ]]; then + echo true + return + fi + done + echo false +} + +if [[ `is_supported` == "false" ]]; then + echo "ERROR: Sorry, your distro (`distro`) is currently not supported." + exit 1 +fi; + +help() { + echo ">> Bitmask .deb automatic installer helper" + echo "This script does all the needed stuff in order to get bitmask stable or unstable into your machine." + echo + echo "Usage: $0 ( stable | unstable | help )" + echo + echo " stable : Install the stable bitmask package." + echo " unstable : Install the unstable bitmask package." + echo " help : Show this help" + echo + echo "NOTE: you need to run this with root privileges." + echo +} + +case ${1:-} in + stable) + REPO='debian' + ;; + unstable) + REPO='experimental' + ;; + *) + help + exit 1 + ;; +esac + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +# ------------------------------- +# instructions from http://deb.leap.se/experimental/ +# run this with admin privileges + +DISTRO=`distro` + +if [[ $REPO == 'debian' ]]; then + # stable + # wget -O- https://dl.bitmask.net/apt.key | apt-key add - + + # HACK: do this twice since the first one fails due to gpg not having a configuration + gpg --recv-key 0x1E34A1828E207901 &> /dev/null || true + gpg --recv-key 0x1E34A1828E207901 + + gpg --armor --export 0x1E34A1828E207901 | apt-key add - +else # $REPO == 'experimental' + if [[ ! -f "leap-experimental.key" ]]; then + echo "ERROR: you need to copy the leap-experimental.key file into this directory." + exit 1 + fi + + # sha256sum leap-experimental.key + echo "ed3f4f3e3e0835a044457451755ae743741d7bafa55bcd31cc464a54e8c5e7f9 leap-experimental.key" | sha256sum -c - + apt-key add leap-experimental.key +fi + +echo "deb http://deb.leap.se/$REPO $DISTRO main" > /etc/apt/sources.list.d/bitmask.list +echo "deb-src http://deb.leap.se/$REPO $DISTRO main" >> /etc/apt/sources.list.d/bitmask.list + +apt-get update +apt-get install -y bitmask diff --git a/docker/debian/bitmask-on-docker.sh b/docker/debian/bitmask-on-docker.sh new file mode 100755 index 00000000..c3e42b22 --- /dev/null +++ b/docker/debian/bitmask-on-docker.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Helper script to install, run and do a screenshot of bitmask + +# You can use this as follows: +# $ docker run -t -i --rm -v `pwd`:/host/ ubuntu:14.04 /bin/bash +# $ cd /host/ +# $ ./bitmask-on-docker.sh stable + +[[ -z $1 ]] && exit 1 + +./apt-bitmask.sh $1 # this does an `apt-get update` +apt-get -y install xinit xvfb imagemagick lxpolkit + +startx -- `which Xvfb` :1 -screen 0 1024x768x24 & +sleep 1 + +DISPLAY=:1 lxpolkit & +sleep 0.5 # bitmask needs polkit to work + +DISPLAY=:1 bitmask & +sleep 2 # wait for bitmask to start + +DISPLAY=:1 import -window root bitmask.png diff --git a/docker/debian/leap-experimental.key b/docker/debian/leap-experimental.key new file mode 100644 index 00000000..a07ec44c --- /dev/null +++ b/docker/debian/leap-experimental.key @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.12 (GNU/Linux) + +mQINBFRiYXMBEAC/96OXISCU9kndpa7zYedBd4NzXppk1hRPDgGH5Ccl7mFYRaaY +abKOJuilvMThBn2GelFRVXrhFT0K6TVCbrAaLHpb7KGpaxgKY/a+mYCA9BAtYkvR +ru4Xh6VhozI5hDlIDCD5og96d7ymYjVaxiN89ilh4j8TL5Bh4PoCaxIbmxHiVmtM +fIKw9LPAvpViC+8iS+x751plK8NFe4lAbSycWh3AdDfM5wSlUpEa1FwFuilo4Jya +upEY9Uk5qLlNTFTBJmVEwKFXT0swb2o62EzN4LbW7yNC69Ign+G+PCNBiYhIdUKJ +6dPAUexaSAxW6NPf/rdMVHY6tBlx41lzPvnF3ysnsoxKGdoU/Jbri4cIJRikMnzW +GFCJmUdEPkAkkKHgGXCipvrM6Amhmp3Kg5PQUIjRafH9CBo0bsPSordtk/GarMe+ +8fxZ0rjyLN17hsgwWKCWBIBvPAB0UTh22xjNDh4jmehn5ijdjqKatchcEu9MsSPA +l5r0aU+cDLghw6c8TmbqYfOK2nkbwBVkctWjlVohnO1PAOdxwQ0gFoZf3o9Q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ZgPtwq6F/9L3DQeSmwXey5Q2wBbEGLJ/IWHhiDXG6IDy2Go41M0WCojit0b7hm +70mLptA1rIDDs/T/u0MJ3QmkUxqj7+J3l4T3d0Fh2z/KKTdBJhGvx5h2QjxohIjp +b6JsAIBjl85rTqk6yiX8ct/i9LXqA4luEb47Sl1kc2WQyZv6VPmisBeazDXnnpc1 +5vuOdLqp0JhC+iaGPvkQs+ojQBSdIqnYpD0EmircvoW5yhtLflMZdPr3KeFJxmUp +I9i+ZSm7sc6kehlcGqzLr/p7WZvJBmH92AgEpicqDhJe +=10ZN +-----END PGP PUBLIC KEY BLOCK----- diff --git a/docker/debian/run-docker-for-bitmask.sh b/docker/debian/run-docker-for-bitmask.sh new file mode 100755 index 00000000..9ffb400b --- /dev/null +++ b/docker/debian/run-docker-for-bitmask.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# NOTE: to get X11 socket forwarding to work we need this +xhost local:root + +docker run --rm -it \ + --net host \ + --privileged \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v `pwd`:/host/ \ + -p 1984:1984 -p 2013:2013 \ + ubuntu:vivid bash + +# NOTE: what to do next? +# Install bitmask package: +# $ apt-bitmask.sh stable +# Install polkit agent (bitmask needs it): +# $ apt-get install lxpolkit +# Run polkit in background: +# $ lxpolkit & # this will show you a message like: 'No session for pid 5801', ignore it +# Run bitmask: +# $ bitmask -d |