diff options
Diffstat (limited to 'libLumina/LuminaOS-FreeBSD.cpp')
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index 8b395026..d454ce22 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -142,17 +142,22 @@ void LOS::startMixerUtility(){ bool LOS::userHasShutdownAccess(){ //User needs to be a part of the operator group to be able to run the shutdown command QStringList groups = LUtils::getCmdOutput("id -Gn").join(" ").split(" "); - return groups.contains("operator"); //not implemented yet + bool ok = groups.contains("operator"); //not implemented yet + if(ok){ + //If a PC-BSD system, also disable the shutdown/restart options if the system is in the middle of upgrading + ok = (QProcess::execute("pgrep -F /tmp/.updateInProgress")!=0); //this is 0 if updating right now + } + return ok; } //System Shutdown void LOS::systemShutdown(){ //start poweroff sequence - QProcess::startDetached("shutdown -p now"); + QProcess::startDetached("shutdown -po now"); } //System Restart void LOS::systemRestart(){ //start reboot sequence - QProcess::startDetached("shutdown -r now"); + QProcess::startDetached("shutdown -ro now"); } //Battery Availability @@ -178,4 +183,16 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return LUtils::getCmdOutput("apm -t").join("").toInt(); } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + QStringList info = LUtils::getCmdOutput("md5 \""+filepaths.join("\" \"")+"\""); + for(int i=0; i<info.length(); i++){ + if( !info[i].contains(" = ") ){ info.removeAt(i); i--; } + else{ + //Strip out the extra information + info[i] = info[i].section(" = ",1,1); + } + } + return info; +} #endif |