aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/devcontainer84
-rwxr-xr-xbin/mount_dev9
2 files changed, 8 insertions, 85 deletions
diff --git a/bin/devcontainer b/bin/devcontainer
deleted file mode 100755
index 6a48b6f..0000000
--- a/bin/devcontainer
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/bash
-
-if ! [ -x "$(command -v jq)" ]; then
- printf "\x1B[31m[ERROR] jq is not installed.\x1B[0m\n"
- exit 1
-fi
-OPTIND=1
-VERBOSE=0
-
-while getopts "v" opt; do
- case ${opt} in
- v ) VERBOSE=1 ;;
- esac
-done
-
-debug() {
- if [ $VERBOSE == 1 ]; then
- printf "\x1B[33m[DEBUG] ${1}\x1B[0m\n"
- fi
-}
-
-WORKSPACE=${1:-`pwd`}
-CURRENT_DIR=${PWD##*/}
-echo "Using workspace ${WORKSPACE}"
-
-CONFIG_DIR=./.devcontainer
-debug "CONFIG_DIR: ${CONFIG_DIR}"
-CONFIG_FILE=devcontainer.json
-debug "CONFIG_FILE: ${CONFIG_FILE}"
-if ! [ -e "$CONFIG_DIR/$CONFIG_FILE" ]; then
- echo "Folder contains no devcontainer configuration"
- exit
-fi
-
-CONFIG=$(cat $CONFIG_DIR/$CONFIG_FILE | grep -v //)
-debug "CONFIG: \n${CONFIG}"
-
-cd $CONFIG_DIR
-
-DOCKER_FILE=$(echo $CONFIG | jq -r .dockerFile)
-if [ "$DOCKER_FILE" == "null" ]; then
- DOCKER_FILE=$(echo $CONFIG | jq -r .build.dockerfile)
-fi
-DOCKER_FILE=$(readlink -f $DOCKER_FILE)
-debug "DOCKER_FILE: ${DOCKER_FILE}"
-if ! [ -e $DOCKER_FILE ]; then
- echo "Can not find dockerfile ${DOCKER_FILE}"
- exit
-fi
-
-NAME=$(echo $CONFIG | jq -r .name)
-debug "NAME: ${NAME}"
-
-REMOTE_USER=$(echo $CONFIG | jq -r .remoteUser)
-debug "REMOTE_USER: ${REMOTE_USER}"
-if ! [ "$REMOTE_USER" == "null" ]; then
- REMOTE_USER="-u ${REMOTE_USER}"
-fi
-
-ARGS=$(echo $CONFIG | jq -r '.build.args | to_entries? | map("--build-arg \(.key)=\"\(.value)\"")? | join(" ")')
-debug "ARGS: ${ARGS}"
-
-SHELL=$(echo $CONFIG | jq -r '.settings."terminal.integrated.shell.linux"')
-debug "SHELL: ${SHELL}"
-
-PORTS=$(echo $CONFIG | jq -r '.forwardPorts | map("-p \(.):\(.)")? | join(" ")')
-debug "PORTS: ${PORTS}"
-
-ENVS=$(echo $CONFIG | jq -r '.remoteEnv | to_entries? | map("-e \(.key)=\(.value)")? | join(" ")')
-debug "ENVS: ${ENVS}"
-
-WORK_DIR="/workspace"
-debug "WORK_DIR: ${WORK_DIR}"
-
-MOUNT="${MOUNT} --mount type=bind,source=${WORKSPACE},target=${WORK_DIR}"
-debug "MOUNT: ${MOUNT}"
-
-echo "Building and starting container"
-set -x
-DOCKER_IMAGE_HASH=$(docker build -t devcontainer -f $DOCKER_FILE $ARGS .)
-debug "DOCKER_IMAGE_HASH: ${DOCKER_IMAGE_HASH}"
-
-#docker run -it $REMOTE_USER $PORTS $ENVS $MOUNT -w $WORK_DIR $DOCKER_IMAGE_HASH $SHELL
-docker run -it $PORTS $ENVS $MOUNT -w $WORK_DIR devcontainer $SHELL
diff --git a/bin/mount_dev b/bin/mount_dev
index 5255a18..cba8c82 100755
--- a/bin/mount_dev
+++ b/bin/mount_dev
@@ -31,7 +31,7 @@ if [ "$(ls -A $DIR)" ]; then
exit 1
fi
-sshfs "$1":"$DIR" "$DIR"
+sshfs -C -o cache_timeout=80000,auto_cache,reconnect "$1":"$DIR" "$DIR"
if [ ! -f "/media/$2" ]; then
sudo mkdir -p /media/$2
@@ -45,6 +45,13 @@ else
sudo mount --bind --verbose "$DIR" "/media/$2"
fi
+tput setaf 4
+echo "Caching files"
+tput sgr0
+for file in $(find "$DIR"); do
+ cat $file > /dev/null 2>&1
+done
+
tput setaf 2
echo "Done"
tput sgr0