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