From e7e9673b4ab57068cd28cf3da0725d89a82914c9 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 13 Oct 2025 17:09:50 +0000 Subject: [PATCH] tuya-ipc-terminal/tuya_auth_login.exp aktualisiert --- tuya-ipc-terminal/tuya_auth_login.exp | 37 ++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tuya-ipc-terminal/tuya_auth_login.exp b/tuya-ipc-terminal/tuya_auth_login.exp index b3102fe..293e7cd 100644 --- a/tuya-ipc-terminal/tuya_auth_login.exp +++ b/tuya-ipc-terminal/tuya_auth_login.exp @@ -1,3 +1,38 @@ +#!/usr/bin/expect -f + +# Check if the config directory already exists. +set config_dir "/config/.tuya-data" +if { [file isdirectory $config_dir] } { + puts "Skipping authentication: Configuration directory '$config_dir' already exists." + exit 0 +} + +puts "Configuration directory not found. Proceeding with authentication..." + +set timeout 30 + +# Read inputs +gets stdin region +if { [eof stdin] || $region eq "" } { + puts stderr "Error: Could not read region from stdin or region is empty." + exit 1 +} + +gets stdin email +if { [eof stdin] || $email eq "" } { + puts stderr "Error: Could not read email from stdin or email is empty." + exit 1 +} + +gets stdin password +if { [eof stdin] || $password eq "" } { + puts stderr "Error: Could not read password from stdin or password is empty." + exit 1 +} + +# Spawn the command +spawn tuya-ipc-terminal auth add $region $email --password + # Handle the interaction expect { "Password:" { @@ -60,4 +95,4 @@ expect { catch {wait} exit 1 } -} \ No newline at end of file +}