Moving things, and allowing for retrieving installed packages
This commit is contained in:
parent
9446b5d084
commit
7ead5eabb0
5 changed files with 104 additions and 11 deletions
36
package.list
36
package.list
|
@ -1,15 +1,35 @@
|
|||
nano
|
||||
audacity
|
||||
clang-18
|
||||
clangd-18
|
||||
cmake
|
||||
containerd.io
|
||||
dconf-editor
|
||||
dotnet-sdk-8.0
|
||||
git
|
||||
kdenlive
|
||||
kopia-ui
|
||||
krita
|
||||
lmms
|
||||
micro
|
||||
npm
|
||||
obs-studio
|
||||
pcscd
|
||||
php
|
||||
python3-pip
|
||||
qdirstat
|
||||
qemu-block-extra
|
||||
remmina
|
||||
steam-installer
|
||||
vagrant
|
||||
veracrypt
|
||||
virt-manager
|
||||
virtualbox
|
||||
wine
|
||||
wine64
|
||||
xppenlinux
|
||||
build-essential
|
||||
git
|
||||
remmina
|
||||
mesa-vulkan-drivers
|
||||
libglx-mesa0:i386
|
||||
mesa-vulkan-drivers:i386
|
||||
libgl1-mesa-dri:i386
|
||||
dconf-editor
|
||||
beefbuild
|
||||
audacity
|
||||
npm
|
||||
neofetch
|
||||
neofetch
|
||||
|
|
|
@ -5,8 +5,14 @@ using System.Diagnostics;
|
|||
|
||||
public class Helper
|
||||
{
|
||||
public static void RunCommand(String verb, String? arguments = null)
|
||||
public static void RunCommand(string verb, string? arguments = null)
|
||||
{
|
||||
/*
|
||||
#if DEBUG
|
||||
Console.WriteLine($"Run Command: {verb} {arguments}");
|
||||
return;
|
||||
#endif*/
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
info.FileName = verb;
|
||||
if(arguments != null)
|
||||
|
@ -20,4 +26,24 @@ public class Helper
|
|||
while (process.HasExited == false)
|
||||
continue;
|
||||
}
|
||||
|
||||
public static string RunCommandAndGetOutput(string verb, string? arguments = null)
|
||||
{
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
info.FileName = verb;
|
||||
if(arguments != null)
|
||||
info.Arguments = arguments;
|
||||
info.UseShellExecute = false;
|
||||
info.RedirectStandardOutput = true;
|
||||
info.CreateNoWindow = true;
|
||||
|
||||
Process process = new Process();
|
||||
process.StartInfo = info;
|
||||
process.Start();
|
||||
|
||||
while (process.HasExited == false)
|
||||
continue;
|
||||
|
||||
return process.StandardOutput.ReadToEnd();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Setup_Workspace;
|
||||
using Setup_Workspace.Tasks;
|
||||
|
||||
Console.WriteLine("""
|
||||
WSS - Workspace Setup Script version 1.0
|
||||
|
@ -16,7 +17,8 @@ switch (input)
|
|||
{
|
||||
case "full-install":
|
||||
new Runner().Then(
|
||||
new PackageInstaller()
|
||||
new GetInstalledPackages()//,
|
||||
//new PackageInstaller()
|
||||
).Run();
|
||||
break;
|
||||
|
||||
|
|
45
src/Tasks/GetInstalledPackages.cs
Normal file
45
src/Tasks/GetInstalledPackages.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
namespace Setup_Workspace.Tasks;
|
||||
|
||||
public class GetInstalledPackages : Doable
|
||||
{
|
||||
|
||||
/*
|
||||
The goal here is to retrieve all of the packages,
|
||||
that have been installed after the initial install
|
||||
|
||||
- Get the initially installed programs
|
||||
/var/log/installer/initial-status.gz //For linux mint
|
||||
Check wether a line has "Package: " and remove it
|
||||
|
||||
- Get the currently installed programs
|
||||
apt-mark showmanual
|
||||
*/
|
||||
public override bool Do()
|
||||
{
|
||||
Helper.RunCommand("gzip", "/var/log/installer/initial-status.gz -d -k -f");
|
||||
|
||||
var dPackages = File.ReadAllText("/var/log/installer/initial-status");
|
||||
HashSet<string> dPackageList = new HashSet<string>();
|
||||
foreach (var line in dPackages.Split('\n'))
|
||||
if(line.StartsWith("Package: "))
|
||||
dPackageList.Add(line.Replace("Package: ", ""));
|
||||
|
||||
var installPackages = Helper.RunCommandAndGetOutput("apt-mark", "showmanual");
|
||||
HashSet<string> installedManualPackages = new HashSet<string>();
|
||||
foreach (var line in installPackages.Split('\n'))
|
||||
if(line != "")
|
||||
installedManualPackages.Add(line);
|
||||
|
||||
List<string> toInstall = new List<string>();
|
||||
foreach (var item in installedManualPackages)
|
||||
if(!dPackageList.Contains(item))
|
||||
toInstall.Add(item);
|
||||
|
||||
String toWrite = "";
|
||||
foreach(var item in toInstall)
|
||||
toWrite += item + "\n";
|
||||
File.WriteAllText("package.list.export", toWrite);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace Setup_Workspace;
|
||||
namespace Setup_Workspace.Tasks;
|
||||
|
||||
public class PackageInstaller : Doable
|
||||
{
|
Loading…
Add table
Add a link
Reference in a new issue