Files
kiauh/kiauh/components/droidklipp/droidklipp.py
CodeMasterCody3D a21e059328 Update droidklipp.py
fixed folder creating and bug
2025-01-21 04:08:48 -06:00

45 lines
1.8 KiB
Python

def install_droidklipp():
try:
print("Are you sure you want to install DroidKlipp? (Y/N)")
user_confirmation = input().strip().lower()
if user_confirmation != 'y':
print("DroidKlipp installation aborted.")
return
print("Installing DroidKlipp...")
subprocess.run(['sudo', 'apt', 'install', '-y', 'adb', 'tmux'], check=True)
# Define the DroidKlipp repository URL and directory
droidklipp_repo_url = "https://github.com/CodeMasterCody3D/DroidKlipp.git"
droidklipp_dir = os.path.expanduser('~/DroidKlipp')
# Check if DroidKlipp directory exists, if not create it
if not os.path.isdir(droidklipp_dir):
print("DroidKlipp folder not found, creating directory...")
os.makedirs(droidklipp_dir)
# Clone the repository if not already cloned
if not os.path.isdir(os.path.join(droidklipp_dir, '.git')):
print("Cloning the DroidKlipp repository...")
subprocess.run(['git', 'clone', droidklipp_repo_url, droidklipp_dir], check=True)
else:
print("DroidKlipp repository already exists.")
# Change to the DroidKlipp directory
os.chdir(droidklipp_dir)
# Set executable permissions for the installation script
subprocess.run(['sudo', 'chmod', '+x', 'droidklipp.sh'], check=True)
# Run the installation script
subprocess.run(['./droidklipp.sh'], check=True)
print("DroidKlipp installation complete!")
except subprocess.CalledProcessError as e:
print(f"Error during installation: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
# Ensure you call this with proper confirmation before installation