File: lowmem.postinst

package info (click to toggle)
lowmem 1.51
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 112 kB
  • sloc: ansic: 113; sh: 49; makefile: 12
file content (24 lines) | stat: -rwxr-xr-x 714 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
if [ ! -e /var/lib/lowmem ]; then
	exit 0
fi

for log in syslog messages; do
	logpath=/var/log/$log
	[ -s $logpath ] && echo "Log file truncated to save memory." > $logpath

	# using % in place of / allows us to look for a pattern containing /'s
	# the [t] stops sed's ps listing from matching it's own pattern
	pid=$(ps ax | sed -n 's%^[ ]*\([0-9]*\).*[t]ail -f '$logpath'.*%\1%p')
	if [ -n "$pid" ]; then
		kill $pid || true
	fi
done

rm -rf /usr/share/keymaps \
	/usr/share/console-setup-mini/*.ekmap* \
	/usr/share/console-setup-mini/*.ekbd* \
	/usr/share/console-setup/*.ekmap* \
	/usr/share/console-setup/*.ekbd* \
	/usr/share/console-setup/keyboard-configuration.config \
	/usr/share/consolefonts