mirror of
https://github.com/casjaysdevdocker/tools
synced 2025-01-18 12:34:31 -05:00
🗃️ Committing everything that changed 🗃️
dockerfile.sh
This commit is contained in:
parent
311c8a8cf0
commit
02acde18fa
@ -35,7 +35,7 @@ set -o pipefail
|
|||||||
__rm() { [ -e "$1" ] && rm -Rf "$1" 2>/dev/null || return 1; }
|
__rm() { [ -e "$1" ] && rm -Rf "$1" 2>/dev/null || return 1; }
|
||||||
__mv() { [ -e "$1" ] && mv -f "$1" "$2" 2>/dev/null || return 1; }
|
__mv() { [ -e "$1" ] && mv -f "$1" "$2" 2>/dev/null || return 1; }
|
||||||
__cp() { [ -e "$1" ] && cp -Rf "$1" "$2" 2>/dev/null || return 1; }
|
__cp() { [ -e "$1" ] && cp -Rf "$1" "$2" 2>/dev/null || return 1; }
|
||||||
__rmw() { [ -d "$1" ] && rm -Rf "${1:?}"/* 2>/dev/null || return 1; }
|
__rmw() { [ -d "$1" ] && rm -Rf "${1:?directory no specified}"/* 2>/dev/null && __rm "$1" || return 1; }
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
while :; do
|
while :; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -85,7 +85,7 @@ if [ "$CREATE_CMD" = "gen-dockerfile" ] || [ "$CREATE_CMD" = "file" ]; then
|
|||||||
mkdir -p "$DIR_NEW/rootfs/usr/local/share/template-files/data"
|
mkdir -p "$DIR_NEW/rootfs/usr/local/share/template-files/data"
|
||||||
mkdir -p "$DIR_NEW/rootfs/usr/local/share/template-files/config"
|
mkdir -p "$DIR_NEW/rootfs/usr/local/share/template-files/config"
|
||||||
gitignore "$DIR_NEW" dirignore,default --automated
|
gitignore "$DIR_NEW" dirignore,default --automated
|
||||||
eval $CREATE_CMD --nogit --dir "$DIR_NEW" --template $TEMPLATE
|
eval $CREATE_CMD --nogit --dir "$DIR_NEW" --template $TEMPLATE &>/dev/null
|
||||||
sCode=$?
|
sCode=$?
|
||||||
if [ -f "$DIR_OLD/Dockerfile" ] && [ -f "$DIR_NEW/Dockerfile.bak" ]; then
|
if [ -f "$DIR_OLD/Dockerfile" ] && [ -f "$DIR_NEW/Dockerfile.bak" ]; then
|
||||||
echo "Moving Dockerfile to Docker.bak"
|
echo "Moving Dockerfile to Docker.bak"
|
||||||
@ -126,8 +126,8 @@ if [ "$CREATE_CMD" = "gen-dockerfile" ] || [ "$CREATE_CMD" = "file" ]; then
|
|||||||
fi
|
fi
|
||||||
[ -f "$DIR_NEW/Dockerfile" ] || { echo "Failed to init $DIR_NEW" && exit 2; }
|
[ -f "$DIR_NEW/Dockerfile" ] || { echo "Failed to init $DIR_NEW" && exit 2; }
|
||||||
[ -d "$DIR_OLD/.git" ] && echo "Moving the git directory" && __cp "$DIR_OLD/.git" "$DIR_NEW/.git"
|
[ -d "$DIR_OLD/.git" ] && echo "Moving the git directory" && __cp "$DIR_OLD/.git" "$DIR_NEW/.git"
|
||||||
builtin cd "$DIR_NEW" || exit 1
|
|
||||||
if [ "$OPEN_EDITOR" = "yes" ] && [ $sCode -eq 0 ]; then
|
if [ "$OPEN_EDITOR" = "yes" ] && [ $sCode -eq 0 ]; then
|
||||||
|
builtin cd "$DIR_NEW" || exit 1
|
||||||
code -nw "$DIR_NEW" && true && sleep 3 || false
|
code -nw "$DIR_NEW" && true && sleep 3 || false
|
||||||
sCode="$?"
|
sCode="$?"
|
||||||
fi
|
fi
|
||||||
@ -147,7 +147,7 @@ if [ "$CREATE_CMD" = "gen-dockerfile" ] || [ "$CREATE_CMD" = "file" ]; then
|
|||||||
else
|
else
|
||||||
echo "The dir exists: $DIR_NEW"
|
echo "The dir exists: $DIR_NEW"
|
||||||
fi
|
fi
|
||||||
printf '%s\n\n' "# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
printf '\n%s\n' "# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
||||||
done
|
done
|
||||||
exit $exitCode
|
exit $exitCode
|
||||||
elif [ "$CREATE_CMD" = "gen-dockermgr" ] || [ "$CREATE_CMD" = "mgr" ]; then
|
elif [ "$CREATE_CMD" = "gen-dockermgr" ] || [ "$CREATE_CMD" = "mgr" ]; then
|
||||||
@ -215,7 +215,7 @@ elif [ "$CREATE_CMD" = "gen-dockermgr" ] || [ "$CREATE_CMD" = "mgr" ]; then
|
|||||||
else
|
else
|
||||||
echo "The dir exists: $DIR_NEW"
|
echo "The dir exists: $DIR_NEW"
|
||||||
fi
|
fi
|
||||||
printf '%s\n\n' "# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
printf '\n%s\n' "# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
||||||
done
|
done
|
||||||
elif [ "$CREATE_CMD" = "gen-dockerboth" ] || [ "$CREATE_CMD" = "gen-dockerall" ]; then
|
elif [ "$CREATE_CMD" = "gen-dockerboth" ] || [ "$CREATE_CMD" = "gen-dockerall" ]; then
|
||||||
[ "$DOCKERFILE_RUN_BOTH" = "true" ] && exit 1
|
[ "$DOCKERFILE_RUN_BOTH" = "true" ] && exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user