Debian Codegraph @

debian/lowmem.postinst

raw
1 #!/bin/sh
2 if [ ! -e /var/lib/lowmem ]; then
3 exit 0
4 fi
5
6 for log in syslog messages; do
7 logpath=/var/log/$log
8 [ -s $logpath ] && echo "Log file truncated to save memory." > $logpath
9
10 # using % in place of / allows us to look for a pattern containing /'s
11 # the [t] stops sed's ps listing from matching it's own pattern
12 pid=$(ps ax | sed -n 's%^[ ]*\([0-9]*\).*[t]ail -f '$logpath'.*%\1%p')
13 if [ -n "$pid" ]; then
14 kill $pid || true
15 fi
16 done
17
18 rm -rf /usr/share/keymaps \
19 /usr/share/console-setup-mini/*.ekmap* \
20 /usr/share/console-setup-mini/*.ekbd* \
21 /usr/share/console-setup/*.ekmap* \
22 /usr/share/console-setup/*.ekbd* \
23 /usr/share/console-setup/keyboard-configuration.config \
24 /usr/share/consolefonts