This commit is contained in:
parent
56a59a959c
commit
216f6dcb9b
1 changed files with 15 additions and 7 deletions
|
|
@ -39,8 +39,22 @@ public class AptGet {
|
|||
private static Timer packageTimer = new Timer(1000*60*5); // 5min timer
|
||||
private static HashMap<String, Package> packages = new HashMap<>();
|
||||
|
||||
public static void install(String pkg) {
|
||||
update();
|
||||
OSAbstractionLayer.runCommand("apt-get -y install " + pkg);
|
||||
packageTimer.reset();
|
||||
}
|
||||
|
||||
public static synchronized void update(){
|
||||
public static void upgrade(){
|
||||
update();
|
||||
OSAbstractionLayer.runCommand("apt-get -y " +
|
||||
// Dont display configuration conflicts
|
||||
"-o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" " +
|
||||
"upgrade");
|
||||
packageTimer.reset();
|
||||
}
|
||||
|
||||
public static void update(){
|
||||
// Only run every 5 min
|
||||
if(updateTimer.hasTimedOut()){
|
||||
OSAbstractionLayer.runCommand("apt-get update");
|
||||
|
|
@ -48,12 +62,6 @@ public class AptGet {
|
|||
}
|
||||
}
|
||||
|
||||
public static void install(String pkg) {
|
||||
update();
|
||||
OSAbstractionLayer.runCommand("apt-get install " + pkg);
|
||||
packageTimer.reset();
|
||||
}
|
||||
|
||||
public static void purge(String pkg) {
|
||||
OSAbstractionLayer.runCommand("apt-get --purge remove " + pkg);
|
||||
packageTimer.reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue