diff --git a/.gitignore b/.gitignore
index 7297e23..3cf980f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,11 @@
-.log
src/utils/.cache
src/utils/.md5
.hist
*.aux
*.log
*.synctex.gz
-.idea
\ No newline at end of file
+.idea
+__pycache__/
+application.json
+preferences.json
+src/utils/log
diff --git a/README.md b/README.md
index 7aaecae..28e3b42 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ eMerger is a simple script to clean update your system and your packages by just
Raspbian
Termux
Ubuntu
+
Windows 11
Systems tested and not working (help wanted)
@@ -37,13 +38,16 @@ eMerger is a simple script to clean update your system and your packages by just
apt
apt-get
+
choco
dnf
emerge
flatpak
-
nixos
+
nixos-rebuild
+
nuget
pacman
pkg
rpm
+
scoop
snap
yay
yum
diff --git a/application-example.json b/application-example.json
new file mode 100644
index 0000000..3af09c5
--- /dev/null
+++ b/application-example.json
@@ -0,0 +1,9 @@
+{
+ "global_path": "/home/yourabsolutepath/eMerger",
+ "system": "linux",
+ "file_extension": "sh",
+ "path_divisor": "/",
+ "packages": [
+ "apt"
+ ]
+}
diff --git a/emerger.py b/emerger.py
new file mode 100644
index 0000000..1f75175
--- /dev/null
+++ b/emerger.py
@@ -0,0 +1,49 @@
+from colorama import Fore
+from json import load
+from os import path
+from src.utils.utils import Utils
+from subprocess import PIPE, Popen, STDOUT
+import sys
+
+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
+ if system == 'windows':
+ process = Popen(['powershell.exe', execution_file], stdout=PIPE, stderr=PIPE, text=True, shell=False,bufsize=1,universal_newlines=True)
+ else:
+ process = Popen(['/bin/bash', execution_file], stdout=PIPE, stderr=STDOUT, text=True, shell=False,bufsize=1,universal_newlines=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)
diff --git a/preferences-example.json b/preferences-example.json
new file mode 100644
index 0000000..90a98bb
--- /dev/null
+++ b/preferences-example.json
@@ -0,0 +1,3 @@
+{
+ "logo": true
+}
\ No newline at end of file
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..8c963c1
--- /dev/null
+++ b/setup.py
@@ -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 using MacOS info
+ 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 MacOS
+ self.utils.check_packages()
+ case 'Linux':
+ # Update system in data using Linux info
+ 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 Linux
+ self.utils.check_packages()
+ case 'Windows':
+ # Update system in data using Windows info
+ 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 Windows
+ 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()
diff --git a/src/logo/big_name.svg b/src/logo/big_name.svg
deleted file mode 100644
index 4153f9b..0000000
--- a/src/logo/big_name.svg
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
diff --git a/src/package/MacOS/MacOSUpdate.sh b/src/package/MacOS/MacOSUpdate.sh
deleted file mode 100644
index 3862175..0000000
--- a/src/package/MacOS/MacOSUpdate.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-#Fetch MacOS version
-osVersion=$(sw_vers -productVersion)
-
-installerPath=""
-#Get major and minor version
-majorVersion=$(echo $osVersion | cut -d "." -f 1)
-minorVersion=$(echo $osVersion | cut -d "." -f 2)
-
-#Check which version is installed
-if [ $majorVersion == "12" ];then
- installerPath="install macOS Monterey.app"
-elif [ $majorVersion == "11" ];then
- installerPath="Install macOS Big Sur.app"
-elif [ $minorVersion == "15"* ];then
- installerPath="Install macOS Catalina.app"
-elif
- 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 "Inserire la password:"
-#get privileges
-sudo "$fullPath" --agreetolicense --forcequitapps --nointeraction --user "$USER"
diff --git a/src/package/Windows/privileges.ps1 b/src/package/Windows/privileges.ps1
deleted file mode 100644
index 15b4fb3..0000000
--- a/src/package/Windows/privileges.ps1
+++ /dev/null
@@ -1,3 +0,0 @@
-# Start Powershell as administrator
-Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"winUpdate.ps1`""
-
diff --git a/src/system/darwin/package/arm.sh b/src/system/darwin/package/arm.sh
new file mode 100644
index 0000000..94578bd
--- /dev/null
+++ b/src/system/darwin/package/arm.sh
@@ -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"
diff --git a/src/package/Linux/debian.sh b/src/system/linux/package/apt.sh
similarity index 82%
rename from src/package/Linux/debian.sh
rename to src/system/linux/package/apt.sh
index dc26403..19de61e 100755
--- a/src/package/Linux/debian.sh
+++ b/src/system/linux/package/apt.sh
@@ -1,20 +1,18 @@
#!/bin/bash
-SRC=$(dirname "$(readlink -f "$0")")
+#SRC=$(dirname "$(readlink -f "$0")")
+SRC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../ && pwd )"
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"
diff --git a/src/package/Linux/gentoo.sh b/src/system/linux/package/emerge.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/gentoo.sh
rename to src/system/linux/package/emerge.sh
diff --git a/src/package/Linux/flatpak.sh b/src/system/linux/package/flatpak.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/flatpak.sh
rename to src/system/linux/package/flatpak.sh
diff --git a/src/package/Linux/nix.sh b/src/system/linux/package/nixos.sh
old mode 100755
new mode 100644
similarity index 65%
rename from src/package/Linux/nix.sh
rename to src/system/linux/package/nixos.sh
index 18b268d..8f878c8
--- a/src/package/Linux/nix.sh
+++ b/src/system/linux/package/nixos.sh
@@ -8,6 +8,10 @@ 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"
@@ -15,3 +19,7 @@ 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"
diff --git a/src/package/Linux/arch.sh b/src/system/linux/package/pacman.sh
old mode 100755
new mode 100644
similarity index 81%
rename from src/package/Linux/arch.sh
rename to src/system/linux/package/pacman.sh
index a98b49b..c404a7a
--- a/src/package/Linux/arch.sh
+++ b/src/system/linux/package/pacman.sh
@@ -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"
diff --git a/src/package/Linux/termux.sh b/src/system/linux/package/pkg.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/termux.sh
rename to src/system/linux/package/pkg.sh
diff --git a/src/package/Linux/rpm.sh b/src/system/linux/package/rpm.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/rpm.sh
rename to src/system/linux/package/rpm.sh
diff --git a/src/package/Linux/snap.sh b/src/system/linux/package/snap.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/snap.sh
rename to src/system/linux/package/snap.sh
diff --git a/src/system/linux/package/yay.sh b/src/system/linux/package/yay.sh
new file mode 100644
index 0000000..28b31da
--- /dev/null
+++ b/src/system/linux/package/yay.sh
@@ -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"
diff --git a/src/package/Linux/opensuse.sh b/src/system/linux/package/zypper.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/package/Linux/opensuse.sh
rename to src/system/linux/package/zypper.sh
diff --git a/src/system/windows/package/choco.ps1 b/src/system/windows/package/choco.ps1
new file mode 100644
index 0000000..921f984
--- /dev/null
+++ b/src/system/windows/package/choco.ps1
@@ -0,0 +1,3 @@
+Write-Host "Updating Chocolatey packages ..."
+choco upgrade all -y
+Write-Host "Chocolatey packages updated"
\ No newline at end of file
diff --git a/src/system/windows/package/nuget.ps1 b/src/system/windows/package/nuget.ps1
new file mode 100644
index 0000000..ae7c9be
--- /dev/null
+++ b/src/system/windows/package/nuget.ps1
@@ -0,0 +1,3 @@
+Write-Host "Updating NuGet packages ..."
+Update-Package
+Write-Host "NuGet packages updated"
\ No newline at end of file
diff --git a/src/system/windows/package/scoop.ps1 b/src/system/windows/package/scoop.ps1
new file mode 100644
index 0000000..5abfe2d
--- /dev/null
+++ b/src/system/windows/package/scoop.ps1
@@ -0,0 +1,3 @@
+Write-Host "Updating Scoop packages ..."
+scoop update
+Write-Host "Scoop packages updated"
\ No newline at end of file
diff --git a/src/package/Windows/winUpdate.ps1 b/src/system/windows/winUpdate.ps1
similarity index 70%
rename from src/package/Windows/winUpdate.ps1
rename to src/system/windows/winUpdate.ps1
index f5cb2b6..f8e8340 100644
--- a/src/package/Windows/winUpdate.ps1
+++ b/src/system/windows/winUpdate.ps1
@@ -1,4 +1,5 @@
-# This script is focused on update Windows OS
+# TODO RIMUOVERE
+Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"winUpdate.ps1`""
# Install PSWindowsUpdate if not installed
if (!(Get-Module -Name PSWindowsUpdate -ListAvailable)) {
@@ -7,20 +8,16 @@ if (!(Get-Module -Name PSWindowsUpdate -ListAvailable)) {
}
# Windows Update
-Write-Host "Updating Windows..."
-Write-Host "At the end your system will be rebooted..."
-Get-WUInstall -AcceptAll -AutoReboot
+Write-Host "Updating Windows ..."
+Write-Host "At the end reboot your system"
+Get-WUInstall -AcceptAll
####### Check installation and update of Chocolatey #######
# If you wanna install Chocolatey, you need this command
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
- Write-Host "Chocolatey not found. Skipping..."
-} else {
- Write-Host "Chocolatey is installed..."
- Write-Host "Updating Chocolatey packages..."
- choco upgrade all -y
+ #Write-Host "Chocolatey not found. Skipping..."
}
######## Check installation and update Nuget #######
@@ -29,10 +26,6 @@ if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
# Move-Item -Path "$env:temp\nuget.exe" -Destination "$env:ProgramFiles\NuGet" -Force
if (!(Get-Command nuget -ErrorAction SilentlyContinue)) {
Write-Host "NuGet not found. Skipping..."
-} else {
- Write-Host "NuGet is installed..."
- Write-Host "Updating Nuget packages..."
- Update-Package -ProjectName YourProjectName -Reinstall
}
####### Check installation and update scoop #######
@@ -40,9 +33,6 @@ if (!(Get-Command nuget -ErrorAction SilentlyContinue)) {
# Set-ExecutionPolicy RemoteSigned -scope Process; iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
if (!(Test-Path $env:USERPROFILE\scoop)) {
Write-Host "Scoop not found. Skipping..."
-} else {
- Write-Host "Scoop is installed..."
- scoop update
}
Write-Host "Update completed."
diff --git a/src/utils/.logo b/src/utils/banner
similarity index 98%
rename from src/utils/.logo
rename to src/utils/banner
index 78ecb0c..2dfbe4e 100644
--- a/src/utils/.logo
+++ b/src/utils/banner
@@ -11,5 +11,4 @@
\$$$$$$ |
\______/
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-MIT License
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/src/utils/check_pwr.sh b/src/utils/check_pwr.sh
old mode 100755
new mode 100644
diff --git a/src/utils/global.sh b/src/utils/global.sh
old mode 100755
new mode 100644
diff --git a/src/utils/utils.py b/src/utils/utils.py
new file mode 100644
index 0000000..252499b
--- /dev/null
+++ b/src/utils/utils.py
@@ -0,0 +1,85 @@
+from colorama import Fore
+from json import dump, load
+from os import path
+from shutil import which
+
+# Class to define json cache files and list of all supported packages.
+class Utils:
+ def __init__(self):
+ self.APPLICATION_DATA = 'application.json'
+ self.APPLICATION_PREFERENCES = 'preferences.json'
+ self.LOG = 'src/utils/log'
+ self.PACKAGES = {
+ "apt-get": "apt",
+ "osascript": "arm",
+ "choco": "choco",
+ "emerge": "emerge",
+ "flatpak": "flatpak",
+ "nixos-rebuild": "nixos",
+ "nuget": "nuget",
+ "scoop": "scoop",
+ "pacman": "pacman",
+ "pkg": "pkg",
+ "rpm": "rpm",
+ "snap": "snap",
+ "yay": "yay",
+ "zypper": "zypper"
+ }
+
+ # Check application data for installed packages
+ def check_packages(self, verbose=True) -> list:
+ # For each package check if it exists and add it to the data
+ installed_packages = []
+ for key, value in self.PACKAGES.items():
+ path = which(key)
+ if path:
+ installed_packages.append(value)
+ self.update_data({'packages': installed_packages})
+
+ if verbose:
+ print('{}>{} The following packages were found: {}'.format(Fore.BLUE, Fore.RESET, installed_packages))
+
+ return installed_packages
+
+ # Initialize application preferences
+ def init_preferences(self) -> None:
+ # Do nothing if preferences are already set
+ if not path.exists(self.APPLICATION_PREFERENCES):
+ with open(self.APPLICATION_PREFERENCES, 'w') as f:
+ dump({
+ "logo": True,
+ }, f, indent=4)
+
+ # Add value to data
+ def update_data(self, kv) -> None:
+ try:
+ # If the file exists
+ if path.exists(self.APPLICATION_DATA):
+ # Load its content
+ with open(self.APPLICATION_DATA, 'r') as f:
+ data = load(f)
+ else:
+ # New data dictionary
+ data = {}
+
+ # Add data to the dictionary
+ data.update(kv)
+
+ # Write the updated data back to the file
+ with open(self.APPLICATION_DATA, 'w') as f:
+ dump(data, f, indent=4)
+ self.update_log({"SUCCESS": "UPDATE CACHE -> ADD {}".format(kv)})
+ except Exception as e:
+ self.update_log({"ERROR": "UPDATE CACHE -> {}".format(e)})
+
+ def update_log(self, kv) -> None:
+ try:
+ # Open the log file in append mode
+ with open(self.LOG, 'a') as file:
+ # Iterate over each key-value pair in kv
+ for key, value in kv.items():
+ # Write the key-value pair as a new line in the log file
+ file.write('{}: {}\n'.format(key, value))
+ except Exception as e:
+ print('{}> SOMETHING WENT WRONG{}'.format(Fore.RED, Fore.RESET))
+ print('CORRUPTED FOLDER -> UPDATE LOG\n{}'.format(e))
diff --git a/src/emerger.sh b/src_tobedeleted/emerger.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/emerger.sh
rename to src_tobedeleted/emerger.sh
diff --git a/src/logo/README.md b/src_tobedeleted/logo/README.md
similarity index 100%
rename from src/logo/README.md
rename to src_tobedeleted/logo/README.md
diff --git a/src/logo/big_name.png b/src_tobedeleted/logo/big_name.png
similarity index 100%
rename from src/logo/big_name.png
rename to src_tobedeleted/logo/big_name.png
diff --git a/src_tobedeleted/logo/big_name.svg b/src_tobedeleted/logo/big_name.svg
new file mode 100644
index 0000000..6448645
--- /dev/null
+++ b/src_tobedeleted/logo/big_name.svg
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/src/test/argument_check.sh b/src_tobedeleted/test/argument_check.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/test/argument_check.sh
rename to src_tobedeleted/test/argument_check.sh
diff --git a/src/test/integrity_check.sh b/src_tobedeleted/test/integrity_check.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/test/integrity_check.sh
rename to src_tobedeleted/test/integrity_check.sh
diff --git a/src/test/list/.packages b/src_tobedeleted/test/list/.packages
similarity index 100%
rename from src/test/list/.packages
rename to src_tobedeleted/test/list/.packages
diff --git a/src/test/list/.tests b/src_tobedeleted/test/list/.tests
similarity index 100%
rename from src/test/list/.tests
rename to src_tobedeleted/test/list/.tests
diff --git a/src/test/list/.utils b/src_tobedeleted/test/list/.utils
similarity index 100%
rename from src/test/list/.utils
rename to src_tobedeleted/test/list/.utils
diff --git a/src/utils/cache.sh b/src_tobedeleted/utils/cache.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/utils/cache.sh
rename to src_tobedeleted/utils/cache.sh
diff --git a/src/utils/cache_gen.sh b/src_tobedeleted/utils/cache_gen.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/utils/cache_gen.sh
rename to src_tobedeleted/utils/cache_gen.sh
diff --git a/src_tobedeleted/utils/check_pwr.sh b/src_tobedeleted/utils/check_pwr.sh
new file mode 100644
index 0000000..755810d
--- /dev/null
+++ b/src_tobedeleted/utils/check_pwr.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+PWR=""
+if [[ $(grep -c "utils/privileges" $(dirname "$(readlink -f "$0")")/utils/.cache) -gt 0 ]]; then
+ PWR="sudo"
+fi
+
+echo "$PWR"
\ No newline at end of file
diff --git a/src_tobedeleted/utils/global.sh b/src_tobedeleted/utils/global.sh
new file mode 100644
index 0000000..0e36fa3
--- /dev/null
+++ b/src_tobedeleted/utils/global.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Colors
+BLUE="\e[1;34;49m"
+GREEN="\e[1;32;49m"
+LOGO="\e[2;37;49m"
+NORMAL="\e[0m"
+RED="\e[1;91;49m"
+
+# Emojis
+ARCH="\U0001F3F9"
+CHECKMARK="\U00002714"
+COOL="\U0001F60E"
+CROSSMARK="\U0000274C"
+DEBIAN="\U0001F300"
+FLATPAK="\U0001F4E6"
+GENTOO="\U0001F427"
+NIX="\U00002744"
+MONOCLE="\U0001F9D0"
+OPENSUSE="\U0001F98E"
+RPM="\U0001F920"
+SAD="\U0001F622"
+SCROLL="\U0001F4DC"
+SNAP="\U0001F9A2"
+TERMUX="\U0001F916"
+TRASH="\U0001F4A9"
+WHALE="\U0001F40B"
+
+# Argument $1 is color, argument $2 is text
+function puts() {
+ case $1 in
+ BLUE)
+ printf "$BLUE$2$NORMAL\n"
+ ;;
+ GREEN)
+ echo "$GREEN$2$NORMAL" >> $SRC/.hist
+ HIST=$(cat $SRC/.hist)
+ clear
+ printf "$GREEN$HIST$NORMAL\n"
+ ;;
+ LOGO)
+ printf "$LOGO$2$NORMAL\n"
+ ;;
+ NC)
+ printf "$2\n"
+ ;;
+ RED)
+ printf "$RED$2$NORMAL\n"
+ ;;
+ *)
+ printf "$2\n"
+ ;;
+ esac
+}
+
+# Execute and stops in case it fails
+# DO NOT ADD [ ... ] brackets
+function try() {
+ if $@; then
+ continue
+ else
+ puts RED "STOPPED AT '$(for i in "$@"; do echo -n "$i "; done)'"
+ exit 1
+ fi
+}
diff --git a/src/utils/help b/src_tobedeleted/utils/help
similarity index 100%
rename from src/utils/help
rename to src_tobedeleted/utils/help
diff --git a/src/utils/privileges.sh b/src_tobedeleted/utils/privileges.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/utils/privileges.sh
rename to src_tobedeleted/utils/privileges.sh
diff --git a/src/utils/trash.sh b/src_tobedeleted/utils/trash.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/utils/trash.sh
rename to src_tobedeleted/utils/trash.sh
diff --git a/update.py b/update.py
new file mode 100644
index 0000000..a416bc9
--- /dev/null
+++ b/update.py
@@ -0,0 +1,21 @@
+from colorama import init, Fore
+from setup import Setup
+from subprocess import PIPE, run
+
+
+if __name__ == "__main__":
+ # Initialize colorama
+ init()
+ print('{}----- UPDATE PROCESS -----{}'.format(Fore.GREEN, Fore.RESET))
+
+ # Pull from source
+ url = 'https://github.com/TheMergers/eMerger.git'
+ result = run(['git', 'pull', url], stdout=PIPE, stderr=PIPE)
+ if result.returncode == 0:
+ print('{}>{} Application successfully updated!\n'.format(Fore.BLUE, Fore.RESET))
+ else:
+ print('{}> SOMETHING WENT WRONG{}'.format(Fore.RED, Fore.RESET))
+ print(result.stderr.decode())
+
+ # Recreate application.json
+ Setup().run_setup()
diff --git a/update.sh b/update.sh
deleted file mode 100755
index c17b1a1..0000000
--- a/update.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-# Keeping track of exact time
-date "+%D %T:%N" >> $1.log
-
-source $1src/utils/global.sh
-
-# git pull from main
-puts RED "Update repository: starting"
-if [[ $1 != "" ]]; then
- git -C $1 pull https://github.com/MasterCruelty/eMerger.git/
-else
- git pull https://github.com/MasterCruelty/eMerger.git/
-fi
-
-# Instead of re-installing, use our tests to check if everything is okay
-source $1src/test/integrity_check.sh $1 2>>$1.log
-puts GREEN "Update repository: completed"
-
-exit 0