latest pushes
This commit is contained in:
@@ -44,35 +44,35 @@ def download_bellronos(branch):
|
|||||||
try:
|
try:
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
with open("bellos_executable", "wb") as f:
|
with open("bellronos_executable", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
return True
|
return True
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
print(f"Error downloading Bellos from branch {branch}: {e}")
|
print(f"Error downloading bellronos from branch {branch}: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def setup_bellos(version=None):
|
def setup_bellronos(version=None):
|
||||||
if version:
|
if version:
|
||||||
if not download_bellos(version):
|
if not download_bellronos(version):
|
||||||
return
|
return
|
||||||
bellos_executable = "bellos_executable"
|
bellronos_executable = "bellronos_executable"
|
||||||
else:
|
else:
|
||||||
bellos_executable = "executable/bellos"
|
bellronos_executable = "executable/bellronos"
|
||||||
|
|
||||||
if not os.path.exists(bellos_executable):
|
if not os.path.exists(bellronos_executable):
|
||||||
print(f"Error: {bellos_executable} not found.")
|
print(f"Error: {bellronos_executable} not found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.copy2(bellos_executable, BELLRONOS_INSTALL_PATH)
|
shutil.copy2(bellronos_executable, BELLRONOS_INSTALL_PATH)
|
||||||
os.chmod(BELLRONOS_INSTALL_PATH, 0o755) # Make it executable
|
os.chmod(BELLRONOS_INSTALL_PATH, 0o755) # Make it executable
|
||||||
print(f"Bellos has been copied to {BELLRONOS_INSTALL_PATH}")
|
print(f"bellronos has been copied to {BELLRONOS_INSTALL_PATH}")
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print(f"Error copying file: {e}")
|
print(f"Error copying file: {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if version:
|
if version:
|
||||||
os.remove(bellos_executable)
|
os.remove(bellronos_executable)
|
||||||
|
|
||||||
print("Bellronos has been set up successfully.")
|
print("Bellronos has been set up successfully.")
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ def install_latest():
|
|||||||
print("No versioned branches found. Installing from main branch.")
|
print("No versioned branches found. Installing from main branch.")
|
||||||
else:
|
else:
|
||||||
print(f"Installing latest version: {latest}")
|
print(f"Installing latest version: {latest}")
|
||||||
setup_bellos(latest)
|
setup_bellronos(latest)
|
||||||
else:
|
else:
|
||||||
print("Unable to determine the latest version. Installing from main branch.")
|
print("Unable to determine the latest version. Installing from main branch.")
|
||||||
setup_bellos()
|
setup_bellronos()
|
||||||
|
|
||||||
def get_current_version():
|
def get_current_version():
|
||||||
try:
|
try:
|
||||||
@@ -113,7 +113,7 @@ def get_latest_version():
|
|||||||
return max(versions, key=lambda x: version.parse(x) if x != 'main' else version.parse('0'))
|
return max(versions, key=lambda x: version.parse(x) if x != 'main' else version.parse('0'))
|
||||||
return "main"
|
return "main"
|
||||||
|
|
||||||
def update_bellos():
|
def update_bellronos():
|
||||||
current_version = get_current_version()
|
current_version = get_current_version()
|
||||||
latest_version = get_latest_version()
|
latest_version = get_latest_version()
|
||||||
|
|
||||||
@@ -122,12 +122,12 @@ def update_bellos():
|
|||||||
install_latest()
|
install_latest()
|
||||||
elif current_version == "Unknown":
|
elif current_version == "Unknown":
|
||||||
print("Unable to determine the current version. Proceeding with update.")
|
print("Unable to determine the current version. Proceeding with update.")
|
||||||
setup_bellos(latest_version)
|
setup_bellronos(latest_version)
|
||||||
elif current_version == latest_version:
|
elif current_version == latest_version:
|
||||||
print(f"Bellos is already up to date (version {current_version}).")
|
print(f"bellronos is already up to date (version {current_version}).")
|
||||||
else:
|
else:
|
||||||
print(f"Updating Bellronos from version {current_version} to {latest_version}")
|
print(f"Updating Bellronos from version {current_version} to {latest_version}")
|
||||||
setup_bellos(latest_version)
|
setup_bellronos(latest_version)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if os.geteuid() != 0:
|
if os.geteuid() != 0:
|
||||||
@@ -143,7 +143,7 @@ def main():
|
|||||||
|
|
||||||
if args.action == "install":
|
if args.action == "install":
|
||||||
if args.version:
|
if args.version:
|
||||||
setup_bellos(args.version)
|
setup_bellronos(args.version)
|
||||||
else:
|
else:
|
||||||
print("Please specify a version to install with --version, or use 'latest' to install the latest version.")
|
print("Please specify a version to install with --version, or use 'latest' to install the latest version.")
|
||||||
elif args.action == "list":
|
elif args.action == "list":
|
||||||
@@ -151,7 +151,7 @@ def main():
|
|||||||
elif args.action == "latest":
|
elif args.action == "latest":
|
||||||
install_latest()
|
install_latest()
|
||||||
elif args.action == "update":
|
elif args.action == "update":
|
||||||
update_bellos()
|
update_bellronos()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
Reference in New Issue
Block a user