Skip to content

Instantly share code, notes, and snippets.

@emanb29
Last active June 9, 2020 06:36
Show Gist options
  • Select an option

  • Save emanb29/b4083c711b2992861adc382762363d36 to your computer and use it in GitHub Desktop.

Select an option

Save emanb29/b4083c711b2992861adc382762363d36 to your computer and use it in GitHub Desktop.
Caups/pakcs2 dockerfile assistant script (git-for-windows compatible)
#!/bin/sh
# shell script to run the Docker image caups/pakcs2
# with appropriate options in order to use PAKCS
# with local files and invoke tools contained in the image
export MSYS_NO_PATHCONV=1
# set docker options:
# run interactive, remove container after execution
DOCKEROPTS="-it --rm"
# mount current working directory and user's home directory
DOCKEROPTS="$DOCKEROPTS -v `pwd`:`pwd` -w `pwd` -v $HOME:$HOME -e HOME=$HOME"
# set docker user to host user
DOCKEROPTS="$DOCKEROPTS -u $(id -u):$(id -g)"
ENTRYPOINT=""
HELP=no
# check whether an installed tool should be invoked:
case $(basename $0) in
cypm ) ENTRYPOINT="/pakcs/pakcs/bin/cypm" ;;
curry-check ) ENTRYPOINT="/pakcs/cpm/bin/curry-check" ;;
curry-doc ) ENTRYPOINT="/pakcs/cpm/bin/curry-doc" ;;
esac
if [ ! -n "$ENTRYPOINT" ] ; then
case $1 in
--help | -h | -\? ) HELP=yes ;;
pakcs ) shift ;;
cypm ) shift ; ENTRYPOINT="/pakcs/pakcs/bin/cypm" ;;
curry-check ) shift ; ENTRYPOINT="/pakcs/cpm/bin/curry-check" ;;
curry-doc ) shift ; ENTRYPOINT="/pakcs/cpm/bin/curry-doc" ;;
esac
if [ $HELP = yes ] ; then
echo "Usage: pakcs...-docker [options]"
echo ""
echo "-h|-?|--help : show this message and quit"
echo "cypm <opts> : invoke Curry Package Manager with <opts>"
echo "curry-check <opts> : invoke CurryCheck with <opts>"
echo "curry-doc <opts> : invoke CurryDoc with <opts>"
echo "pakcs <opts> : invoke PAKCS with <opts>"
echo "<opts> : invoke PAKCS with <opts>"
exit
fi
fi
if [ -n "$ENTRYPOINT" ] ; then
DOCKEROPTS="$DOCKEROPTS --entrypoint=$ENTRYPOINT"
fi
docker run $DOCKEROPTS caups/pakcs2 ${1+"$@"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment