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:
|
cleanBrowser = name: browser: home: homeBackup:
|
||||||
let
|
let
|
||||||
backupFile = "${homeBackup}.tar.lzma";
|
backupFile = "${homeBackup}.tar.lzma";
|
||||||
|
@ -45,7 +48,7 @@ let
|
||||||
in pkgs.writeShellScriptBin "${name}-clean" # sh
|
in pkgs.writeShellScriptBin "${name}-clean" # sh
|
||||||
''
|
''
|
||||||
sudo killall -9 -u ${name}
|
sudo killall -9 -u ${name}
|
||||||
sudo rm ${lockFile}
|
sudo rm -f ${lockFile}
|
||||||
sudo rm -rf ${home}
|
sudo rm -rf ${home}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -129,6 +132,8 @@ let
|
||||||
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
||||||
filteredConfigs;
|
filteredConfigs;
|
||||||
|
|
||||||
|
allKillScripts = mapAttrsToList (name: _: killBrowser name) cfg.configList;
|
||||||
|
|
||||||
# browser chooser
|
# browser chooser
|
||||||
# ---------------
|
# ---------------
|
||||||
browserSelect = pkgs.writeScriptBin "browser-select" ''
|
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/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/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 -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));
|
'') values.sudoUsers));
|
||||||
in lib.concatStringsSep "\n" extraRules;
|
in lib.concatStringsSep "\n" extraRules;
|
||||||
|
|
||||||
|
@ -232,7 +237,7 @@ in {
|
||||||
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
|
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
|
||||||
++ browserExecutableList
|
++ browserExecutableList
|
||||||
++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts
|
++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts
|
||||||
++ allCleanScripts;
|
++ allCleanScripts ++ allKillScripts;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue