From 88a63dea053f70a7a2ea937a4e62a7dbcb5895a0 Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 12 Apr 2018 03:27:23 +0200 Subject: [PATCH] create-lx-container.sh: add git repositors 'admin-stuff' to the new container. --- create-lx-container.sh | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/create-lx-container.sh b/create-lx-container.sh index a2e121a..8b79dfd 100755 --- a/create-lx-container.sh +++ b/create-lx-container.sh @@ -1458,6 +1458,78 @@ else fi + +# - Create new container directory '/root/bin' +# - +echo "" +msg="Create a new directory '${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin' .." + +mkdir "${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin" > $err_msg 2>&1 +if [[ $? -eq 0 ]] ; then + msg_ok="New directory '${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin' created." + length_msg_ok=${#msg_ok} + blank_signs="" + if [[ $length_msg -gt $length_msg_ok ]]; then + number_blank_sign=$(expr $length_msg - $length_msg_ok) + index_i=0 + while [[ $index_i -lt $number_blank_sign ]] ; do + blank_signs="$blank_signs " + (( index_i++ )) + done + fi + echo -e "\033[1G [ \033[32m\033[1mok\033[m ] ${msg_ok}${blank_signs}" +else + msg_failed="Failed to create directory '${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin'!" + length_msg_failed=${#msg_failed} + blank_signs="" + if [[ $length_msg -gt $length_msg_failed ]]; then + number_blank_sign=$(expr $length_msg - $length_msg_failed) + index_i=0 + while [[ $index_i -lt $number_blank_sign ]] ; do + blank_signs="$blank_signs " + (( index_i++ )) + done + fi + echo -e "\033[1G [ \033[31m\033[1mfailed\033[m ] ${msg_failed}${blank_signs}" + error "$(cat $err_msg)" +fi + + +# - Add git repository 'admin-stuff' +# - +msg="Clone git repository 'admin-stuff' to '${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin/admin-stuff'" +git clone https://git.oopen.de/script/admin-stuff ${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin/admin-stuff 2> /dev/null + +if [[ $? -eq 0 ]] ; then + msg_ok="Git repository '${LXC_ROOT_DIR}/${LXC_NAME}/rootfs/root/bin/admin-stuff' created." + length_msg_ok=${#msg_ok} + blank_signs="" + if [[ $length_msg -gt $length_msg_ok ]]; then + number_blank_sign=$(expr $length_msg - $length_msg_ok) + index_i=0 + while [[ $index_i -lt $number_blank_sign ]] ; do + blank_signs="$blank_signs " + (( index_i++ )) + done + fi + echo -e "\033[1G [ \033[32m\033[1mok\033[m ] ${msg_ok}${blank_signs}" +else + msg_failed="Failed to clone git repository 'admin-stuff'!" + length_msg_failed=${#msg_failed} + blank_signs="" + if [[ $length_msg -gt $length_msg_failed ]]; then + number_blank_sign=$(expr $length_msg - $length_msg_failed) + index_i=0 + while [[ $index_i -lt $number_blank_sign ]] ; do + blank_signs="$blank_signs " + (( index_i++ )) + done + fi + echo -e "\033[1G [ \033[31m\033[1mfailed\033[m ] ${msg_failed}${blank_signs}" + error "$(cat $err_msg)" +fi + + # - Create new containers directory '/root/.ssh' # - echo ""