Redid dir layout, emphasizing rust port, antiquating bash and python ports. Also added a cleanup command to the rust build shell script.
This commit is contained in:
parent
eec91833d7
commit
0b693e403c
11 changed files with 4 additions and 410 deletions
|
@ -1,116 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Universal updater by Andrew Schott andrew@schotty.com
|
||||
# Will detect and update via various packaging formats for distros I currently use.
|
||||
|
||||
# Globals
|
||||
# edit as needed to set colors and soforth
|
||||
# presuming echo thus tput is chosen here as default\
|
||||
|
||||
# tput text formatting
|
||||
# bold=bold dim=dimmed
|
||||
# rev=reverse bel=bell sound
|
||||
# smul=underline on rmul=underline off
|
||||
# setaf=foreground setab=background
|
||||
# sgr0=clear
|
||||
#
|
||||
# Colors
|
||||
# 0 Black 1 Red 2 Green 3 Yellow
|
||||
# 4 Blue 5 Magenta 6 Cyan 7 White
|
||||
#
|
||||
# Default is
|
||||
# * green for a true finding
|
||||
# * yellow for a false finding
|
||||
# * clear at the end to resume normal output for said command's output
|
||||
|
||||
CMD_NOTIFY="tput rev bold setaf 7 setab 0"
|
||||
CMD_TRUE="tput rev bold setaf 2 setab 0"
|
||||
CMD_FALSE="tput rev bold setaf 1 setab 7"
|
||||
CMD_CLEAR="tput sgr0"
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for native package managers"$($CMD_CLEAR)
|
||||
|
||||
# apt -- Debian and derivatives
|
||||
if `which apt &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found apt. Updating: ($(which apt))"$($CMD_CLEAR)
|
||||
sudo apt udate -y
|
||||
sudo apt upgrade -y
|
||||
else
|
||||
echo $($CMD_FALSE)"apt not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# dnf -- RHEL 8+, Fedora, Openmandriva, and derivatives
|
||||
if `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found dnf. Updating: ($(which dnf))"$($CMD_CLEAR)
|
||||
sudo dnf --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"dnf not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# pacman -- arch & arch derivatives
|
||||
if `which pacman &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found pacman. Updating: ($(which pacman))"$($CMD_CLEAR)
|
||||
sudo pacman -Syu
|
||||
else
|
||||
echo $($CMD_FALSE)"pacman not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# yum -- RHEL 7 > (Ignored if dnf is present)
|
||||
if `which yum &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found yum. Updating: ($(which yum))"$($CMD_CLEAR)
|
||||
sudo yum --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"yum not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# urpmi -- Mageia
|
||||
if `which urpmi &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found urpmi. Updating: ($(which urpmi))"$($CMD_CLEAR)
|
||||
sudo urpmi --auto-update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"urpmi not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# zypper -- SuSE products
|
||||
if `which zypper &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found zypper. Updating: ($(which zypper))"$($CMD_CLEAR)
|
||||
sudo zypper in -y
|
||||
else
|
||||
echo $($CMD_FALSE)"zypper not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for sandboxed package managers"$($CMD_CLEAR)
|
||||
|
||||
# flatpak
|
||||
if `which flatpak &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found flatpak. Updating: ($(which flatpak))"$($CMD_CLEAR)
|
||||
flatpak update --user -y
|
||||
sudo flatpak update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"flatpak not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# snap
|
||||
if `which snap &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found snap. Updating: ($(which snap))"$($CMD_CLEAR)
|
||||
sudo snap refresh -y
|
||||
else
|
||||
echo $($CMD_FALSE)"snap not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# pip
|
||||
if `which pip-review &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found pip-review. Updating: ($(pip-review))"$($CMD_CLEAR)
|
||||
pip-review --auto --local --user
|
||||
else
|
||||
echo $($CMD_FALSE)"pip-review not found/needed"$($CMD_CLEAR)
|
||||
fi
|
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import wx
|
||||
import subprocess
|
||||
|
||||
|
||||
class Example(wx.Frame):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Example, self).__init__(*args, **kwargs)
|
||||
|
||||
self.initui()
|
||||
|
||||
def initui(self):
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
filemenu = wx.Menu()
|
||||
fileitem = filemenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
|
||||
menubar.Append(filemenu, '&File')
|
||||
self.SetMenuBar(menubar)
|
||||
|
||||
self.Bind(wx.EVT_MENU, self.onquit, fileitem)
|
||||
|
||||
self.SetSize((300, 200))
|
||||
self.SetTitle('OS Updater')
|
||||
self.Centre()
|
||||
|
||||
pnl = wx.Panel(self)
|
||||
updateflatpakbutton = wx.Button(pnl, label='Update Flatpaks', pos=(20, 20))
|
||||
updateflatpakbutton.Bind(wx.EVT_BUTTON, self.onflatpakupdate)
|
||||
updaterpmbutton = wx.Button(pnl, label='Update RPMs', pos=(20, 60))
|
||||
updaterpmbutton.Bind(wx.EVT_BUTTON, self.onrpmupdate)
|
||||
|
||||
def onflatpakupdate(self, e):
|
||||
subprocess.run(["flatpak", "update", "-y"])
|
||||
|
||||
def onrpmupdate(self, e):
|
||||
subprocess.run(["sudo", "dnf", "update", "-y"])
|
||||
|
||||
def onquit(self, e):
|
||||
self.Close()
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
app = wx.App(0)
|
||||
ex = Example(None)
|
||||
ex.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,9 +0,0 @@
|
|||
[package]
|
||||
name = "osupdater"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
color-print = "0.3.5"
|
|
@ -1,208 +0,0 @@
|
|||
use std::process::{Command, Stdio};
|
||||
use std::path::Path;
|
||||
use color_print::cprintln;
|
||||
|
||||
fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
s.pop();
|
||||
if s.ends_with('\r') {
|
||||
s.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
{
|
||||
// Tell user that we are going to start the update procedure
|
||||
cprintln!("<bold><rev><white>osupdater : rust edition</white></rev></bold>\n");
|
||||
cprintln!("<bold><rev><white>This tool will locate any package managers on your system and run the update tool appropriate to it.</white></rev></bold>\n");
|
||||
cprintln!("<bold><rev><white>Looking for native package managers.</white></rev></bold>\n");
|
||||
let find_sudo = Command::new("which")
|
||||
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
|
||||
trim_newline(&mut sudo_bin);
|
||||
|
||||
let find_apt = Command::new("which")
|
||||
.arg("apt").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut apt_bin = String::from_utf8(find_apt.stdout).unwrap();
|
||||
trim_newline(&mut apt_bin);
|
||||
|
||||
let find_dnf5 = Command::new("which")
|
||||
.arg("dnf5").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut dnf5_bin = String::from_utf8(find_dnf5.stdout).unwrap();
|
||||
trim_newline(&mut dnf5_bin);
|
||||
|
||||
let find_dnf = Command::new("which")
|
||||
.arg("dnf").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut dnf_bin = String::from_utf8(find_dnf.stdout).unwrap();
|
||||
trim_newline(&mut dnf_bin);
|
||||
|
||||
let find_pacman = Command::new("which")
|
||||
.arg("pacman").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut pacman_bin = String::from_utf8(find_pacman.stdout).unwrap();
|
||||
trim_newline(&mut pacman_bin);
|
||||
|
||||
let find_urpmi = Command::new("which")
|
||||
.arg("urpmi").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut urpmi_bin = String::from_utf8(find_urpmi.stdout).unwrap();
|
||||
trim_newline(&mut urpmi_bin);
|
||||
|
||||
let find_zypper = Command::new("which")
|
||||
.arg("zypper").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut zypper_bin = String::from_utf8(find_zypper.stdout).unwrap();
|
||||
trim_newline(&mut zypper_bin);
|
||||
|
||||
let find_flatpak = Command::new("which")
|
||||
.arg("flatpak").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut flatpak_bin = String::from_utf8(find_flatpak.stdout).unwrap();
|
||||
trim_newline(&mut flatpak_bin);
|
||||
|
||||
let find_snap = Command::new("which")
|
||||
.arg("snap").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut snap_bin = String::from_utf8(find_snap.stdout).unwrap();
|
||||
trim_newline(&mut snap_bin);
|
||||
|
||||
let find_pip_review = Command::new("which")
|
||||
.arg("pip-review").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut pip_review_bin = String::from_utf8(find_pip_review.stdout).unwrap();
|
||||
trim_newline(&mut pip_review_bin);
|
||||
|
||||
//apt
|
||||
cprintln!("<bold><rev><magenta>Checking for apt</magenta></rev></bold>");
|
||||
let path = Path::new(&apt_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&apt_bin).arg("update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&apt_bin).arg("upgrade").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// dnf
|
||||
cprintln!("<bold><rev><blue>Checking for dnf</blue></rev></bold>");
|
||||
let path = Path::new(&dnf_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&dnf_bin).arg("--refresh").arg("--skip-broken").arg("--nobest").arg("-y").arg("update")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// dnf5
|
||||
cprintln!("<bold><rev><blue>Checking for dnf5</blue></rev></bold>");
|
||||
let path = Path::new(&dnf5_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&dnf5_bin).arg("--refresh").arg("--skip-broken").arg("--nobest").arg("-y").arg("update")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// pacman
|
||||
cprintln!("<bold><rev><cyan>Checking for pacman</cyan></rev></bold>");
|
||||
let path = Path::new(&pacman_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&pacman_bin).arg("-Syu")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// urpmi
|
||||
cprintln!("<bold><rev><white>Checking for urpmi</white></rev></bold>");
|
||||
let path = Path::new(&urpmi_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&urpmi_bin).arg("--auto-update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// zypper
|
||||
cprintln!("<bold><rev><green>Checking for zypper</green></rev></bold>");
|
||||
let path = Path::new(&zypper_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&zypper_bin).arg("in").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// Check container formats
|
||||
cprintln!("<bold><rev><white>Checking application containers</white></rev></bold>");
|
||||
|
||||
|
||||
// flatpak
|
||||
cprintln!("<bold><rev><blue>Checking for user flatpak installs</blue></rev></bold>");
|
||||
let path = Path::new(&flatpak_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&flatpak_bin)
|
||||
.arg("update").arg("--user").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
cprintln!("<bold><rev><blue>Checking for system flatpak installs</blue></rev></bold>");
|
||||
let path = Path::new(&flatpak_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&flatpak_bin).arg("update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// snap
|
||||
cprintln!("<bold><rev><magenta>Checking for user snap installation</magenta></rev></bold>");
|
||||
let path = Path::new(&snap_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&snap_bin)
|
||||
.arg("refresh").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
cprintln!("<bold><rev><magenta>Checking for system snap installation</magenta></rev></bold>");
|
||||
let path = Path::new(&snap_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&snap_bin).arg("refresh").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
//Python
|
||||
cprintln!("<bold><rev><red>Updating Python user installation via pip-review</red></rev></bold>");
|
||||
let path = Path::new(&pip_review_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&pip_review_bin)
|
||||
.arg("--auto").arg("--local").arg("--user")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
use std::process::{Command, Stdio};
|
||||
use std::path::Path;
|
||||
use color_print::cprintln;
|
||||
|
||||
fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
s.pop();
|
||||
if s.ends_with('\r') {
|
||||
s.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
{
|
||||
// Tell user that we are going to start the update procedure
|
||||
cprintln!("<bold><rev><white>osupdater : rust edition</white></rev></bold>\n");
|
||||
cprintln!("<bold><rev><white>This tool will locate any package managers on your system and run the update tool appropriate to it.</white></rev></bold>\n");
|
||||
cprintln!("<bold><rev><white>Looking for native package managers.</white></rev></bold>\n");
|
||||
let find_sudo = Command::new("which")
|
||||
.arg("sudo").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut sudo_bin = String::from_utf8(find_sudo.stdout).unwrap();
|
||||
trim_newline(&mut sudo_bin);
|
||||
|
||||
let find_apt = Command::new("which")
|
||||
.arg("apt").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut apt_bin = String::from_utf8(find_apt.stdout).unwrap();
|
||||
trim_newline(&mut apt_bin);
|
||||
|
||||
let find_dnf = Command::new("which")
|
||||
.arg("dnf").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut dnf_bin = String::from_utf8(find_dnf.stdout).unwrap();
|
||||
trim_newline(&mut dnf_bin);
|
||||
|
||||
let find_pacman = Command::new("which")
|
||||
.arg("pacman").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut pacman_bin = String::from_utf8(find_pacman.stdout).unwrap();
|
||||
trim_newline(&mut pacman_bin);
|
||||
|
||||
let find_urpmi = Command::new("which")
|
||||
.arg("urpmi").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut urpmi_bin = String::from_utf8(find_urpmi.stdout).unwrap();
|
||||
trim_newline(&mut urpmi_bin);
|
||||
|
||||
let find_zypper = Command::new("which")
|
||||
.arg("zypper").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut zypper_bin = String::from_utf8(find_zypper.stdout).unwrap();
|
||||
trim_newline(&mut zypper_bin);
|
||||
|
||||
let find_flatpak = Command::new("which")
|
||||
.arg("flatpak").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut flatpak_bin = String::from_utf8(find_flatpak.stdout).unwrap();
|
||||
trim_newline(&mut flatpak_bin);
|
||||
|
||||
let find_snap = Command::new("which")
|
||||
.arg("snap").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut snap_bin = String::from_utf8(find_snap.stdout).unwrap();
|
||||
trim_newline(&mut snap_bin);
|
||||
|
||||
let find_pip_review = Command::new("which")
|
||||
.arg("pip-review").stdout(Stdio::piped()).output().unwrap();
|
||||
let mut pip_review_bin = String::from_utf8(find_pip_review.stdout).unwrap();
|
||||
trim_newline(&mut pip_review_bin);
|
||||
|
||||
//apt
|
||||
cprintln!("<bold><rev><magenta>Checking for apt</magenta></rev></bold>");
|
||||
let path = Path::new(&apt_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&apt_bin).arg("update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&apt_bin).arg("upgrade").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// dnf
|
||||
cprintln!("<bold><rev><blue>hecking for dnf</blue></rev></bold>");
|
||||
let path = Path::new(&dnf_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&dnf_bin).arg("--refresh").arg("--skip-broken").arg("--nobest").arg("-y").arg("update")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// pacman
|
||||
cprintln!("<bold><rev><cyan>Checking for pacman</cyan></rev></bold>");
|
||||
let path = Path::new(&pacman_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&pacman_bin).arg("-Syu")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// urpmi
|
||||
cprintln!("<bold><rev><white>Checking for urpmi</white></rev></bold>");
|
||||
let path = Path::new(&urpmi_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&urpmi_bin).arg("--auto-update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// zypper
|
||||
cprintln!("<bold><rev><green>Checking for zypper</green></rev></bold>");
|
||||
let path = Path::new(&zypper_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&zypper_bin).arg("in").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// Check container formats
|
||||
cprintln!("<bold><rev><white>Checking application containers</white></rev></bold>");
|
||||
|
||||
|
||||
// flatpak
|
||||
cprintln!("<bold><rev><blue>Checking for user flatpak installs</blue></rev></bold>");
|
||||
let path = Path::new(&flatpak_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&flatpak_bin)
|
||||
.arg("update").arg("--user").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
cprintln!("<bold><rev><blue>Checking for system flatpak installs</blue></rev></bold>");
|
||||
let path = Path::new(&flatpak_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&flatpak_bin).arg("update").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
// snap
|
||||
cprintln!("<bold><rev><magenta>Checking for user snap installation</magenta></rev></bold>");
|
||||
let path = Path::new(&snap_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&snap_bin)
|
||||
.arg("refresh").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
cprintln!("<bold><rev><magenta>Checking for system snap installation</magenta></rev></bold>");
|
||||
let path = Path::new(&snap_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&sudo_bin)
|
||||
.arg(&snap_bin).arg("refresh").arg("-y")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
|
||||
//Python
|
||||
cprintln!("<bold><rev><red>Updating Python user installation via pip-review</red></rev></bold>");
|
||||
let path = Path::new(&pip_review_bin);
|
||||
if path.exists(){
|
||||
let mut cmd =
|
||||
Command::new(&pip_review_bin)
|
||||
.arg("--auto").arg("--local").arg("--user")
|
||||
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
|
||||
.spawn().unwrap();
|
||||
let _output = cmd.wait();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue