diff options
author | Nikos Giotis <nikos.giotis@gmail.com> | 2018-08-26 10:50:57 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-09-01 07:32:23 +0700 |
commit | c73367005b0d714c90c3cf89589dcbb0b34fa83a (patch) | |
tree | d3dfda6718959231ebf5bd0e0e9fbe760d0f6df0 /system/vms | |
parent | ec62aff721553a3becf47203c7b2aba04965e18f (diff) | |
download | slackbuilds-c73367005b0d714c90c3cf89589dcbb0b34fa83a.tar.gz |
system/vms: Added (Bash scripts for QEMU).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/vms')
-rw-r--r-- | system/vms/README | 29 | ||||
-rw-r--r-- | system/vms/doinst.sh | 26 | ||||
-rw-r--r-- | system/vms/slack-desc | 19 | ||||
-rw-r--r-- | system/vms/vms.SlackBuild | 84 | ||||
-rw-r--r-- | system/vms/vms.info | 10 |
5 files changed, 168 insertions, 0 deletions
diff --git a/system/vms/README b/system/vms/README new file mode 100644 index 0000000000..6932901efb --- /dev/null +++ b/system/vms/README @@ -0,0 +1,29 @@ +A collection of `bash` scripts for running `qemu` virtual machines + +## Requirements +To use vnc a `vncviewer` such as `tigervnc` from `extra` is required. + +## Description +Simple `bash` scripts for easy creation and managing `qemu` virtual +machines. The whole system is to be used as a helper to generate the +`qemu` command line using a single configuration file for each user of +the system `~/.vms/vms.conf`. + +A command line utility is provided, `vms` that can be used to create +and manage virtual machines. The user edits his `~/.vms/vms.conf` file +to add more options, such as more devices or raw `qemu` command line +options. The `vms` utility can also be used to list, start, stop, kill +the configured virtual machines and provides access to vnc, serial and +`qemu` monitor consoles. + +It has minimal dependencies, `bash` and `qemu` are needed for most of +the functionality. `vms stop` uses `socat`, `vms monitor` uses +`unixterm` from the `vde2` package, `vms serial` uses `minicom` and +`vms vnc` needs `vncviewer`. + +An init script `rc.vms` is also provided with a simple mechanism for +the administrator to enable booting any user's virtual machine on boot +by editing `rc.vms.conf`. + +As a bonus two scripts are provided, `pci-stub-bind` and `vfio-bind` +to ease the pain when using pci passthrough. diff --git a/system/vms/doinst.sh b/system/vms/doinst.sh new file mode 100644 index 0000000000..7a5191e6fa --- /dev/null +++ b/system/vms/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.vms.new +config etc/rc.d/rc.vms.conf.new diff --git a/system/vms/slack-desc b/system/vms/slack-desc new file mode 100644 index 0000000000..72fccc282c --- /dev/null +++ b/system/vms/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +vms: vms (More qemu virtual machines!) +vms: +vms: A collection of bash scripts for running qemu virtual machines +vms: +vms: Homepage: https://bitbucket.org/yotis/vms +vms: +vms: +vms: +vms: +vms: +vms: diff --git a/system/vms/vms.SlackBuild b/system/vms/vms.SlackBuild new file mode 100644 index 0000000000..8f1f7c6859 --- /dev/null +++ b/system/vms/vms.SlackBuild @@ -0,0 +1,84 @@ +#!/bin/sh + +# Slackware build script for vms +# Copyright 2018 Nikos Giotis, Athens, Greece +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=vms +VERSION=${VERSION:-0.1.1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +cp -a src/* $PKG +mv $PKG/etc/rc.d/rc.vms $PKG/etc/rc.d/rc.vms.new +mv $PKG/etc/rc.d/rc.vms.conf $PKG/etc/rc.d/rc.vms.conf.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README* $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/vms/vms.info b/system/vms/vms.info new file mode 100644 index 0000000000..836e739ff9 --- /dev/null +++ b/system/vms/vms.info @@ -0,0 +1,10 @@ +PRGNAM="vms" +VERSION="0.1.1" +HOMEPAGE="https://bitbucket.org/yotis/vms" +DOWNLOAD="https://bitbucket.org/yotis/vms/downloads/vms-0.1.1.tar.gz" +MD5SUM="467dfc0609c26f1c2a42c1b1a360e6c3" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="qemu socat vde2" +MAINTAINER="Nikos Giotis" +EMAIL="nikos.giotis@gmail.com" |