Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Deletes Inkscape icons, adds output directory to manage script

AuthorDaveJarvis <email>
Date2022-12-15 23:17:43 GMT-0800
Commite767901051b9fa11a0d24576000b51e51071cbf2
Parentb5191fa
container/Containerfile
-rlt --exclude=/VERSION --del modules/*/ tex/texmf-modules && \
sh install.sh && \
- rm -rf modules && \
- rm -rf "/var/cache" && \
rm -f $DOWNLOAD_DIR/*.zip && \
- rm -rf $CONTEXT_HOME/tex/texmf-context/doc && \
+ rm -rf \
+ "modules" \
+ "/var/cache" \
+ "/usr/share/icons" \
+ $CONTEXT_HOME/tex/texmf-context/doc && \
+ find \
+ /usr/share/inkscape \
+ -type f -not -iname "*.xml" -exec rm {} \; && \
find \
$CONTEXT_HOME \
-type f \
- \( -iname \*.pdf -o -iname \*.md -o -iname \*.txt -o -iname \*.log \) \
+ \( -iname \*.pdf -o -iname \*.txt -o -iname \*.log \) \
-exec rm {} \;
container/manage.sh
readonly CONTAINER_DIR_TEXT="/root/text"
readonly CONTAINER_DIR_IMAGES="/root/images"
+readonly CONTAINER_DIR_OUTPUT="/root/output"
ARG_CONTAINER_COMMAND="context --version"
ARG_MOUNTPOINT_TEXT=""
ARG_MOUNTPOINT_IMAGES=""
+ARG_MOUNTPOINT_OUTPUT="."
DEPENDENCIES=(
"i,images,Set mount point for image files (to typeset)"
"l,load,Load container (${CONTAINER_COMPRESSED_PATH})"
+ "o,output,Set mount point for output files (after typesetting)"
"r,run,Run a command in the container (\"${ARG_CONTAINER_COMMAND}\")"
"s,save,Save container (${CONTAINER_COMPRESSED_PATH})"
# $1 - The host directory.
# $2 - The guest (container) directory.
+# $3 - The file system permissions (set to 1 for read-write).
# ---------------------------------------------------------------------------
get_mountpoint() {
local result=""
+
+ local binding="ro"
+
+ if [ ! -z "${3+x}" ]; then
+ binding="Z"
+ fi
if [ ! -z "${1}" ]; then
- result="-v ${1}:${2}:ro"
+ result="-v ${1}:${2}:${binding}"
fi
get_mountpoint_images() {
echo $(get_mountpoint "${ARG_MOUNTPOINT_IMAGES}" "${CONTAINER_DIR_IMAGES}")
+}
+
+get_mountpoint_output() {
+ echo $(get_mountpoint "${ARG_MOUNTPOINT_OUTPUT}" "${CONTAINER_DIR_OUTPUT}" 1)
}
# ---------------------------------------------------------------------------
# Connects to the container.
# ---------------------------------------------------------------------------
utile_connect() {
$log "Connecting to container"
- local mount_text=$(get_mountpoint_text)
- local mount_images=$(get_mountpoint_images)
+ declare -r mount_text=$(get_mountpoint_text)
+ declare -r mount_images=$(get_mountpoint_images)
+ declare -r mount_output=$(get_mountpoint_output)
${CONTAINER_EXE} run \
--network="${CONTAINER_NETWORK}" \
--rm \
-it \
${mount_text} \
${mount_images} \
+ ${mount_output} \
"${CONTAINER_NAME}"
}
;;
-i|--images)
- if [ -z "${2+x}" ]; then
- :
- else
+ if [ ! -z "${2+x}" ]; then
ARG_MOUNTPOINT_IMAGES="$2"
+ consume=2
+ fi
+ ;;
+ -o|--output)
+ if [ ! -z "${2+x}" ]; then
+ ARG_MOUNTPOINT_OUTPUT="$2"
consume=2
fi
;;
-r|--run)
do_execute=utile_execute
- if [ -z "${2+x}" ]; then
- :
- else
+ if [ ! -z "${2+x}" ]; then
ARG_CONTAINER_COMMAND="$2"
consume=2
fi
;;
-s|--save)
do_save=utile_save
;;
-t|--text)
- if [ -z "${2+x}" ]; then
- :
- else
+ if [ ! -z "${2+x}" ]; then
ARG_MOUNTPOINT_TEXT="$2"
consume=2
Delta37 lines added, 16 lines removed, 21-line increase