Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
.log
src/utils/.cache
src/utils/.md5
.hist
*.aux
*.log
*.synctex.gz
.idea
.idea




__pycache__/
application.json
preferences.json
src/utils/log
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ eMerger is a simple script to clean update your system and your packages by just
<li>Raspbian</li>
<li>Termux</li>
<li>Ubuntu</li>
<li>Windows 11</li>
</ul>

<h2>Systems tested and not working (help wanted)</h2>
Expand All @@ -37,13 +38,16 @@ eMerger is a simple script to clean update your system and your packages by just
<ul>
<li>apt</li>
<li>apt-get</li>
<li>choco</li>
<li>dnf</li>
<li>emerge</li>
<li>flatpak</li>
<lI>nixos</li>
<lI>nixos-rebuild</li>
<li>nuget</li>
<li>pacman</li>
<li>pkg</li>
<li>rpm</li>
<li>scoop</li>
<li>snap</li>
<li>yay</li>
<li>yum</li>
Expand Down
45 changes: 45 additions & 0 deletions emerger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from colorama import Fore
from json import load
from os import path
from src.utils.utils import Utils
from subprocess import PIPE, Popen

utils = Utils()

try:
# Read application data
with open('application.json', 'r') as f:
data = load(f)

# Read preferences
with open('preferences.json', 'r') as f:
preferences = load(f)

# Print the banner
if (preferences.get('logo') == True):
with open('src/utils/banner', 'r') as f:
banner = f.read()
print(banner)

# Print the system
system = data.get('system')
file_extension = data.get('file_extension')
global_path = data.get('global_path')
path_divisor = data.get('path_divisor')
print('{}>{} System detected: {}'.format(Fore.BLUE, Fore.RESET, system.capitalize()))

# Use packages
packages = utils.check_packages(False)
execution_folder = path.join(global_path, 'src', 'system', system, 'package')
for pkg in packages:
# The file to execute
execution_file = '{}{}{}.{}'.format(execution_folder, path_divisor, pkg, file_extension)
# Create a process
process = Popen(['powershell.exe', execution_file], stdout=PIPE, stderr=PIPE, text=True, shell=True)
# Read stdout
for line in process.stdout:
print(line.strip())
# Wait for the process to finish and get the return code
return_code = process.wait()
except Exception as e:
print(e)
58 changes: 58 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from colorama import init, Fore
from os import getcwd, path, remove
from platform import system
from src.utils.utils import Utils


class Setup():
def __init__(self):
init()
self.utils = Utils()

def run_setup(self) -> None:
print('{}----- SETUP PROCESS -----{}'.format(Fore.GREEN, Fore.RESET))

# If the application data exists then delete it
if path.exists(self.utils.APPLICATION_DATA):
remove(self.utils.APPLICATION_DATA)

# Initialize preferences
self.utils.init_preferences()

# Get global path
cwd = getcwd()
self.utils.update_data({'global_path': cwd})
print('{}>{} Working directory set to: {}'.format(Fore.BLUE, Fore.RESET, cwd))

# Check system
match system():
case 'Darwin':
# Update system in data
self.utils.update_data({'system': 'darwin'})
self.utils.update_data({'file_extension': 'sh'})
self.utils.update_data({'path_divisor': '/'})
print('{}>{} System set to Darwin'.format(Fore.BLUE, Fore.RESET))
# Update packages
self.utils.check_packages()
case 'Linux':
# Update system in data
self.utils.update_data({'system': 'linux'})
self.utils.update_data({'file_extension': 'sh'})
self.utils.update_data({'path_divisor': '/'})
print('{}>{} System set to Linux'.format(Fore.BLUE, Fore.RESET))
# Update packages
self.utils.check_packages()
case 'Windows':
# Update system in data
self.utils.update_data({'system': 'windows'})
self.utils.update_data({'file_extension': 'ps1'})
self.utils.update_data({'path_divisor': '\\'})
print('{}>{} System set to Windows'.format(Fore.BLUE, Fore.RESET))
# Update packages
self.utils.check_packages()
case _:
print('{}> THE SYSTEM IS NOT SUPPORTED: ABORTING SETUP{}'.format(Fore.RED, Fore.RESET))
exit()

if __name__ == '__main__':
Setup().run_setup()
40 changes: 0 additions & 40 deletions src/logo/big_name.svg

This file was deleted.

29 changes: 0 additions & 29 deletions src/package/MacOS/MacOSUpdate.sh

This file was deleted.

3 changes: 0 additions & 3 deletions src/package/Windows/privileges.ps1

This file was deleted.

31 changes: 31 additions & 0 deletions src/system/darwin/package/arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

osVersion=$(sw_vers -productVersion)

installerPath=""
# Extract major and minor version numbers
majorVersion=$(echo $macOSVersion | cut -d '.' -f 1)
minorVersion=$(echo $macOSVersion | cut -d '.' -f 2)

# Check which version is installed
if [ $majorVersion == "11" ]; then
installerPath="Install macOS Big Sur.app"
elif [ $majorVersion == "12" ]; then
installerPath="Install macOS Monterey.app"
elif [ $majorVersion == "13" ]; then
installerPath="Install macOS Ventura.app"
elif [ $majorVersion == "14" ]; then
installerPath="Install macOS Sonoma.app"
else
echo "Unsupported MacOS version."
exit 1
fi

# Get full path
fullPath="/Applications/$installerPath/Contents/Resources/startosinstall"

# Command which updates system
softwareupdate --fetch-full-installer –full-installer-version $osVersion
echo "Insert password:"
# Get privileges
sudo "$fullPath" --agreetolicense --forcequitapps --nointeraction --user "$USER"
11 changes: 4 additions & 7 deletions src/package/Linux/debian.sh → src/system/linux/package/apt.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ source $SRC/utils/global.sh
PWR=$(source $SRC/utils/check_pwr.sh)
PKG="apt-get"


if [[ $(command -v apt) ]]; then
PKG="apt"

#These lines works on some systems only, for example I receive an error on a raspberry.
#puts RED "configuration: starting"
#try $PWR $PKG --configure -a
#puts GREEN "configuration: completed"
#puts RED "Error on --configure option"

puts RED "configuration: starting"
try $PWR $PKG --configure -a
puts GREEN "configuration: completed"

puts BLUE "Using $PKG $DEBIAN"

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/package/Linux/nix.sh → src/system/linux/package/nixos.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ PKG="nixos-rebuild switch"

puts BLUE "Using $PKG $NIX"

puts RED "upgrade: starting"
try $PWR nix-channel --update
puts GREEN "upgrade: completed"

puts RED "upgrade: starting"
try $PWR $PKG --upgrade
puts GREEN "upgrade: completed"

puts RED "repair: starting"
try $PWR $PKG --repair
puts GREEN "repair: completed"

puts RED "repair: starting"
try $PWR nix-collect-garbage -d
puts GREEN "repair: completed"
4 changes: 0 additions & 4 deletions src/package/Linux/arch.sh → src/system/linux/package/pacman.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ puts GREEN "upgrade: completed"
puts RED "clean pacman caches: starting"
try $PWR paccache -r
puts GREEN "clean pacman caches: starting"

puts RED "update AUR packages: starting"
try yay -Syu
puts GREEN "update AUR packages: starting"
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/system/linux/package/yay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

SRC=$(dirname "$(readlink -f "$0")")
source $SRC/utils/global.sh

PWR=$(source $SRC/utils/check_pwr.sh)
PKG="yay"

puts BLUE "Using $PKG $ARCH"

puts RED "update AUR packages: starting"
try $PKG -Syu
puts GREEN "update AUR packages: starting"
File renamed without changes.
3 changes: 3 additions & 0 deletions src/system/windows/package/choco.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write-Host "Updating Chocolatey packages ..."
choco upgrade all -y
Write-Host "Chocolatey packages updated"
3 changes: 3 additions & 0 deletions src/system/windows/package/nuget.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write-Host "Updating NuGet packages ..."
Update-Package
Write-Host "NuGet packages updated"
3 changes: 3 additions & 0 deletions src/system/windows/package/scoop.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write-Host "Updating Scoop packages ..."
scoop update
Write-Host "Scoop packages updated"
Loading