Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mas6y6 committed Dec 3, 2024
1 parent 3f9640f commit 0c9a1e2
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/automatic_cipheros_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

# Step 3: Install Dependencies
- name: Install Dependencies
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/macos-linuxinstaller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Automatic CipherOS Builder

on:
push:
branches:
- main

jobs:
test-and-build:
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
arch: [x64, arm64, x32]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install urllib3 progressbar3 colorama requests
- name: Run Compilation Script
shell: bash
run: |
OUTPUT_DIR="installers/${{ matrix.os }}/${{ matrix.arch }}"
mkdir -p "$OUTPUT_DIR"
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "Compiling for Linux (${RUNNER_ARCH})..."
pyinstaller installer.py --distpath "$OUTPUT_DIR" --onefile --icon="./icon.ico" --name="linux-${{ matrix.arch }}-installer"
chmod +x installers/${{ matrix.os }}/${{ matrix.arch }}/linux-${{ matrix.arch }}-installer
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
echo "Compiling for macOS (${RUNNER_ARCH})..."
pyinstaller installer.py --distpath "$OUTPUT_DIR" --onefile --icon="./icon.ico" --name="macos-${{ matrix.arch }}-installer"
chmod +x installers/${{ matrix.os }}/${{ matrix.arch }}/macos-${{ matrix.arch }}-installer
fi
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: "${{ matrix.os }}-${{ matrix.arch }}-build"
path: "installers/${{ matrix.os }}/${{ matrix.arch }}"
93 changes: 93 additions & 0 deletions installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import sys
import urllib.request, progressbar, os, colorama, requests, json, platform, subprocess

def show_progress(block_num, block_size, total_size):
global pbar
if pbar is None:
pbar = progressbar.ProgressBar(widgets=["Downloading... ",progressbar.Percentage()," ",progressbar.Bar(left="[",right="]")," ",progressbar.AbsoluteETA()],maxval=total_size)
pbar.start()

downloaded = block_num * block_size
if downloaded < total_size:
pbar.update(downloaded)
else:
pbar.finish()
pbar = None

def download(url):
urllib.request.urlretrieve(
url,
os.path.join(os.path.expanduser("~"), ".cache","cipheros"),
show_progress,
)


def run_with_sudo(command):
try:
full_command = ['sudo'] + command
subprocess.run(full_command, check=True)
print("Command executed successfully with admin privileges.")
except subprocess.CalledProcessError:
print("Admin privileges were denied or an error occurred.")

releases = requests.get("https://api.github.com/repos/mas6y6/CipherOS/releases/latest").json()

latest = releases["tag_name"]

system = platform.system()

print(
colorama.Fore.LIGHTMAGENTA_EX
+ r""" _______ __ ____ _____
/ ____(_)___ / /_ ___ _____/ __ \/ ___/
/ / / / __ \/ __ \/ _ \/ ___/ / / /\__ \
/ /___/ / /_/ / / / / __/ / / /_/ /___/ /
\____/_/ .___/_/ /_/\___/_/ \____//____/
/_/
Project Codename: Paradox"""
+ colorama.Fore.RESET
)
print("\nCipherOS Installer for macOS and Linux")

if system == "Darwin":
print("Finding CipherOS for macOS..")
url = None
for i in releases["assets"]:
if i["name"] == "macos_raw-executable":
url = i["url"]
break
if url == None:
print(colorama.Fore.LIGHTRED_EX+"The executeable for macOS is not found.\nMaybe is still being developed on.\nContact @mas6y6 (on discord) if you need help"+colorama.Fore.RESET)
sys.exit(1)
else:
print(f"Downloading {url}...")
download(url)
path1 = os.path.join(os.path.expanduser('~'), '.cache','cipheros')
path2 = os.path.join("/usr","local","bin","cipheros")
print("This script will require your admin password to continue because it will be be changeing the premissions for the executeable and moving the executeable to /usr/local/bin.\n")
run_with_sudo("chmod +x "+path1)
run_with_sudo("mv"+path1+path2)
print("Installer completed!")
elif system == "Linux":
print("Finding CipherOS for Linux..")
url = None
for i in releases["assets"]:
if i["name"] == "linux_raw-executable":
url = i["url"]
break
if url == None:
print(colorama.Fore.LIGHTRED_EX+"The executeable for Linux is not found.\nMaybe is still being developed on.\nContact @mas6y6 (on discord) if you need help"+colorama.Fore.RESET)
sys.exit(1)
else:
print(f"Downloading {url}...")
download(url)
path1 = os.path.join(os.path.expanduser('~'), '.cache','cipheros')
path2 = os.path.join("/usr","local","bin","cipheros")
print("This script will require your admin password to continue because it will be be changeing the premissions for the executeable and moving the executeable to /usr/local/bin.\n")
run_with_sudo("chmod +x "+path1)
run_with_sudo("mv"+path1+path2)
print("Installer completed!")
elif system == "Windows":
print(colorama.Fore.LIGHTRED_EX+"The CipherOS installer is not avaiable for Windows"+colorama.Fore.RESET)
sys.exit(1)

0 comments on commit 0c9a1e2

Please sign in to comment.