mirror of
https://github.com/kiviktnm/decman.git
synced 2026-09-19 12:08:28 +00:00
Update README.md and the example
This commit is contained in:
@@ -81,7 +81,7 @@ from syncthing import Syncthing
|
|||||||
decman.modules += [Syncthing()]
|
decman.modules += [Syncthing()]
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run decman.
|
Then run decman. Note that terminal colors cannot be disabled for decman.
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> Decman runs as root. This means that your `source.py` will be executed as root as well.
|
> Decman runs as root. This means that your `source.py` will be executed as root as well.
|
||||||
|
|||||||
+12
-12
@@ -4,7 +4,7 @@
|
|||||||
import socket
|
import socket
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Remember: Do NOT use from imports for global variables
|
# Note: Do NOT use from imports for global variables
|
||||||
# BAD: from decman import packages/modules/etc
|
# BAD: from decman import packages/modules/etc
|
||||||
import decman
|
import decman
|
||||||
import decman.config
|
import decman.config
|
||||||
@@ -123,15 +123,15 @@ decman.modules += [my_own_mod]
|
|||||||
# Configuring the behavior of decman is also done here.
|
# Configuring the behavior of decman is also done here.
|
||||||
# These are the default values.
|
# These are the default values.
|
||||||
|
|
||||||
|
# Note: you probably don't want to change these 2 settings and instead you'll want to to use the --debug CLI option.
|
||||||
# Show debug output
|
# Show debug output
|
||||||
decman.config.debug_output = False
|
decman.config.debug_output = False
|
||||||
|
# Suppress output of some commands that you probably don't want to see.
|
||||||
|
decman.config.suppress_command_output = True
|
||||||
|
|
||||||
# Make output less verbose. Summaries are still printed.
|
# Make output less verbose. Summaries are still printed.
|
||||||
decman.config.quiet_output = False
|
decman.config.quiet_output = False
|
||||||
|
|
||||||
# Suppress output of some commands that you probably don't want to see.
|
|
||||||
decman.config.suppress_command_output = True
|
|
||||||
|
|
||||||
# The user which builds aur and user packages.
|
# The user which builds aur and user packages.
|
||||||
# decman.config.makepkg_user = "nobody" # This was set in a previous example. Let's not override it.
|
# decman.config.makepkg_user = "nobody" # This was set in a previous example. Let's not override it.
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ class MyCommands(decman.config.Commands):
|
|||||||
return ["pacman", "-Qm", "--color=never"]
|
return ["pacman", "-Qm", "--color=never"]
|
||||||
|
|
||||||
def install_pkgs(self, pkgs: list[str]) -> list[str]:
|
def install_pkgs(self, pkgs: list[str]) -> list[str]:
|
||||||
return ["pacman", "-S", "--asexplicit"] + pkgs
|
return ["pacman", "-S", "--needed"] + pkgs
|
||||||
|
|
||||||
def install_files(self, pkg_files: list[str]) -> list[str]:
|
def install_files(self, pkg_files: list[str]) -> list[str]:
|
||||||
return ["pacman", "-U", "--asdeps"] + pkg_files
|
return ["pacman", "-U", "--asdeps"] + pkg_files
|
||||||
@@ -185,16 +185,16 @@ class MyCommands(decman.config.Commands):
|
|||||||
return ["pacman", "-Rs"] + pkgs
|
return ["pacman", "-Rs"] + pkgs
|
||||||
|
|
||||||
def enable_units(self, units: list[str]) -> list[str]:
|
def enable_units(self, units: list[str]) -> list[str]:
|
||||||
return ["systemctl", "enable", "--now", "--quiet"] + units
|
return ["systemctl", "enable"] + units
|
||||||
|
|
||||||
def disable_units(self, units: list[str]) -> list[str]:
|
def disable_units(self, units: list[str]) -> list[str]:
|
||||||
return ["systemctl", "disable", "--quiet"] + units
|
return ["systemctl", "disable"] + units
|
||||||
|
|
||||||
def enable_user_units(self, units: list[str]) -> list[str]:
|
def enable_user_units(self, units: list[str], user: str) -> list[str]:
|
||||||
return ["systemctl", "enable", "--now", "--quiet", "--user"] + units
|
return ["systemctl", "--user", "-M", f"{user}@", "enable"] + units
|
||||||
|
|
||||||
def disable_user_units(self, units: list[str]) -> list[str]:
|
def disable_user_units(self, units: list[str], user: str) -> list[str]:
|
||||||
return ["systemctl", "disable", "--quiet"] + units
|
return ["systemctl", "--user", "-M", f"{user}@", "disable"] + units
|
||||||
|
|
||||||
def compare_versions(self, installed_version: str,
|
def compare_versions(self, installed_version: str,
|
||||||
new_version: str) -> list[str]:
|
new_version: str) -> list[str]:
|
||||||
@@ -251,7 +251,7 @@ class PikaurWrapperCommands(decman.config.Commands):
|
|||||||
return ["pikaur", "-Qeq"]
|
return ["pikaur", "-Qeq"]
|
||||||
|
|
||||||
def install_pkgs(self, pkgs: list[str]) -> list[str]:
|
def install_pkgs(self, pkgs: list[str]) -> list[str]:
|
||||||
return ["pikaur", "-S", "--asexplicit"] + pkgs
|
return ["pikaur", "-S"] + pkgs
|
||||||
|
|
||||||
def upgrade(self) -> list[str]:
|
def upgrade(self) -> list[str]:
|
||||||
return ["pikaur", "-Syu"]
|
return ["pikaur", "-Syu"]
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ def main():
|
|||||||
# Override debug_output if cli option is used
|
# Override debug_output if cli option is used
|
||||||
if args.debug:
|
if args.debug:
|
||||||
conf.debug_output = True
|
conf.debug_output = True
|
||||||
|
conf.suppress_command_output = False
|
||||||
# When print cli option is used, show info output
|
# When print cli option is used, show info output
|
||||||
if args.print:
|
if args.print:
|
||||||
conf.quiet_output = False
|
conf.quiet_output = False
|
||||||
|
|||||||
Reference in New Issue
Block a user