adds setup and util scripts

This commit is contained in:
Leandro Moreira
2017-01-27 22:09:45 -02:00
parent c5f381757c
commit 98b8d14f69
2 changed files with 44 additions and 0 deletions

26
clean_docker.sh Executable file
View File

@@ -0,0 +1,26 @@
EXITED=$(docker ps -q -f status=exited)
DANGLING=$(docker images -q -f "dangling=true")
DANGLING_VOLUME=$(docker volume ls -qf "dangling=true")
if [ "$1" == "--dry-run" ]; then
echo "==> Would stop containers:"
echo $EXITED
echo "==> And images:"
echo $DANGLING
else
if [ -n "$EXITED" ]; then
docker rm $EXITED
else
echo "No containers to remove."
fi
if [ -n "$DANGLING" ]; then
docker rmi $DANGLING
else
echo "No images to remove."
fi
if [ -n "$DANGLING_VOLUME" ]; then
docker volume rm $DANGLING_VOLUME
else
echo "No volumes to remove."
fi
fi

18
setup.sh Executable file
View File

@@ -0,0 +1,18 @@
check_cmd()
{
if ! which $1 &>/dev/null; then
error "$1 command not found, you must install it before."
fi
}
error()
{
echo "Error: $*" >&2
exit 1
}
check_cmd docker
check_cmd wget
./s/download_video.sh
./s/cut_smaller_video.sh