Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ On Windows, a flag marked "Unix" prints a warning. The run goes on without it, e
| `--ascii` | ASCII glyphs only | all |
| `-nc`, `--keep-cache` | Skip user cache cleaning (Windows: `%TEMP%`) and, on Linux, the warning about space still held by deleted files that a program keeps open | all |
| `-nt`, `--keep-trash` | Skip trash cleaning (Windows: Recycle Bin) | all |
| `--deep-clean` | Also clean the journal, old kernels, leftover configs, snap revisions, crash dumps, npm and Go caches and unused docker and podman data, asking for each | Unix |
| `--soft-clean` | Skip the deep clean. Without this flag, every run asks about each of these before removing it: journal, system logs, old kernels, leftover configs, snap revisions, crash dumps, npm and Go caches, unused docker and podman data, AI models unused for 30 days or more (Ollama, Hugging Face), Rust `target` directories | Unix |
| `--changed` | Show the last run's package changes | Unix |
| `--changelog PKG` | Show the upstream changelog of `PKG` | Unix |
| `--history` | Show the last runs | all |
Expand Down Expand Up @@ -204,7 +204,7 @@ Every variable, its default and the plugin API: [the documentation](doc/document

## Security

- `up` changes only what you ask for. Cleaning the cache, the Trash and `--deep-clean` ask before deleting anything.
- `up` changes only what you ask for. Cleaning the cache, the Trash and the deep clean ask before deleting anything. Under `-y` the deep clean never touches logs, models, build directories, stopped containers or volumes.
- On its own, `up` goes online only for `--weather`, `--self-update`, `--firmware`, `--refresh-mirrors` and one connectivity check in `--doctor`. All other traffic comes from your package managers.
- `up` runs with `sudo`, so keep the eMerger folder writable by you alone. If other users can write to it, `up` refuses to start.
- Your config, profiles, plugins and hooks follow the same rule: `up` skips any that another user could change.
Expand Down
2 changes: 1 addition & 1 deletion completions/_up
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ _up() {
'--keep-cache[skip cache cleaning and the deleted-but-open files warning]'
'-nt[no trash clean]'
'--keep-trash[no trash clean]'
'--deep-clean[clean journal, old kernels, containers]'
'--soft-clean[skip the deep clean]'
'-w[weather]'
'--weather[weather]'
'--changed[show package diff]'
Expand Down
2 changes: 1 addition & 1 deletion completions/up.bash
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _up_completion() {
--profile --list-profiles --only --except
--snapshot --rollback --refresh-mirrors --resume --reboot --reboot-exit
--download-only
-nl --no-logo -ni --no-info -nc --keep-cache -nt --keep-trash --deep-clean -w --weather
-nl --no-logo -ni --no-info -nc --keep-cache -nt --keep-trash --soft-clean -w --weather
--changed --changelog --history --metrics -err --errors
-up --self-update -au --auto-update -rc --rebuild-cache"
_up_reply compgen -W "$opts" -- "$cur"
Expand Down
2 changes: 1 addition & 1 deletion completions/up.fish
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ complete -c up -l rollback -d 'revert last snapshot'
complete -c up -l reboot-exit -d 'exit 4 if reboot required'
complete -c up -l download-only -d 'download, do not install'
complete -c up -l metrics -d 'export Prometheus textfile' -r
complete -c up -l deep-clean -d 'journal, old kernels, containers'
complete -c up -l soft-clean -d 'skip the deep clean'
complete -c up -l profile -d 'load profile' -xa '(__up_profiles)'
complete -c up -l list-profiles -d 'list profiles'
complete -c up -l snapshot -d 'pre-update snapshot'
Expand Down
Binary file modified doc/documentation.pdf
Binary file not shown.
64 changes: 46 additions & 18 deletions doc/documentation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ \section{Execution flow}\label{sec:flow}
\textit{clean}; serial for system managers, concurrent for safe
user-space ones when \texttt{-{}-parallel} is active.
\item Optionally clear user cache and trash (skippable with
\texttt{-nc} and \texttt{-nt}), then, with
\texttt{-{}-deep-clean}, the system leftovers and the container
data (Unix).
\texttt{-nc} and \texttt{-nt}), then, unless
\texttt{-{}-soft-clean}, the deep clean: system leftovers,
container data, unused AI models, Rust build directories (Unix).
\item Execute \texttt{post.d} hooks.
\item Snapshot the installed-packages list into \texttt{pkgs.after} and
compute \texttt{pkgs.diff}.
Expand Down Expand Up @@ -517,7 +517,7 @@ \subsection{All flags}
\texttt{-y}, \texttt{-{}-yes} & Assume yes on prompts & all \\
\texttt{-w}, \texttt{-{}-weather} & Show weather line via wttr.in & all \\
\texttt{-{}-ascii} & Force ASCII glyphs only & all \\
\texttt{-{}-deep-clean} & System leftovers (see \S\ref{sec:deepclean}) & Linux/macOS \\
\texttt{-{}-soft-clean} & Skip the deep clean (see \S\ref{sec:deepclean}) & Linux/macOS \\
\texttt{-nl}, \texttt{-{}-no-logo} & Hide logo & all \\
\texttt{-ni}, \texttt{-{}-no-info} & Hide system info line & all \\
\texttt{-nc}, \texttt{-{}-keep-cache} & Skip user cache cleaning and the warning about space held by deleted files still open & all \\
Expand Down Expand Up @@ -550,7 +550,7 @@ \subsection{All flags}
\texttt{-{}-rollback} print a warning and exit 0 without updating.
\texttt{-{}-firmware}, \texttt{-{}-no-firmware}, \texttt{-{}-snapshot},
\texttt{-{}-parallel}, \texttt{-{}-resume}, \texttt{-{}-download-only},
\texttt{-{}-deep-clean} and \texttt{-{}-refresh-mirrors} print a warning
\texttt{-{}-soft-clean} and \texttt{-{}-refresh-mirrors} print a warning
and the run goes on without them.

\subsection{Combining flags}
Expand Down Expand Up @@ -733,15 +733,20 @@ \subsection{Cache cleaning}
exits, so nothing is deleted; restart the program named.

\subsection{Deep clean}\label{sec:deepclean}
\texttt{up -{}-deep-clean} goes after system-level leftovers a normal run
doesn't touch, asking about each one and showing how much it would free.
Skip tasks with \verb|DEEP_CLEAN_SKIP="docker,journal"|.
Every run goes after system-level leftovers, asking about each one and
showing how much it would free; answer no to keep it. \texttt{-{}-soft-clean}
skips the whole deep clean; a list of task keys such as
\verb|DEEP_CLEAN_SKIP="docker,journal"| skips single tasks. Under
\texttt{-y} the logs, models, build directories, stopped containers and
volumes are never touched. Logs are emptied once; no size cap or other
system setting is changed.

\begin{longtable}{@{}p{0.22\linewidth} p{0.70\linewidth}@{}}
\toprule
\textbf{Key} & \textbf{Task} \\
\midrule \endhead
\texttt{journal} & \verb|journalctl --vacuum-size=$JOURNAL_MAX_SIZE| (200M), only if bigger \\
\texttt{journal} & \verb|journalctl --rotate --vacuum-time=1s|: every archived entry, never under \texttt{-y} \\
\texttt{syslog} & \texttt{truncate -s 0} the non-empty \verb|/var/log/syslog|, \texttt{messages}, \texttt{user.log} and their \texttt{.1}, naming the program that wrote over half of the last MiB of the biggest; never under \texttt{-y} \\
\texttt{kernels} & dnf: keep the 2 newest kernels; zypper: \texttt{purge-kernels} \\
\texttt{residual} & \texttt{dpkg -{}-purge} config files of removed packages \\
\texttt{snap} & remove disabled snap revisions \\
Expand All @@ -750,7 +755,7 @@ \subsection{Deep clean}\label{sec:deepclean}
\bottomrule
\end{longtable}

Two more sections follow, with the same prompts and skip keys.
Three more sections follow, with the same prompts and skip keys.

\begin{longtable}{@{}p{0.22\linewidth} p{0.70\linewidth}@{}}
\toprule
Expand All @@ -767,6 +772,24 @@ \subsection{Deep clean}\label{sec:deepclean}
(\verb|~/.docker/desktop|, on macOS
\verb|~/Library/Containers/com.docker.docker|) is shown from 1M,
since its disk image shrinks only from Docker Desktop \\
\texttt{ollama} & AI models section: Ollama models (stores in
\verb|$OLLAMA_MODELS|, \verb|~/.ollama/models|,
\verb|/usr/share/ollama/.ollama/models|, \verb|/var/lib/ollama|)
whose weights were not read for \texttt{AI\_UNUSED\_DAYS} (30), as a
menu, biggest first. Removed with \texttt{ollama rm} when the server
answers, else by deleting the manifest and the blobs no other
manifest lists (through \texttt{sudo} when the store is not
writable). Also unfinished downloads (\texttt{-partial} blobs
untouched for a day). Models are never offered under \texttt{-y} \\
\texttt{huggingface} & Hugging Face hub repos (\verb|$HF_HUB_CACHE|, else
\verb|$HF_HOME/hub|, else \verb|~/.cache/huggingface/hub|) whose
newest blob was not read for \texttt{AI\_UNUSED\_DAYS}, as a menu \\
\texttt{cargo} & Build artifacts section: cargo \texttt{target}
directories (holding \texttt{CACHEDIR.TAG}, beside a
\texttt{Cargo.toml}) of 1M or more under \texttt{BUILD\_SCAN\_ROOTS}
(\verb|$HOME|, \texttt{:}-separated), hidden directories and
\texttt{node\_modules} not searched, as a menu with the days since
the last build. Never offered under \texttt{-y} \\
\bottomrule
\end{longtable}

Expand Down Expand Up @@ -985,7 +1008,7 @@ \subsection{Every supported variable}
\texttt{-{}-ascii} & \texttt{ARG\_ASCII} & \texttt{Ascii} \\
\texttt{-nc} & \texttt{ARG\_KEEP\_CACHE} & \texttt{KeepCache} \\
\texttt{-nt} & \texttt{ARG\_KEEP\_TRASH} & \texttt{KeepTrash} \\
\texttt{-{}-deep-clean} & \texttt{ARG\_DEEP\_CLEAN} & \texttt{DeepClean} \\
\texttt{-{}-soft-clean} & \texttt{ARG\_SOFT\_CLEAN} & \texttt{SoftClean} \\
\texttt{-{}-changed} & \texttt{ARG\_CHANGED} & \texttt{Changed} \\
\texttt{-{}-changelog PKG} & \texttt{ARG\_CHANGELOG} & \texttt{Changelog} \\
\texttt{-{}-history} & \texttt{ARG\_HISTORY} & \texttt{History} \\
Expand All @@ -1011,7 +1034,8 @@ \subsection{Every supported variable}
\texttt{QUIET\_HOURS} & (unset) & Unix & \texttt{"HH:MM-HH:MM"}, may wrap past midnight: a run with \texttt{-y} inside it exits 0 \\
\texttt{CACHE\_EXCLUDE} & (empty) & Unix & \verb|~/.cache| entries never offered (names or globs) \\
\texttt{CACHE\_MENU\_ROWS} & 12 & Unix & rows in the cache menu before ``others'' \\
\texttt{JOURNAL\_MAX\_SIZE} & 200M & Unix & journal target for \texttt{-{}-deep-clean} \\
\texttt{AI\_UNUSED\_DAYS} & 30 & Unix & days without a read before an AI model is offered \\
\texttt{BUILD\_SCAN\_ROOTS} & \verb|$HOME| & Unix & where Rust target directories are searched \\
\texttt{DEEP\_CLEAN\_SKIP} & (empty) & Unix & deep-clean tasks to skip (\S\ref{sec:deepclean}) \\
\texttt{RPI\_ABORT\_ON\_UNDERVOLTAGE} & 0 & Unix & abort even with \texttt{-y} on Pi under-voltage \\
\texttt{RPI\_TEMP\_WARN} & 80 & Unix & Pi SoC temperature warning ($^\circ$C) \\
Expand Down Expand Up @@ -1507,10 +1531,12 @@ \section{Security model}\label{sec:security}
(\texttt{-{}-refresh-mirrors}), a snapshot (\texttt{-{}-snapshot}),
the \texttt{-{}-metrics} file, and deletions inside
\verb|~/.cache| and the Trash when cleaning.
\texttt{-{}-deep-clean} also deletes journal entries, old kernels,
leftover configs, snap revisions, crash dumps
The deep clean (unless \texttt{-{}-soft-clean}) also deletes
journal entries, system log contents, old kernels, leftover
configs, snap revisions, crash dumps
(\verb|/var/lib/systemd/coredump|), unused containers, images,
build cache and volumes, after asking for each.
build cache and volumes, AI models and Rust target directories,
after asking for each.
\item On Windows, UAC elevation happens only for the managers that need
admin. They run in an elevated child that loads no config, profile
or hook. That child runs the code of the checkout: clone it into a
Expand Down Expand Up @@ -1840,8 +1866,10 @@ \subsection{Bash library modules (\texttt{src/lib/})}
\texttt{clean/cache.sh} & Selective \texttt{\textasciitilde{}/.cache} menu \\
\texttt{clean/open.sh} & Report of deleted files still open \\
\texttt{clean/trash.sh} & Trash \\
\texttt{clean/deep.sh} & \texttt{-{}-deep-clean} tasks \\
\texttt{clean/containers.sh} & \texttt{-{}-deep-clean} Containers section \\
\texttt{clean/deep.sh} & deep clean tasks and shared helpers \\
\texttt{clean/containers.sh} & deep clean, Containers section \\
\texttt{clean/ai.sh} & deep clean, AI models section \\
\texttt{clean/builds.sh} & deep clean, Build artifacts section \\
\bottomrule
\end{longtable}
\end{center}
Expand Down Expand Up @@ -1898,7 +1926,7 @@ \subsection{Running tests}

Each \texttt{tests/<feature>.bats} covers one feature: \texttt{cli.bats}
the flags, \texttt{lock.bats} the run lock, \texttt{clean.bats} the cache,
trash and \texttt{-{}-deep-clean}, and so on.
trash and the deep clean, and so on.
\texttt{tests/test\_helper.bash} holds the shared fixture (temp
\texttt{HOME}, stubs on \texttt{PATH}, \texttt{lib} to source modules). The
\texttt{tests/ps\_*.bats} files cover the PowerShell half and skip without
Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ if [[ ! -f "$CONFIG_DIR/config.sh" ]]; then
# ARG_DEV=1 # always include dev toolchains
# ARG_WEATHER=1 # always show weather
# ARG_KEEP_TRASH=1 # never touch trash
# ARG_SOFT_CLEAN=1 # skip the deep clean
# DISK_MIN_FREE_MB=2048
# QUIET_HOURS="23:00-07:00" # skip when timer fires inside this window
EOF
Expand Down
40 changes: 25 additions & 15 deletions man/up.1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ the Windows build are in the eMerger manual, \fIdoc/documentation.pdf\fR.
.PP
eMerger detects the package managers installed on the host and runs each of
them in turn to refresh, upgrade and clean the system, then prints a summary.
It can also clean the user cache, the trash and, with \fB\-\-deep\-clean\fR,
system leftovers and unused container data. Every cleaning step asks first unless \fB\-y\fR is given.
It also cleans the user cache, the trash and, unless \fB\-\-soft\-clean\fR
is given, system leftovers, unused container data, unused AI models and Rust
build directories. Every cleaning step asks first unless \fB\-y\fR is given.
.PP
Short flags from the set \fBh V n v q y w\fR can be bundled: \fB\-nv\fR is
\fB\-n \-v\fR. Other short flags (\fB\-nl\fR, \fB\-qq\fR, \fB\-up\fR and so on)
Expand Down Expand Up @@ -137,14 +138,19 @@ Skip user cache cleaning and the warning about space held by deleted files still
.B \-nt, \-\-keep\-trash
Skip trash cleaning.
.TP
.B \-\-deep\-clean
Also clean system leftovers, asking for each: journal above
\fBJOURNAL_MAX_SIZE\fR, old kernels (dnf, zypper), config files of removed
packages, disabled snap revisions, crash dumps, npm and Go caches. Then the
Containers section: stopped containers, unused images, build cache and
unused volumes of every local docker context (remote ones skipped) and of
podman (stopped containers and volumes never under \fB\-y\fR), and the size
of Docker Desktop's data.
.B \-\-soft\-clean
Skip the deep clean. Without it a run offers, asking for each: emptying the
systemd journal and the plain-text system logs (syslog, messages, user.log,
naming the program writing most of them), old kernels (dnf, zypper), config
files of removed packages, disabled snap revisions, crash dumps, npm and Go
caches. Then the Containers section: stopped containers, unused images,
build cache and unused volumes of every local docker context (remote ones
skipped) and of podman, and the size of Docker Desktop's data. Then the AI
models section: Ollama and Hugging Face models whose weights were not read
for \fBAI_UNUSED_DAYS\fR, and unfinished Ollama downloads. Then the Build
artifacts section: the cargo \fBtarget\fR directories under
\fBBUILD_SCAN_ROOTS\fR. Under \fB\-y\fR the logs, models, build
directories, stopped containers and volumes are never touched.
.SH INSPECTION
.TP
.B \-\-changed
Expand Down Expand Up @@ -212,12 +218,16 @@ Seconds before the first retry; the n-th retry waits n times as long (3).
.B CACHE_MENU_ROWS
Cache entries listed before the rest is grouped as "others" (12).
.TP
.B JOURNAL_MAX_SIZE
Journal size \fB\-\-deep\-clean\fR vacuums down to (200M).
.B AI_UNUSED_DAYS
Days without a read after which the deep clean offers an AI model (30).
.TP
.B BUILD_SCAN_ROOTS
Directories, separated by ":", searched for Rust target directories
(\fB$HOME\fR). Hidden directories and node_modules are not searched.
.TP
.B DEEP_CLEAN_SKIP
Deep-clean tasks to skip: journal, kernels, residual, snap, docker, podman,
coredumps, npm, go.
Deep-clean tasks to skip: journal, syslog, kernels, residual, snap,
coredumps, npm, go, docker, podman, ollama, huggingface, cargo.
.TP
.B RPI_ABORT_ON_UNDERVOLTAGE
On a Raspberry Pi, abort even with \-y when the board is under-voltage (0).
Expand Down Expand Up @@ -290,7 +300,7 @@ ARG_WEATHER \-w
ARG_ASCII \-\-ascii
ARG_KEEP_CACHE \-nc
ARG_KEEP_TRASH \-nt
ARG_DEEP_CLEAN \-\-deep\-clean
ARG_SOFT_CLEAN \-\-soft\-clean
.ft
.fi
.PP
Expand Down
1 change: 1 addition & 0 deletions share/profiles/safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ARG_KEEP_CACHE=1
ARG_KEEP_TRASH=1
ARG_NO_FIRMWARE=1
ARG_EXCEPT="${ARG_EXCEPT:+$ARG_EXCEPT,}flatpak,snap"
ARG_SOFT_CLEAN=1
1 change: 1 addition & 0 deletions share/profiles/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ ARG_NO_INFO=1
ARG_KEEP_CACHE=1
ARG_KEEP_TRASH=1
ARG_NO_FIRMWARE=1
ARG_SOFT_CLEAN=1
1 change: 1 addition & 0 deletions share/profiles/work.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ARG_NO_FIRMWARE=1
ARG_EXCEPT="${ARG_EXCEPT:+$ARG_EXCEPT,}yay,paru"
ARG_KEEP_CACHE=1
ARG_KEEP_TRASH=1
ARG_SOFT_CLEAN=1
2 changes: 1 addition & 1 deletion src/emerger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ main() {

if (( ! ARG_KEEP_CACHE )); then clean_cache; clean_open_deleted; fi
(( ARG_KEEP_TRASH )) || clean_trash
if (( ARG_DEEP_CLEAN )); then clean_deep; clean_containers; fi
if (( ! ARG_SOFT_CLEAN )); then clean_deep; clean_containers; clean_ai; clean_builds; fi

hooks_run post

Expand Down
4 changes: 2 additions & 2 deletions src/lib/args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

ARG_HELP=0; ARG_VERSION=0
ARG_SELF_UPDATE=0; ARG_AUTO_UPDATE=0; ARG_ERRORS=0; ARG_REBUILD_CACHE=0; ARG_HISTORY=0
ARG_NO_LOGO=0; ARG_NO_INFO=0; ARG_KEEP_CACHE=0; ARG_KEEP_TRASH=0; ARG_DEEP_CLEAN=0
ARG_NO_LOGO=0; ARG_NO_INFO=0; ARG_KEEP_CACHE=0; ARG_KEEP_TRASH=0; ARG_SOFT_CLEAN=0
ARG_WEATHER=0
ARG_FIRMWARE=0; ARG_NO_FIRMWARE=0; ARG_DEV=0; ARG_SECURITY=0
ARG_YES=0; ARG_PARALLEL=0
Expand Down Expand Up @@ -117,7 +117,7 @@ args_parse() {
-ni|--no-info) ARG_NO_INFO=1 ;;
-nc|--keep-cache) ARG_KEEP_CACHE=1 ;;
-nt|--keep-trash) ARG_KEEP_TRASH=1 ;;
--deep-clean) ARG_DEEP_CLEAN=1 ;;
--soft-clean) ARG_SOFT_CLEAN=1 ;;
-w|--weather) ARG_WEATHER=1 ;;

-q|--quiet) QUIET_LEVEL=$(( QUIET_LEVEL + 1 )) ;;
Expand Down
Loading
Loading