browser: add kill commands
This commit is contained in:
parent
9e2fd423bd
commit
269b48b6d6
1 changed files with 8 additions and 3 deletions
|
@ -37,6 +37,9 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
killBrowser = name:
|
||||
pkgs.writeShellScriptBin "${name}-kill" "sudo killall -9 -u ${name}";
|
||||
|
||||
cleanBrowser = name: browser: home: homeBackup:
|
||||
let
|
||||
backupFile = "${homeBackup}.tar.lzma";
|
||||
|
@ -45,7 +48,7 @@ let
|
|||
in pkgs.writeShellScriptBin "${name}-clean" # sh
|
||||
''
|
||||
sudo killall -9 -u ${name}
|
||||
sudo rm ${lockFile}
|
||||
sudo rm -f ${lockFile}
|
||||
sudo rm -rf ${home}
|
||||
'';
|
||||
|
||||
|
@ -129,6 +132,8 @@ let
|
|||
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
||||
filteredConfigs;
|
||||
|
||||
allKillScripts = mapAttrsToList (name: _: killBrowser name) cfg.configList;
|
||||
|
||||
# browser chooser
|
||||
# ---------------
|
||||
browserSelect = pkgs.writeScriptBin "browser-select" ''
|
||||
|
@ -210,7 +215,7 @@ in {
|
|||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/chown -R ${values.user}\:users ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/killall -9 -u ${name}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -rf ${values.home}
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm ${values.home}-lock
|
||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -f ${values.home}-lock
|
||||
'') values.sudoUsers));
|
||||
in lib.concatStringsSep "\n" extraRules;
|
||||
|
||||
|
@ -232,7 +237,7 @@ in {
|
|||
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
|
||||
++ browserExecutableList
|
||||
++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts
|
||||
++ allCleanScripts;
|
||||
++ allCleanScripts ++ allKillScripts;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue