Clean and reorganize some utility scripts

This commit is contained in:
2015-01-16 11:33:35 +00:00
parent 789b9a56bc
commit c065a72a5d
13 changed files with 2 additions and 129 deletions

View File

@@ -1 +0,0 @@
lxc-attach -n `docker ps --no-trunc | grep $1: | cut -d' ' -f1`

View File

@@ -1,4 +1 @@
DIR=`pwd`
cd /opt/docker/images/$1/
make $2
cd $DIR
make -f $DOCKER_HOME/images/$1.mk $2

32
bin/run
View File

@@ -1,31 +1 @@
#!/bin/bash
# Arguments:
# $1 = redirected ? -t : <image>
# $2 = redirected ? <image> : <mode>
# $3 = redirected ? <options> : <command>
# When redirected:
# $4 = <mode>
# $5 = <command>
if [ -n "$1" ] && [ $1 == "-t" ]; then
HOST_ADDR=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
PARAMS="--rm -e HOST_ADDR=$HOST_ADDR $3 --name $2"
if [ -n "$4" ] && [ $4 == "-i" ]; then
# Run without services, provide shell
docker run $PARAMS -i -t $2 bash
elif [ -n "$4" ] && [ $4 == "-x" ]; then
# Run with services, provide shell
docker run $PARAMS -i -t $2 /opt/init -- bash -l
elif [ -n "$4" ] && [ $4 == "-c" ] && [ -n "$5" ]; then
# Run with services, provide shell
docker run $PARAMS -i -t $2 /opt/init -- $5
elif [ -n "$4" ] && [ $4 == "-w" ]; then
# Run without services
docker run $PARAMS $2
else
# Run with services
docker run $PARAMS $2 /opt/init
fi
else
/opt/docker/bin/clean # > /dev/null 2>&1
/opt/docker/images/$1/bin/run $2 $3
fi
docker run -it $1 /bin/bash

View File

@@ -1,7 +0,0 @@
include /opt/docker/build/Makefile
NAME = btsync
VERSION = latest
RUN = -p 8888:8888 -v /opt/docker/images/btsync/fs:/host
build: base btsync

View File

@@ -1,6 +0,0 @@
include /opt/docker/build/Makefile
NAME = chrome
VERSION = latest
build: base pulseaudio chrome

View File

@@ -1,5 +0,0 @@
FROM ubuntu:precise
ADD build /build
RUN for s in /build/scripts/*.sh; do [ -x $s ] && $s || : ; done

View File

@@ -1,6 +0,0 @@
include /opt/docker/build/Makefile
NAME = firefox
VERSION = latest
build: base pulseaudio firefox

View File

@@ -1,7 +0,0 @@
ARGS="-v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/shm:/dev/shm -v /run/user/${UID}/pulse:/run/user/${UID}/pulse"
DIR=`dirname $0`
DIR=`readlink -e $DIR`
BASE=`basename $DIR`
IFS='/' read -ra ADDR <<< "$DIR"
CONTAINER=${ADDR[-2]}
/opt/docker/bin/run -t $CONTAINER "$ARGS" $1 "$2"

View File

@@ -1,7 +0,0 @@
include /opt/docker/build/Makefile
NAME = hamachi
VERSION = latest
RUN = --privileged -v /opt/docker/images/hamachi/fs:/host
build: base hamachi

View File

@@ -1,7 +0,0 @@
include /opt/docker/build/Makefile
NAME = mpd
VERSION = latest
RUN = -p 6600:6600 -p 8000:8000
build: base pulseaudio mpd

View File

@@ -1,8 +0,0 @@
<?php
$cfg['blowfish_secret'] = 'a8b7c6d';
$cfg['Servers'][1]['auth_type'] = 'cookie';
$cfg['Servers'][1]['connect_type'] = 'tcp';
$cfg['Servers'][1]['host'] = 'mysql';
$cfg['Servers'][1]['compress'] = false;
$cfg['Servers'][1]['extension'] = 'mysqli';
$cfg['Servers'][1]['AllowNoPassword'] = true;

View File

@@ -1,33 +0,0 @@
FROM ubuntu:precise
RUN apt-get update
RUN apt-get install -y wget gcc make
ENV REDIS_VERSION stable
RUN cd /opt && \
wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz && \
tar xzf redis-$REDIS_VERSION.tar.gz && \
cd redis-$REDIS_VERSION && \
make
RUN chmod +x /opt/redis-$REDIS_VERSION/src/redis-server
ENV REDIS_CONFIG /etc/redis/redis-server.conf
ENV REDIS_LOG /host/var/log/redis/redis-server.log
ENV REDIS_DATA /host/var/lib/redis
RUN mkdir -p `dirname $REDIS_CONFIG`
RUN cp /opt/redis-$REDIS_VERSION/redis.conf $REDIS_CONFIG
RUN sed -i "s,^\(logfile\s*\).*$,\1$REDIS_LOG," $REDIS_CONFIG
RUN sed -i "s,^\(dir\s*\).*$,\1$REDIS_DATA," $REDIS_CONFIG
VOLUME [ "/host" ]
EXPOSE 6379
ENV LD_LIBRARY_PATH /root/lib
RUN mkdir $LD_LIBRARY_PATH
RUN cp /lib/x86_64-linux-gnu/libnss_files.so.2 $LD_LIBRARY_PATH
RUN perl -pi -e 's:/etc/hosts:/tmp/hosts:g' $LD_LIBRARY_PATH/libnss_files.so.2
CMD /host/bin/run

View File

@@ -1,7 +0,0 @@
include /opt/docker/build/Makefile
NAME = redis
VERSION = latest
RUN = -p 6379:6379 -v /opt/docker/images/$CONTAINER/fs:/host
build: base redis