From 457463b51b05e52fe732d18ad81c7be95a4af566 Mon Sep 17 00:00:00 2001 From: MehmetYukselSekeroglu Date: Sun, 26 May 2024 20:23:15 +0300 Subject: [PATCH] linux.sh setup file added --- hivelibrary/consolePrint.py | 8 +++--- hivelibrary/install_insightface_model.py | 2 ++ linux.sh | 34 ++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 hivelibrary/install_insightface_model.py diff --git a/hivelibrary/consolePrint.py b/hivelibrary/consolePrint.py index e09af78..46cfa74 100644 --- a/hivelibrary/consolePrint.py +++ b/hivelibrary/consolePrint.py @@ -28,21 +28,21 @@ def _GetTime(): # BILGILENDIRMELER ICIN def p_info(mesages:str, locations:str=None): - sys.stdout.write(f"{C_GREEN}[{_GetTime()}]{T_BOLD}[INFO]: {T_BOLD_RESET}{mesages}\n") + sys.stdout.write(f"{C_GREEN}[{_GetTime()}]{T_BOLD} [INFO]: {T_BOLD_RESET}{mesages}\n") sys.stdout.flush() # HATA MESAJLARI ICIN def p_error(mesages:str,locations:str=None): - sys.stderr.write(f"{C_RED}[{_GetTime()}]{T_BOLD}[ERR]: {T_BOLD_RESET}{mesages}\n") + sys.stderr.write(f"{C_RED}[{_GetTime()}]{T_BOLD} [ERR]: {T_BOLD_RESET}{mesages}\n") sys.stdout.flush() # Uyarıları için def p_warn(mesages:str,locations:str=None): - print(f"{C_ORANGE}[{_GetTime()}]{T_BOLD}[WARN]: {T_BOLD_RESET}{mesages}") + print(f"{C_ORANGE}[{_GetTime()}]{T_BOLD} [WARN]: {T_BOLD_RESET}{mesages}") #Log mesajları için def p_log(mesages:str,locations:str=None): - print(f"{C_BLUE}[{_GetTime()}][log]: {mesages}") + print(f"{C_BLUE}[{_GetTime()}] [LOG]: {mesages}") def p_title(your_title:str,locations:str=None): diff --git a/hivelibrary/install_insightface_model.py b/hivelibrary/install_insightface_model.py new file mode 100644 index 0000000..f7725a3 --- /dev/null +++ b/hivelibrary/install_insightface_model.py @@ -0,0 +1,2 @@ +import insightface +app = insightface.app.FaceAnalysis() diff --git a/linux.sh b/linux.sh index c1294d9..176efe9 100755 --- a/linux.sh +++ b/linux.sh @@ -53,12 +53,11 @@ check_reqiered_commands(){ p_info "CHECKING REQUIRED PACKAGETS" printf "\n" - check_command "nohup" + check_command "docker" check_command "jq" check_command "docker" check_command "python3" check_command "pip3" - check_command "sudo" check_command "cat" check_command "make" check_command "cmake" @@ -245,6 +244,37 @@ elif [[ "$1" == "--stop-container" ]]; then p_info "Container Successfully stopped:\t$container_name!" exit 0 +# stop container for user +elif [[ "$1" == "--start-container" ]]; then + printf "\n" + printf "$blue<-[ Starting Docker Container ]->\n$reset" + printf "\n" + sleep 1 + + docker start $container_name + + if [[ "$?" != "0" ]]; then + p_error "Failed to start docker container:\t$container_name !" + exit 1 + + else + p_info "OK..." + + fi + + printf "\n" + p_info "Container Successfully start:\t$container_name!" + exit 0 + + +# stop container for user +elif [[ "$1" == "--start-hive" ]]; then + printf "\n" + printf "$blue<-[ Starting TheHive ]->\n$reset" + printf "\n" + sleep 1 + + python3 main.py # romove/delete container