diff --git a/README.md b/README.md index 53532b5..b046879 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,30 @@ # TAIGA -Taiga or Terminal Application for Installing Graphical Appliances is a terminal script for configuring a desktop environment on the system. -## Installer types -**1.Express install:** The script will detect the distro and the GPU used,and you can pick the desktop environment,which will be installed with the appropriate display manager. -**2.Custom install:** Pick all options manually.Useful if auto-detection doesn't work or if some components are not needed -Aditionally you can run the script in diffrent modes by adding these arguments after the script: -- *s* : Simulation mode-no changes will be done to the system -- *l* [`filepath`]: loads configuration from the file specified in [filepath] -- *sl* / *ls* [`filepath`]: loads configuration from the file specified in [filepath] and enters Simulation mode -- *h* : shows this screen and exits -## Prerequisites -The script requires `python`,`sudo` and `pciutils` in order to run.Please check commands for installing these dependencies as well as whether they're already configured on your system or not here: -[https://github.com/document10/taiga/info/distros.md](https://github.com/document10/taiga/blob/master/info/distros.md) -## Running the script -Currently there are two ways to run the script: -### Method 1:Using python +Taiga or Terminal Application for Installing Graphical Appliances is a terminal program for configuring a desktop environment,sound server and other useful components on the system.The application is controlled using the keyboard and you will see what keys to press for performing actions in the app. +## Running TAIGA +For running the program you will need `sudo` and `pciutils` installed on the system.Guides for installing and checking if these components are installed are available on the wiki. +### Running from binary +The `master` or `dev` branches won't include binaries by default,instead those are included on the `bin` branches which contain only the binary specific to the platform.To get the `Linux` binary run: +``` +git clone https://github.com/document10/taiga -b bin_linux +``` +And for the `FreeBSD` binary run: +``` +git clone https://github.com/document10/taiga -b bin_fbsd +``` +The binaries are also avalaible on the [Releases](https://github.com/document10/taiga/releases) page. +After getting the binary relevant to your system,ensure you have enough rights to run the binary using: + ```sh -python3 taiga.py [args] +sudo chmod 777 taiga ``` -or +Running the script is pretty straightforward: ```sh -python taiga.py [args] +./taiga ``` -### Method 2:Using shell commands +You can also load a config created with the script using: ```sh -chmod +X taiga.py #only run once -./taiga.py [args] +./taiga [configfile] ``` -Note:This method does not work on FreeBSD as all user-installed binaries are stored in `/usr/local/bin`,as opposed to `/usr/bin`.FreeBSD users must use **Method 1**. +where [configfile] is the path to the config. +### Running from source +You will additionally need the latest version of python as well as `simple-term-menu` as a `pip` library.Instructions on setting up those are on the wiki. \ No newline at end of file diff --git a/distros/FreeBSD.json b/distros/FreeBSD.json index a29a8b9..4218ce3 100644 --- a/distros/FreeBSD.json +++ b/distros/FreeBSD.json @@ -2,7 +2,7 @@ "name":"FreeBSD", "identify" : "pkg -v", "order" : 3, - "pre" : ["sudo freebsd-update fetch","sudo freebsd-update install","sudo pkg update","sudo pkg upgrade","sudo pkg install -y xf86-input-evdev xorg xdg-user-dirs xdg-utils oss polkit bash neofetch curl gcc micro gvfs unzip gzip lzip exa python usbutils networkmgr bsdisks octopkg"], + "pre" : ["sudo freebsd-update fetch","sudo freebsd-update install","sudo pkg update","sudo pkg upgrade","sudo pkg install -y xf86-input-evdev xorg xdg-user-dirs xdg-utils oss polkit bash neofetch curl gcc micro gvfs unzip gzip lzip exa python usbutils networkmgr bsdisks"], "post" : ["sudo sysrc dbus_enable=YES","sudo sysrc hald_enable=YES","sudo sysrc sound_load=YES","sudo sysrc snd_hda_load=YES","sudo sysrc moused_enable=YES","sudo sysrc snd_driver=YES"], "GD" : [ { @@ -52,7 +52,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo pkg install -y awesome pcmanfm"] + "comm": ["sudo pkg install -y awesome pcmanfm polkit-gnome dunst libnotify"] }, { "name":"Budgie", @@ -74,6 +74,11 @@ "DM":"GDM", "comm":["sudo pkg install -y gnome polkit-gnome"] }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo pkg install -y i3 dmenu pcmanfm polkit-gnome dunst libnotify"] + }, { "name":"KDE Plasma", "DM":"SDDM", @@ -94,16 +99,31 @@ "DM":"LightDM", "comm":["sudo pkg install -y mate mate-themes polkit-gnome"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo pkg install -y openbox obconf menumaker pcmanfm polkit-gnome dunst libnotify"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo pkg install -y wayland seatd sway swaybg swaylock dmenu-wayland dmenu swayidle waybar xwayland pcmanfm polkit-gnome dunst libnotify","export XDG_RUNTIME_DIR=/var/run/user/`id -u`","sudo sysrc seatd_enable=YES"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo pkg install -y polkit-gnome xfce"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo pkg install -y hs-xmonad pcmanfm polkit-gnome dunst libnotify"] } ], "tasks" : [ { "name":"Install recommended packages", - "comm":["sudo pkg -y install vlc firefox libreoffice"] + "comm":["sudo pkg -y install vlc firefox libreoffice octopkg"] } ] } \ No newline at end of file diff --git a/distros/arch.json b/distros/arch.json index a441f6a..530a1d6 100644 --- a/distros/arch.json +++ b/distros/arch.json @@ -2,7 +2,7 @@ "name":"Arch Linux", "identify" : "which pacman", "order" : 0, - "pre" : ["sudo pacman -Syu --noconfirm xorg xorg-server xterm avahi xdg-user-dirs xdg-utils bluez bluez-utils alsa-utils pipewire pipewire-alsa pipewire-pulse pipewire-jack sof-firmware blueman network-manager-applet gvfs exa neofetch micro polkit"], + "pre" : ["sudo pacman -Syu --noconfirm","sudo pacman --noconfirm -S xorg xorg-server xterm avahi xdg-user-dirs xdg-utils bluez bluez-utils alsa-utils pipewire pipewire-alsa pipewire-pulse pipewire-jack sof-firmware blueman network-manager-applet gvfs exa neofetch micro polkit"], "post" : ["sudo systemctl enable bluetooth","sudo systemctl set-default graphical.target"], "GD" : [ { @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo pacman -S --noconfirm awesome pcmanfm polkit-gnome"] + "comm": ["sudo pacman -S --noconfirm awesome pcmanfm polkit-gnome dunst libnotify"] }, { "name":"Budgie", @@ -76,10 +76,20 @@ "DM":"GDM", "comm":["sudo pacman -S --noconfirm gnome"] }, + { + "name":"Hyprland", + "DM":"SDDM", + "comm":["sudo pacman -S --noconfirm hyprland xorg-xwayland waybar dunst libnotify pcmanfm polkit-gnome"] + }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo pacman -S --noconfirm i3 dmenu pcmanfm polkit-gnome"] + }, { "name":"KDE Plasma", "DM":"SDDM", - "comm":["sudo pacman -S --noconfirm plasma plasma-wayland-session kde-applications packagekit-qt5 sddm-kcm"] + "comm":["sudo pacman -S --noconfirm plasma plasma-wayland-session kde-applications packagekit-qt5 sddm-kcm dunst libnotify"] }, { "name":"LXDE", @@ -96,21 +106,49 @@ "DM":"LightDM", "comm":["sudo pacman -S --noconfirm mate mate-extra polkit-gnome"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo pacman -S --noconfirm openbox obconf menumaker alacritty pcmanfm polkit-gnome dunst libnotify"] + }, { "name":"Pantheon", "DM":"LightDM", "comm":["sudo pacman -S --noconfirm pantheon"] }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo pacman -S --noconfirm sway swaybg swaylock swayidle xorg-xwayland waybar swayimg pcmanfm polkit-gnome dunst libnotify"] + }, + { + "name":"Weston", + "DM":"LightDM", + "comm":["sudo pacman -S --noconfirm weston xorg-xwayland pcmanfm polkit-gnome dunst libnotify"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo pacman -S --noconfirm xfce4 xfce4-goodies polkit-gnome"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo pacman -S --noconfirm xmonad xmonad-contrib pcmanfm polkit-gnome dunst libnotify dmenu"] } ], "tasks" : [ { - "name":"Configure extra sources", - "comm":["sudo pacman -S --noconfirm cargo flatpak", "git clone https://aur.archlinux.org/paru.git","cd paru && makepkg -si","git clone https://aur.archlinux.org/snapd.git","cd snapd && makepkg -si","sudo systemctl enable --now snapd.socket","sudo snap install core","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] + "name":"Install paru (AUR helper)", + "comm":["sudo pacman -S --noconfirm cargo", "git clone https://aur.archlinux.org/paru.git","cd paru && makepkg -si"] + }, + { + "name":"Install snapd", + "comm":["git clone https://aur.archlinux.org/snapd.git","cd snapd && makepkg -si","sudo systemctl enable --now snapd.socket","sudo snap install core"] + }, + { + "name":"Install flatpak", + "comm":["sudo pacman -S --noconfirm flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { "name":"Install recommended packages", @@ -118,7 +156,7 @@ }, { "name":"Install extra themes", - "comm":["git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo pacman -S --noconfirm sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } \ No newline at end of file diff --git a/distros/debian.json b/distros/debian.json index 086703a..30d20b0 100644 --- a/distros/debian.json +++ b/distros/debian.json @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo apt install -y awesome pcmanfm"] + "comm": ["sudo apt install -y awesome pcmanfm dunst"] }, { "name":"Budgie", @@ -61,6 +61,11 @@ "DM":"GDM", "comm":["sudo apt install -y task-gnome-desktop"] }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo apt install -y i3 dunst pcmanfm"] + }, { "name":"KDE Plasma", "DM":"SDDM", @@ -81,16 +86,44 @@ "DM":"LightDM", "comm":["sudo apt install -y task-mate-desktop mate-desktop-environment-extras"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo apt install -y openbox obconf dunst pcmanfm"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo apt install -y sway swaybg swaylock swayidle waybar xwayland pcmanfm dunst"] + }, + { + "name":"Weston", + "DM":"LightDM", + "comm":["sudo apt install -y weston xwayland pcmanfm dunst"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo apt install -y task-xfce-desktop"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo apt install -y xmonad libghc-xmonad-contrib-dev pcmanfm dunst suckless-tools"] } ], "tasks" : [ { - "name" : "Configure extra sources", - "comm" : ["sudo dpkg --add-architecture i386","sudo apt update","sudo apt upgrade","sudo apt install -y flatpak snapd","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo","sudo snap install core"] + "name" : "Add 32-bit repositories", + "comm" : ["sudo dpkg --add-architecture i386","sudo apt update","sudo apt upgrade"] + }, + { + "name":"Install snapd", + "comm":["sudo apt install -y snapd","sudo systemctl enable --now snapd.socket","sudo snap install core"] + }, + { + "name":"Install flatpak", + "comm":["sudo apt install -y flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { "name":"Install recommended packages", @@ -98,7 +131,7 @@ }, { "name":"Install extra themes", - "comm":["git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo apt install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } \ No newline at end of file diff --git a/distros/fedora.json b/distros/fedora.json index bf88da0..c9d113a 100644 --- a/distros/fedora.json +++ b/distros/fedora.json @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo dnf install -y awesome pcmanfm"] + "comm": ["sudo dnf install -y awesome pcmanfm dunst polkit-gnome libnotify"] }, { "name":"Budgie", @@ -91,16 +91,44 @@ "DM":"LightDM", "comm":["sudo dnf group install -y 'MATE Desktop'","sudo dnf group install -y 'MATE Applications'"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo dnf install -y openbox obconf dunst pcmanfm libnotify"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo dnf install -y sway swaybg swaylock swayidle waybar dunst pcmanfm libnotify"] + }, + { + "name":"Weston", + "DM":"LightDM", + "comm":["sudo apt install -y weston dunst pcmanfm libnotify"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo dnf group install -y 'Xfce Desktop'"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo dnf install -y xmonad ghc-xmonad-contrib polkit-gnome dunst polkit-gnome libnotify"] } ], "tasks" : [ { - "name" : "Configure extra sources", - "comm" : ["sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm","sudo dnf groupupdate core -y","sudo dnf install fedora-workstation-repositories -y","sudo dnf install -y flatpak snapd","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo","sudo snap install core"] + "name" : "Configure extra repositories", + "comm" : ["sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm","sudo dnf groupupdate core -y","sudo dnf install fedora-workstation-repositories -y"] + }, + { + "name":"Install snapd", + "comm":["sudo dnf install -y snapd","sudo systemctl enable --now snapd.socket","sudo snap install core"] + }, + { + "name":"Install flatpak", + "comm":["sudo dnf install -y flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { "name":"Install recommended packages", @@ -108,7 +136,7 @@ }, { "name":"Install extra themes", - "comm":["git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo dnf install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } \ No newline at end of file diff --git a/distros/opensuse.json b/distros/opensuse.json index d8180c9..d36c0e3 100644 --- a/distros/opensuse.json +++ b/distros/opensuse.json @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo zypper install -y awesome pcmanfm"] + "comm": ["sudo zypper install -y awesome pcmanfm dunst libnotify"] }, { "name":"Budgie", @@ -71,6 +71,11 @@ "DM":"GDM", "comm":["sudo zypper install -y -t pattern gnome"] }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo zypper install -y i3 dmenu i3status dunst pcmanfm libnotify"] + }, { "name":"KDE Plasma", "DM":"SDDM", @@ -91,16 +96,44 @@ "DM":"LightDM", "comm":["sudo zypper install -y patterns-mate-mate"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo zypper install -y openbox obconf dunst pcmanfm libnotify"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo zypper install -y sway swaybg swaylock swayidle waybar dunst pcmanfm libnotify"] + }, + { + "name":"Weston", + "DM":"LightDM", + "comm":["sudo zypper install -y weston dunst pcmanfm libnotify"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo zypper install -y -t pattern xfce"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo zypper install -y xmonad ghc-xmonad-contrib dunst libnotify"] } ], "tasks" : [ { - "name" : "Configure extra sources", - "comm" : ["sudo zypper ar https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed/ snappy","sudo zypper --gpg-auto-import-keys refresh","sudo zypper dup --from snappy","sudo zypper install -y flatpak snapd","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo","sudo snap install core"] + "name" : "Configure extra repositories", + "comm" : ["sudo zypper ar https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed/ snappy","sudo zypper --gpg-auto-import-keys refresh","sudo zypper dup --from snappy"] + }, + { + "name":"Install snapd", + "comm":["sudo zypper install -y snapd","sudo systemctl enable --now snapd.socket","sudo snap install core"] + }, + { + "name":"Install flatpak", + "comm":["sudo zypper install -y flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { "name":"Install recommended packages", @@ -108,7 +141,7 @@ }, { "name":"Install extra themes", - "comm":["git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo zypper install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } \ No newline at end of file diff --git a/distros/ubuntu.json b/distros/ubuntu.json index 9449cf6..a4977a8 100644 --- a/distros/ubuntu.json +++ b/distros/ubuntu.json @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo apt install -y awesome pcmanfm"] + "comm": ["sudo apt install -y awesome pcmanfm dunst"] }, { "name":"Budgie (Ubuntu-branded)", @@ -86,6 +86,11 @@ "DM":"GDM", "comm":["sudo apt install -y task-gnome-desktop"] }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo apt install -y i3 dunst pcmanfm"] + }, { "name":"KDE Plasma (Ubuntu-branded)", "DM":"", @@ -121,6 +126,21 @@ "DM":"LightDM", "comm":["sudo apt install -y task-mate-desktop mate-desktop-environment-extras"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo apt install -y openbox obconf dunst pcmanfm"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo apt install -y sway swaybg swaylock swayidle waybar xwayland pcmanfm dunst"] + }, + { + "name":"Weston", + "DM":"LightDM", + "comm":["sudo apt install -y weston xwayland pcmanfm dunst"] + }, { "name":"XFCE (Ubuntu-branded)", "DM":"", @@ -130,12 +150,25 @@ "name":"XFCE (Vanilla)", "DM":"LightDM", "comm":["sudo apt install -y task-xfce-desktop"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo apt install -y xmonad libghc-xmonad-contrib-dev pcmanfm dunst suckless-tools"] } ], "tasks" : [ { - "name" : "Configure extra sources", - "comm" : ["sudo dpkg --add-architecture i386","sudo add-apt-repository universe","sudo apt update","sudo apt upgrade","sudo apt install -y flatpak snapd","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo","sudo snap install core"] + "name" : "Configure extra repositories", + "comm" : ["sudo dpkg --add-architecture i386","sudo add-apt-repository universe","sudo apt update","sudo apt upgrade"] + }, + { + "name":"Install snapd", + "comm":["sudo apt install -y snapd","sudo systemctl enable --now snapd.socket","sudo snap install core"] + }, + { + "name":"Install flatpak", + "comm":["sudo apt install -y flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { "name":"Install recommended packages", @@ -143,7 +176,7 @@ }, { "name":"Install extra themes", - "comm":["git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo apt install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } diff --git a/distros/void.json b/distros/void.json index a76464d..098b28a 100644 --- a/distros/void.json +++ b/distros/void.json @@ -1,8 +1,8 @@ { "name":"Void Linux", "identify" : "xbps-install -V", - "order" : 5, - "pre" : ["sudo xbps-install -Syuv xorg xinit xterm pipewire gvfs avahi xdg-user-dirs xdg-utils wireplumber bluez blueman network-manager-applet polkit"], + "order" : 6, + "pre" : ["sudo xbps-install -Syuv","sudo xbps-install -y xorg xinit xterm pipewire gvfs avahi xdg-user-dirs xdg-utils wireplumber bluez blueman network-manager-applet polkit"], "post" : ["sudo ln -s /etc/sv/bluetoothd /var/service","sudo ln -s /etc/sv/NetworkManager /var/service","sudo ln -s /etc/sv/avahi-daemon /var/service","sudo ln -s /etc/sv/dbus /var/service"], "GD" : [ { @@ -44,7 +44,7 @@ { "name":"Awesome", "DM":"LightDM", - "comm": ["sudo xbps-install -y awesome pcmanfm polkit-gnome"] + "comm": ["sudo xbps-install -y awesome pcmanfm polkit-gnome dunst libnotify"] }, { "name":"Budgie", @@ -66,6 +66,11 @@ "DM":"GDM", "comm":["sudo xbps-install -y gnome gnome-apps polkit-gnome"] }, + { + "name":"i3", + "DM":"LightDM", + "comm":["sudo xbps-install -y libnotify i3 dunst pcmanfm polkit-gnome"] + }, { "name":"KDE Plasma", "DM":"SDDM", @@ -86,15 +91,34 @@ "DM":"LightDM", "comm":["sudo xbps-install -y mate mate-extra polkit-gnome"] }, + { + "name":"Openbox", + "DM":"LightDM", + "comm":["sudo xbps-install -y openbox obconf menumaker pcmanfm polkit-gnome dunst libnotify"] + }, + { + "name":"Sway", + "DM":"LightDM", + "comm":["sudo xbps-install -y sway swaybg swaylock swayidle xorg-server-xwayland pcmanfm polkit-gnome dunst libnotify elogind","sudo ln -s /etc/sv/elogind /var/service"] + }, { "name":"XFCE", "DM":"LightDM", "comm":["sudo xbps-install -y xfce4 polkit-gnome"] + }, + { + "name":"Xmonad", + "DM":"LightDM", + "comm":["sudo xbps-install -y xmonad xmonad-contrib polybar pcmanfm polkit-gnome dunst libnotify dmenu"] } ], "tasks" : [ { - "name" : "Configure extra sources", + "name":"Configure extra repositories", + "comm":["sudo xbps-install -y void-repo-nonfree void-repo-multilib void-repo-multilib-nonfree","sudo xbps-install -Syuv"] + }, + { + "name" : "Install flatpak", "comm" : ["sudo xbps-install -y flatpak","sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo"] }, { @@ -103,7 +127,7 @@ }, { "name":"Install extra themes", - "comm":["sudo xbps-install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh"] + "comm":["sudo xbps-install -y sassc","git clone https://github.com/vinceliuice/Orchis-theme","cd Orchis-theme && ./install.sh -t all","cd ..","git clone https://github.com/vinceliuice/Tela-circle-icon-theme","cd Tela-circle-icon-theme && ./install.sh -a","cd ..","git clone https://github.com/vinceliuice/Vimix-cursors","cd Vimix-cursors && sudo ./install.sh","cd","git clone https://gitlab.com/dwt1/wallpapers"] } ] } \ No newline at end of file diff --git a/get_gpu.sh b/get_gpu.sh index 8b7b5dc..530355a 100644 --- a/get_gpu.sh +++ b/get_gpu.sh @@ -1 +1 @@ -lspci | grep VGA \ No newline at end of file +lspci -v | grep -i "VGA" \ No newline at end of file diff --git a/info/distros.md b/info/distros.md deleted file mode 100644 index 02ce51d..0000000 --- a/info/distros.md +++ /dev/null @@ -1,47 +0,0 @@ -# TAIGA Distros -This page details information about each of the supported distros,including supported setups,dependencies and commands. -## Support -### Graphics Vendors -| | AMD | Intel | Nvidia | VMware/Virtualbox | VESA/Generic | -|-|-----|-------|--------|-------------------|------| -|Arch Linux|yes|yes|yes|yes|yes| -|Debian/Ubuntu|yes|yes|yes|yes|yes| -|OpenSUSE|yes|yes|yes|yes|yes| -|Fedora|yes|yes|yes|yes|yes| -|Void Linux|yes|yes|yes|yes|yes| -|FreeBSD|yes|yes|yes|Separate drivers for VMware and Virtualbox|VESA for BIOS systems,SCFB for UEFI systems| -### Desktop Environments -| | Arch Linux | Debian | Ubuntu | Fedora | OpenSUSE | Void Linux | FreeBSD | -|-|------------|--------|--------|--------|----------|------------|---------| -| Awesome | yes | yes | yes | yes | yes | yes | yes | -| Budgie | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| Cinnamon | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| Cutefish | yes | no | no | no | no | no | no | no | -| Deepin | yes | no | Ubuntu-branded version only | yes | yes | no | no | -| Enlightenment | yes | no | yes | yes | yes | yes | yes | -| GNOME | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| KDE Plasma | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| LXDE | yes | yes | yes | yes | yes | yes | yes | -| LXQT | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| MATE | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| Pantheon | yes | no | no | no | no | no | no | -| XFCE | yes | yes | with Ubuntu-branded version | yes | yes | yes | yes | -| Overall | 100% | 69% (nice) | 84% | 84% | 84% | 76% | 76% | - -## Dependencies -Guides for configuring sudo: -[Linux](https://www.linuxteck.com/steps-to-configure-sudo-in-linux/) -[FreeBSD](https://www.cyberciti.biz/faq/freebsd-install-sudo-command/) -| | Arch Linux| Debian/Ubuntu | FreeBSD | OpenSUSE | Fedora | Void Linux | -|-|-----------|---------------|---------|----------|--------|------------| -| python | Manually | Preconfigured | Manually | Manually | Manually | Manual | -| pciutils | Preconfigured | Preconfigured | Manually | Preconfigured | Preconfigured | Preconfigured | -| sudo | Manually | Preconfigured(not on Debian) | Preconfigured | Preconfigured | Preconfigured | Preconfigured | -| Commands | `pacman -S python sudo pciutils` | `apt install python sudo pciutils` | `pkg install python sudo pciutils` | `zypper install python sudo pciutils` | `dnf install python sudo pciutils`| `xbps-install python3 sudo pciutils` | - -Notes: -- Aditionally for Arch Linux make sure that the `multilib` repository is enabled,as this is where most graphics drivers are pulled from.To do that uncomment these lines (remove the `#` symbol before each line) in `/etc/pacman.conf`: -``` -[multilib] -Include = /etc/pacman.d/mirrorlist -``` \ No newline at end of file diff --git a/info/template.md b/info/template.md deleted file mode 100644 index c50ce1e..0000000 --- a/info/template.md +++ /dev/null @@ -1,31 +0,0 @@ -This folder contains JSON files related to every distro,graphics vendor,display manager and desktop environment.These files follow this structure: - -``` -{ - "name":"", - "identify" : "", - "order" : 0, - "pre" : [], - "post" : [], - "GD" : [ - { - "name" : "", - "comm" : [] - } - ], - "DM":[ - { - "name":"", - "comm":[] - } - ], - "DE":[ - { - "name":"", - "DM":"", - "comm": [], - } - ] -} - -``` \ No newline at end of file diff --git a/scripts/build_bin.sh b/scripts/build_bin.sh new file mode 100644 index 0000000..f2013ad --- /dev/null +++ b/scripts/build_bin.sh @@ -0,0 +1,11 @@ +cd .. +echo "Removing previous binary" +rm -rf taiga +echo "Compiling executable" +pyinstaller taiga.py -F +echo "Cleaning up" +mv dist/taiga taiga +rm -rf build +rm -rf dist +rm -rf taiga.spec +ls -a \ No newline at end of file diff --git a/scripts/build_from_env.sh b/scripts/build_from_env.sh new file mode 100644 index 0000000..349c2b9 --- /dev/null +++ b/scripts/build_from_env.sh @@ -0,0 +1,11 @@ +cd .. +echo "Removing previous binary" +rm -rf taiga +echo "Compiling executable" +bin/pyinstaller taiga.py -F +echo "Cleaning up" +mv dist/taiga taiga +rm -rf build +rm -rf dist +rm -rf taiga.spec +ls -a \ No newline at end of file diff --git a/scripts/create_env.sh b/scripts/create_env.sh new file mode 100644 index 0000000..63fe1f2 --- /dev/null +++ b/scripts/create_env.sh @@ -0,0 +1,8 @@ +cd .. +echo "Creating virtual python environment" +python3 -m venv $(pwd) +echo "Upgrading pip" +bin/pip install --upgrade pip +echo "Installing dependencies" +bin/pip install pyinstaller simple-term-menu +echo "Environment created.To compile the binary using the local environment use the build_from_env.sh script." \ No newline at end of file diff --git a/taiga.py b/taiga.py index dcab75b..e7ac59a 100755 --- a/taiga.py +++ b/taiga.py @@ -2,300 +2,408 @@ from pathlib import Path from re import search from operator import itemgetter +from simple_term_menu import TerminalMenu import time import os import json -import subprocess import sys import math -id = -1 -mode = 1 -sim = "" -load = 0 -distros = [] -distro = {} -workdir = "" -dirs = [] -#Serialize all info related to distros -try: - workdir = Path.cwd() - dirs = os.listdir(str(workdir)+"/distros") - for d in dirs: - file = open(str(workdir)+"/distros/"+d,"r") - j = json.loads(file.read()) - distros.append(j) - file.close() -except: - print("ERROR:The script couldn't load all required files propperly.This could be because some files are missing or corrupt.Reinstall the script and try again.") - exit(1) -distros = sorted(distros, key=itemgetter('order')) -build = { - "distro":-1, - "GD":-1, - "DM":-1, - "DE":-1, - "tasks":[] -} +#will be important for future versions +version = 0.4 -if len(sys.argv) > 1: - if sys.argv[1].lower() == "s": - mode = 0 - print("Running in simulation mode,no changes will be made to your system.") - sim = open("taiga_"+str(math.ceil(time.time())), "x") - elif sys.argv[1].lower() == "l": - try: - path = sys.argv[2] - f = open(sys.argv[2],"r") - build = json.loads(f.read()) - except: - print("Configuration invalid!") - exit(1) - distro = distros[build["distro"]] - load = 1 - f.close() - print("Config loaded from :" + f.name) - elif sys.argv[1].lower() == "sl" or sys.argv[1].lower() == "ls": - try: - path = sys.argv[2] - f = open(sys.argv[2],"r") - build = json.loads(f.read()) - except: - print("Configuration invalid!") - exit(1) - distro = distros[build["distro"]] - load = 1 - f.close() - print("Config loaded from :" + f.name) - mode = 0 - print("Running in simulation mode,no changes will be made to your system.") - sim = open("taiga_"+str(math.ceil(time.time())), "x") - elif sys.argv[1].lower() =="h": - print("./taiga.py [args]") - print("python taiga.py [args]") - print("python3 taiga.py [args]") - print("Note:arguments are not case sensitive.") - print("") - print("s : Simulation mode-no changes will be done to the system") - print("l [filepath]: loads configuration from the file specified in [filepath]") - print("sl/ls [filepath]: loads configuration from the file specified in [filepath] and enters Simulation mode") - print("h : shows this screen and exits") - exit() - else: - print("Invalid argument") - exit(1) +###functions for creating menus +#generic menu +def opt_menu(options,text,index=0,hint=0): + if hint == 1: + menu = TerminalMenu(options,menu_cursor=(None),quit_keys=(""),menu_highlight_style=("bg_cyan","fg_black"),title=text,skip_empty_entries=True,cursor_index=index,status_bar="\nArrow keys:Navigate options\nEnter:Select\n/:Search\nPress the key in braces to quickly select the option",status_bar_style=("fg_green","italics"),shortcut_key_highlight_style=("fg_purple","bold"),clear_screen=True) + return menu.show() + else: + menu = TerminalMenu(options,menu_cursor=(None),quit_keys=(""),menu_highlight_style=("bg_cyan","fg_black"),title=text,skip_empty_entries=True,cursor_index=index,clear_screen=True) + return menu.show() -def run_comm(comm): - if mode ==0: - print(comm) - sim.write(comm) - sim.write("\n") - elif mode == 1: - os.system(comm) - elif mode == 2: - print(comm) - os.system(comm) +#configs menu +def conf_menu(items,text,skip,index=0): + if skip == 0: + options = [] + sc = ["[0] ","[1] ","[2] ","[3] ","[4] ","[5] ","[6] ","[7] ","[8] ","[9] ","[a] ","[b] ","[c] ","[d] ","[e] ","[f] ","[g] ","[h] ","[i] ","[j] ","[k] ","[l] ","[m] ","[n] ","[o] ","[p] ","[q] ","[r] ","[s] ","[t] ","[u] ","[v] ","[w] ","[x] ","[y] ","[z] "] + n = 0 + for i in items: + if len(items) < 11: + options.append("["+str(n)+"]"+i["name"]) + else: + options.append(sc[n]+i["name"]) + n+=1 + menu = TerminalMenu(options,menu_cursor=(None),quit_keys=(""),menu_highlight_style=("bg_purple","fg_black"),title=text,cursor_index=index,status_bar="\nArrow keys:Navigate options\nEnter:Select\n/:Search\nPress the key in braces to quickly select the option",status_bar_style=("fg_green","italics"),shortcut_key_highlight_style=("fg_red","bold"),clear_screen=True) + return menu.show() + else: + options = ["[0] Skip"] + sc = ["[1] ","[2] ","[3] ","[4] ","[5] ","[6] ","[7] ","[8] ","[9] ","[a] ","[b] ","[c] ","[d] ","[e] ","[f] ","[g] ","[h] ","[i] ","[j] ","[k] ","[l] ","[m] ","[n] ","[o] ","[p] ","[q] ","[r] ","[s] ","[t] ","[u] ","[v] ","[w] ","[x] ","[y] ","[z] "] + n=1 + for i in items: + if len(items) < 11: + options.append("["+str(n)+"]"+i["name"]) + else: + options.append(sc[n]+i["name"]) + n+=1 + menu = TerminalMenu(options,menu_cursor=(None),quit_keys=(""),menu_highlight_style=("bg_blue","fg_black"),title=text,cursor_index=index,status_bar="\nArrow keys:Navigate options\nEnter:Select\n/:Search\nPress the key in braces to quickly select the option",status_bar_style=("fg_green","italics"),shortcut_key_highlight_style=("fg_blue","bold"),clear_screen=True) + return menu.show()-1 - +#selection menu +def select_menu(items,text,selected): + terminal_menu = TerminalMenu(items,menu_cursor=(None),quit_keys=(""),menu_highlight_style=("bg_yellow","fg_black"),multi_select=True,multi_select_select_on_accept=False,multi_select_empty_ok=True,title=text,multi_select_cursor_style=("fg_red","bold"),preselected_entries=selected,status_bar="\nArrow keys:Navigate options\nTab/Space:Toggle options\nEnter:Confirm selection\n/:Search",status_bar_style=("fg_cyan","italics"),exit_on_shortcut=False,clear_screen=True) + return terminal_menu.show() -if load == 0: - print("1.Express install:Automatically detect the distro,GPU and installs the desired desktop environment with the reccomended display manager") - print("2.Custom install:Select all options manually") +#builds the script for execution +def script(build,distro,name = "taiga_"+str(math.ceil(time.time()))): + file = "" try: - ins_type = int(input("Select installation type(0 to abort):")) + file = open(name,"x") except: - print("Invalid option") - exit(1) - - if ins_type == 1: - #Identifying the distro - i = 0 - while id==-1 and i =len(distro["DE"]) or build["DE"]<0: - print("Invalid option") - exit(1) - i=0 - - for dm in distro["DM"]: - if dm["name"] == distro["DE"][build["DE"]]["DM"]: - build["DM"]=i - i+=1 - elif ins_type==2: - i=1 - for d in distros: - print(str(i)+"."+d["name"]) - i+=1 - try: - build["distro"]=int(input("Select your distro from the list of supported distros:"))-1 - except: - print("Invalid option") - exit(1) - if build["distro"]>=len(distros) or build["distro"]<0: - print("Invalid option") - exit(1) - distro = distros[build["distro"]] - - i=1 - for gd in distro["GD"]: - print(str(i)+"."+gd["name"]) - i+=1 - try: - build["GD"]= int(input("Enter the graphics driver(0 to skip):"))-1 - except: - print("Invalid option") - exit(1) - if build["GD"]>=len(distro["GD"]) or build["GD"]<-1: - print("Invalid option") - exit(1) - - i=1 - for dm in distro["DM"]: - print(str(i)+"."+ dm["name"]) - i+=1 - try: - build["DM"]= int(input("Enter the display manager(0 to skip):"))-1 - except: - print("Invalid option") - exit(1) - if build["DM"]>=len(distro["DM"]) or build["DM"]<-1: - print("Invalid option") - exit(1) - - i=1 - for de in distro["DE"]: - print(str(i)+"."+de["name"]) - i+=1 - try: - build["DE"]= int(input("Enter the desktop environment(0 to skip):"))-1 - except: - print("Invalid option") - exit(1) - - if build["DE"]>=len(distro["DE"]) or build["DE"]<-1: - print("Invalid option") - exit(1) - else: - print("Installation aborted.") - exit() - #Extra tasks - i=0 - for t in distro["tasks"]: - ch = input(t["name"]+"?(y/n)").lower() - if ch == "y": - build["tasks"].append(i) - i+=1 - -print("Final options:") -print("Distro:"+distro["name"]) -if build["GD"]!=-1: - print("Graphics:"+distro["GD"][build["GD"]]["name"]) -if build["DM"]!=-1: - print("Display Manager:"+distro["DM"][build["DM"]]["name"]) -if build["DE"]!=-1: - print("Desktop Environment:"+distro["DE"][build["DE"]]["name"]) -if len(build["tasks"]) != 0: - print("Extra tasks:") - for t in build["tasks"]: - print(distro["tasks"][t]["name"]) - -print("1.Confirm and install") -print("2.Save config to file and exit") -if mode == 1: - print("3.Simulate commands") -try: - ok = int(input("Select action(0 to abort):")) -except: - print("Invalid option!") - exit(1) - -if ok == 3: - mode = 0 - print("Running in simulation mode,no changes will be made to your system.") - sim = open("taiga_"+str(math.ceil(time.time())), "x") - -if ok == 1 or ok == 3: - print("Configuring base system") - for c in distro["pre"]: - run_comm(c) - print("Installing drivers") + file = open("taiga_"+str(math.ceil(time.time())*2),"x") + if 0 in build["options"]: + file.write("echo Configuring base system\n") + for b in distro["pre"]: + file.write(b+"\n") if build["GD"]!=-1: + file.write("echo Installing graphics drivers\n") for g in distro["GD"][build["GD"]]["comm"]: - run_comm(g) - else: - print("Skipped") - print("Installing display manager") + file.write(g+"\n") if build["DM"]!=-1: + file.write("echo Installing display manager\n") for d in distro["DM"][build["DM"]]["comm"]: - run_comm(d) + file.write(d+"\n") + if build["DE"]!=-1: + file.write("echo Installing desktop environment\n") + for e in distro["DE"][build["DE"]]["comm"]: + file.write(e+"\n") + if len(build["tasks"])>0: + file.write("echo Configuring extra tasks\n") + for t in build["tasks"]: + file.write("echo " + distro["tasks"][t]["name"]+"\n") + for c in distro["tasks"][t]["comm"]: + file.write(c+"\n") + if 1 in build["options"]: + file.write("echo Final configuration\n") + for f in distro["post"]: + file.write(f+"\n") + if 2 in build["options"]: + file.write("echo Installation complete!Rebooting...\n") + cmd = os.system("which systemctl") + if cmd == 0: + file.write("sudo systemctl reboot\n") + else: + file.write("sudo reboot\n") else: - print("Skipped") + file.write("echo Installation complete!") + file.close() + os.system("clear") + return file.name + - print("Installing desktop environment") - if build["DE"]!=-1: - for c in distro["DE"][build["DE"]]["comm"]: - run_comm(c) +#main menu +def main_menu(build,distros,index): + #create base options + options = ["[o] Distro:","[g] Graphics:","[m] Display manager:","[d] Desktop environment:","","[x] Extra tasks:"+str(len(build["tasks"])),"[a] Additional options","","[i] Install","[s] Save config to file","[b] Build script","[q] Quit installation"] + options[0]+=distros[build["distro"]]["name"] + if build["GD"]==-1: + options[1]+=" None" else: - print("Skipped") + options[1]+=distros[build["distro"]]["GD"][build["GD"]]["name"] - print("Performing extra tasks") - if len(build["tasks"]) == 0: - print("Skipped") + if build["DM"]==-1: + options[2]+=" None" else: - for t in build["tasks"]: - print(distro["tasks"][t]["name"]) - cmd = distro["tasks"][t]["comm"] - for c in cmd: - run_comm(c) + options[2]+=distros[build["distro"]]["DM"][build["DM"]]["name"] + + if build["DE"]==-1: + options[3]+=" None" + else: + options[3]+=distros[build["distro"]]["DE"][build["DE"]]["name"] + #wait for choice from user + action = opt_menu(options,"TAIGA "+str(version),index,1) + match action: + case 0: + #change user distro + choice = conf_menu(distros,"Select your distro from the list of supported distros:",0,build["distro"]) + build["distro"] = choice + build["GD"] = get_gpu(distros[build["distro"]]) + build["DM"] = -1 + build["DE"] = -1 + build["tasks"] = [] + main_menu(build,distros,action) + case 1: + #change graphics driver + choice = conf_menu(distros[build["distro"]]["GD"],"Select your graphics driver:",1,build["GD"]+1) + build["GD"]=choice + main_menu(build,distros,action) + case 2: + #change display manager + choice = conf_menu(distros[build["distro"]]["DM"],"Select your display manager:",1,build["DM"]+1) + build["DM"] = choice + main_menu(build,distros,action) + case 3: + #change desktop emvironment + choice = conf_menu(distros[build["distro"]]["DE"],"Select your desktop environment:",1,build["DE"]+1) + build["DE"] = choice + #autoassign display manager + i = 0 + if build["DE"]!=-1: + for dm in distros[build["distro"]]["DM"]: + if dm["name"] == distros[build["distro"]]["DE"][build["DE"]]["DM"]: + build["DM"] = i + i+=1 + main_menu(build,distros,action) + case 5: + #toggle tasks + build["tasks"].sort() + tasks = [] + for t in distros[build["distro"]]["tasks"]: + tasks.append(t["name"]) + choice = select_menu(tasks,"Extra tasks",build["tasks"]) + build["tasks"] = list(choice or []) + main_menu(build,distros,action) + case 6: + #additional options + build["options"].sort() + choice = select_menu(["Base packages","Final configuration","Reboot after install"],"Select additional options",build["options"]) + build["options"] = list(choice or []) + main_menu(build,distros,action) + case 8: + #install + #shows installation options + msg ="Final options:\nOS:"+ distros[build["distro"]]["name"]+"\n" + if build["GD"]!=-1: + msg += "Graphics:"+distros[build["distro"]]["GD"][build["GD"]]["name"]+"\n" + if build["DM"]!=-1: + msg += "Display manager:"+distros[build["distro"]]["DM"][build["DM"]]["name"]+"\n" + if build["DE"]!=-1: + msg += "Desktop environment:"+distros[build["distro"]]["DE"][build["DE"]]["name"]+"\n" + if len(build["tasks"])>0: + msg +="\nExtra tasks:\n" + for t in build["tasks"]: + msg += distros[build["distro"]]["tasks"][t]["name"]+"\n" + msg += "\nAdditional settings:\n" + if 0 not in build["options"]: + msg += "Skip base packages\n" + if 1 not in build["options"]: + msg += "Skip final configuration\n" + if 2 in build["options"]: + msg += "Reboot after install\n" + msg +="\nConfirm?" + #ask for confirmation + ok = opt_menu(["[y] Yes","[n] No"],msg) + if ok == 0: + #begin install + file = script(build,distros[build["distro"]]) + try: + os.system("sh "+file) + except: + print("Installation failed.") + sys.exit() + else: + #return to main menu + main_menu(build,distros,action) + case 9: + #save config + file = "" + try: + name = input("Type file name here:\n") or "config_"+str(math.ceil(time.time()))+".json" + file = open(name,"x") + except: + file = open("config_"+str(math.ceil(time.time())*2)+".json","x") + config = { + "version":version, + "distro" : distros[build["distro"]]["name"], + "GD" : -1, + "DM" : -1, + "DE" : -1, + "tasks" : [], + "options":build["options"] + } + if build["GD"]!=-1: + config["GD"]=distros[build["distro"]]["GD"][build["GD"]]["name"] + if build["DM"]!=-1: + config["DM"]=distros[build["distro"]]["DM"][build["DM"]]["name"] + if build["DE"]!=-1: + config["DE"]=distros[build["distro"]]["DE"][build["DE"]]["name"] + if len(build["tasks"]) != 0 : + for t in build["tasks"]: + config["tasks"].append(distros[build["distro"]]["tasks"][t]["name"]) + file.write(json.dumps(config)) + file.close() + opt_menu(["Press enter to continue"],"Config saved to "+file.name+".You can now load the config using:\n./taiga "+file.name) + main_menu(build,distros,action) + case 10: + #save script + name = "" + try: + name = input("Type file name here:\n") or "taiga_"+str(math.ceil(time.time())) + except: + name = "taiga_"+str(math.ceil(time.time())*2) + file = script(build,distros[build["distro"]],name) + ok = opt_menu(["Press enter to continue"],"All commands have been saved to "+ file) + main_menu(build,distros,action) + case 11: + #exit + print("Installation aborted.") + sys.exit() - print("Final configuration") - for c in distro["post"]: - run_comm(c) - if mode ==0: - print("All commands have been saved to " + sim.name) - sim.close() +#load configs from args +def load(distros): + if len(sys.argv) < 2: + return 0 else: - print("Installation completed.Reboot the system to enter your new GUI!") -elif ok ==2: - f = open("config_"+str(math.ceil(time.time()))+".json", "x") - f.write(json.dumps(build)) - f.close() - print("Config has been saved to " + f.name) -else: - print("Installation aborted.") - exit() + build = {} + config = { + "version":version, + "distro" : -1, + "GD" : -1, + "DM" : -1, + "DE" : -1, + "tasks" : [], + "options":[0,1] + } + try: + file = open(sys.argv[1],"r") + build = json.loads(file.read()) + file.close() + except: + #config is invalid + ok = opt_menu(["[d] Discard config","[x] Exit"],"Couldn't load the config.The config is either corrupted or doesn't exist.") + if ok == 0: + return 0 + else: + print("Installation aborted") + sys.exit() + #checks if the config has all the necesary options + if "version" in build and "distro" in build and "GD" in build and "DM" in build and "DE" in build and "tasks" in build and "options" in build: + #convert from names to indexes + names = [] + for d in distros: + names.append(d["name"]) + try: + config["distro"]=names.index(build["distro"]) + except: + config["distro"]=get_distro(distros) + names = [] + if build["GD"]!=-1: + for d in distros[config["distro"]]["GD"]: + names.append(d["name"]) + try: + config["GD"]=names.index(build["GD"]) + except: + config["GD"]=get_gpu(distros[config["distro"]]) + names = [] + if build["DM"]!=-1: + for d in distros[config["distro"]]["DM"]: + names.append(d["name"]) + try: + config["DM"]=names.index(build["DM"]) + except: + config["DM"]=-1 + names = [] + if build["DE"]!=-1: + for d in distros[config["distro"]]["DE"]: + names.append(d["name"]) + try: + config["DE"]=names.index(build["DE"]) + except: + config["DE"]=-1 + names = [] + if len(build["tasks"])!=0: + for d in distros[config["distro"]]["tasks"]: + names.append(d["name"]) + for t in build["tasks"]: + try: + config["tasks"].append(names.index(t)) + except: + print("error") + config["options"]=build["options"] + config["version"]=build["version"] + return config + else: + ok = opt_menu(["[d] Discard config","[x] Exit"],"This config is incompatible with this version of TAIGA.") + if ok == 0: + return 0 + else: + print("Installation aborted") + sys.exit() + +#gets all data regarding distros +def serialize(): + distros = [] + workdir = Path.cwd() + files = os.listdir(str(workdir)+"/distros") + for f in files: + file = open(str(workdir)+"/distros/"+f,"r") + j = json.loads(file.read()) + distros.append(j) + file.close() + distros = sorted(distros, key=itemgetter('order')) + return distros + +#(attempt to) get the distro +def get_distro(distros): + for d in distros: + r = os.system(d["identify"]) + if r == 0: + return d["order"] + return -1 + +#(attempt to) identify GPU +def get_gpu(distro): + os.system("lspci -v | grep VGA >> cache.file") + file = open("cache.file","r") + output = file.read() + file.close() + os.system("rm -rf cache.file") + i = 0 + for v in distro["GD"]: + if search(v["name"].lower(),output.lower()): + return i + i+=1 + return -1 + +#main function +def main(): + distros = [] + try: + distros = serialize() + except: + #something went wrong with collecting distro info + print("Couldn't load info about the distros.Redownload the script and try again.") + sys.exit(1) + #info about current config + build = load(distros) + distro = {} + if build == 0: + #no config was loaded,loads the default config + build = { + "version":version, + "distro" : -1, + "GD" : -1, + "DM" : -1, + "DE" : -1, + "tasks" : [], + "options":[0,1] + } + #gets info about the system + build["distro"] = get_distro(distros) + if build["distro"] != -1: + distro = distros[build["distro"]] + build["GD"]=get_gpu(distro) + else: + #couldn't identify the distro + build["distro"]= conf_menu(distros,"Your distro couldn't be recognized.Please select your distro manually",0) + if build["distro"]==None: + print("Installation aborted.") + sys.exit(1) + distro = distros[build["distro"]] + build["GD"]=get_gpu(distro) + main_menu(build,distros,0) +#just some boilerplate +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/taiga_old.py b/taiga_old.py new file mode 100755 index 0000000..dcab75b --- /dev/null +++ b/taiga_old.py @@ -0,0 +1,301 @@ +#!/usr/bin/python3 +from pathlib import Path +from re import search +from operator import itemgetter +import time +import os +import json +import subprocess +import sys +import math +id = -1 +mode = 1 +sim = "" +load = 0 +distros = [] +distro = {} +workdir = "" +dirs = [] +#Serialize all info related to distros +try: + workdir = Path.cwd() + dirs = os.listdir(str(workdir)+"/distros") + for d in dirs: + file = open(str(workdir)+"/distros/"+d,"r") + j = json.loads(file.read()) + distros.append(j) + file.close() +except: + print("ERROR:The script couldn't load all required files propperly.This could be because some files are missing or corrupt.Reinstall the script and try again.") + exit(1) +distros = sorted(distros, key=itemgetter('order')) + +build = { + "distro":-1, + "GD":-1, + "DM":-1, + "DE":-1, + "tasks":[] +} + +if len(sys.argv) > 1: + if sys.argv[1].lower() == "s": + mode = 0 + print("Running in simulation mode,no changes will be made to your system.") + sim = open("taiga_"+str(math.ceil(time.time())), "x") + elif sys.argv[1].lower() == "l": + try: + path = sys.argv[2] + f = open(sys.argv[2],"r") + build = json.loads(f.read()) + except: + print("Configuration invalid!") + exit(1) + distro = distros[build["distro"]] + load = 1 + f.close() + print("Config loaded from :" + f.name) + elif sys.argv[1].lower() == "sl" or sys.argv[1].lower() == "ls": + try: + path = sys.argv[2] + f = open(sys.argv[2],"r") + build = json.loads(f.read()) + except: + print("Configuration invalid!") + exit(1) + distro = distros[build["distro"]] + load = 1 + f.close() + print("Config loaded from :" + f.name) + mode = 0 + print("Running in simulation mode,no changes will be made to your system.") + sim = open("taiga_"+str(math.ceil(time.time())), "x") + elif sys.argv[1].lower() =="h": + print("./taiga.py [args]") + print("python taiga.py [args]") + print("python3 taiga.py [args]") + print("Note:arguments are not case sensitive.") + print("") + print("s : Simulation mode-no changes will be done to the system") + print("l [filepath]: loads configuration from the file specified in [filepath]") + print("sl/ls [filepath]: loads configuration from the file specified in [filepath] and enters Simulation mode") + print("h : shows this screen and exits") + exit() + else: + print("Invalid argument") + exit(1) + + +def run_comm(comm): + if mode ==0: + print(comm) + sim.write(comm) + sim.write("\n") + elif mode == 1: + os.system(comm) + elif mode == 2: + print(comm) + os.system(comm) + + + +if load == 0: + print("1.Express install:Automatically detect the distro,GPU and installs the desired desktop environment with the reccomended display manager") + print("2.Custom install:Select all options manually") + try: + ins_type = int(input("Select installation type(0 to abort):")) + except: + print("Invalid option") + exit(1) + + if ins_type == 1: + #Identifying the distro + i = 0 + while id==-1 and i =len(distro["DE"]) or build["DE"]<0: + print("Invalid option") + exit(1) + i=0 + + for dm in distro["DM"]: + if dm["name"] == distro["DE"][build["DE"]]["DM"]: + build["DM"]=i + i+=1 + elif ins_type==2: + i=1 + for d in distros: + print(str(i)+"."+d["name"]) + i+=1 + try: + build["distro"]=int(input("Select your distro from the list of supported distros:"))-1 + except: + print("Invalid option") + exit(1) + if build["distro"]>=len(distros) or build["distro"]<0: + print("Invalid option") + exit(1) + distro = distros[build["distro"]] + + i=1 + for gd in distro["GD"]: + print(str(i)+"."+gd["name"]) + i+=1 + try: + build["GD"]= int(input("Enter the graphics driver(0 to skip):"))-1 + except: + print("Invalid option") + exit(1) + if build["GD"]>=len(distro["GD"]) or build["GD"]<-1: + print("Invalid option") + exit(1) + + i=1 + for dm in distro["DM"]: + print(str(i)+"."+ dm["name"]) + i+=1 + try: + build["DM"]= int(input("Enter the display manager(0 to skip):"))-1 + except: + print("Invalid option") + exit(1) + if build["DM"]>=len(distro["DM"]) or build["DM"]<-1: + print("Invalid option") + exit(1) + + i=1 + for de in distro["DE"]: + print(str(i)+"."+de["name"]) + i+=1 + try: + build["DE"]= int(input("Enter the desktop environment(0 to skip):"))-1 + except: + print("Invalid option") + exit(1) + + if build["DE"]>=len(distro["DE"]) or build["DE"]<-1: + print("Invalid option") + exit(1) + else: + print("Installation aborted.") + exit() + #Extra tasks + i=0 + for t in distro["tasks"]: + ch = input(t["name"]+"?(y/n)").lower() + if ch == "y": + build["tasks"].append(i) + i+=1 + +print("Final options:") +print("Distro:"+distro["name"]) +if build["GD"]!=-1: + print("Graphics:"+distro["GD"][build["GD"]]["name"]) +if build["DM"]!=-1: + print("Display Manager:"+distro["DM"][build["DM"]]["name"]) +if build["DE"]!=-1: + print("Desktop Environment:"+distro["DE"][build["DE"]]["name"]) +if len(build["tasks"]) != 0: + print("Extra tasks:") + for t in build["tasks"]: + print(distro["tasks"][t]["name"]) + +print("1.Confirm and install") +print("2.Save config to file and exit") +if mode == 1: + print("3.Simulate commands") +try: + ok = int(input("Select action(0 to abort):")) +except: + print("Invalid option!") + exit(1) + +if ok == 3: + mode = 0 + print("Running in simulation mode,no changes will be made to your system.") + sim = open("taiga_"+str(math.ceil(time.time())), "x") + +if ok == 1 or ok == 3: + print("Configuring base system") + for c in distro["pre"]: + run_comm(c) + print("Installing drivers") + if build["GD"]!=-1: + for g in distro["GD"][build["GD"]]["comm"]: + run_comm(g) + else: + print("Skipped") + print("Installing display manager") + if build["DM"]!=-1: + for d in distro["DM"][build["DM"]]["comm"]: + run_comm(d) + else: + print("Skipped") + + print("Installing desktop environment") + if build["DE"]!=-1: + for c in distro["DE"][build["DE"]]["comm"]: + run_comm(c) + else: + print("Skipped") + + print("Performing extra tasks") + if len(build["tasks"]) == 0: + print("Skipped") + else: + for t in build["tasks"]: + print(distro["tasks"][t]["name"]) + cmd = distro["tasks"][t]["comm"] + for c in cmd: + run_comm(c) + + print("Final configuration") + for c in distro["post"]: + run_comm(c) + if mode ==0: + print("All commands have been saved to " + sim.name) + sim.close() + else: + print("Installation completed.Reboot the system to enter your new GUI!") +elif ok ==2: + f = open("config_"+str(math.ceil(time.time()))+".json", "x") + f.write(json.dumps(build)) + f.close() + print("Config has been saved to " + f.name) +else: + print("Installation aborted.") + exit() +