54 lines
1.5 KiB
Bash
Executable File
54 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# cleanfs - Clean file system
|
|
|
|
# Written by Gerard Beekmans <gerard@linuxfromscratch.org>
|
|
# Modified by Davide Madrisan <davide.madrisan@gmail.com>
|
|
|
|
. /etc/sysconfig/rc
|
|
. $rc_functions
|
|
|
|
echo -n "Removing lock files: "
|
|
find /var/run/ -type f -o -type s | xargs -n 1 rm -f
|
|
find /var/lock/ -type f -o -type s | xargs -n 1 rm -f
|
|
find /var/tmp/.*-lock -type f -o -type s 2>/dev/null | xargs -n 1 rm -f
|
|
evaluate_retval
|
|
echo
|
|
|
|
# remove files and directories located in /tmp at every boot
|
|
# (recommended by the FHS 2.3 specifications)
|
|
echo -n "Removing files and directories from /tmp: "
|
|
rm -fr /tmp/* 2>/dev/null
|
|
rm -f /tmp/.fam*
|
|
rm -f /tmp/.X*-lock
|
|
rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix
|
|
rm -rf /tmp/.wine-*
|
|
rm -f /var/log/kdm.log
|
|
evaluate_retval
|
|
echo
|
|
|
|
echo -n "Removing temporary files created by rpm: "
|
|
rm -f /var/lib/rpm/__db* >/dev/null 2>&1
|
|
evaluate_retval
|
|
echo
|
|
|
|
echo -n "Creating new /var/run/utmp: "
|
|
touch /var/run/utmp && chmod 644 /var/run/utmp
|
|
evaluate_retval
|
|
echo
|
|
|
|
# removing possible files /etc/nologin /fastboot /forcefsck
|
|
rm -f /etc/nologin /fastboot /forcefsck
|
|
|
|
# fix a KDE warning message to speed up applications startup
|
|
if [ -d /tmp/.ICE-unix ]; then
|
|
chown root:root /tmp/.ICE-unix
|
|
chmod 1777 /tmp/.ICE-unix
|
|
fi
|
|
|
|
# remove .ICEauthority in home directories to avoid permission problems at user login
|
|
for d in `getent passwd | cut -d: -f6`; do [ -e $d/.ICEauthority ] && rm -f $d/.ICEauthority; done
|
|
|
|
# remove apt cached packages
|
|
rm -f /var/cache/apt/archives/*.rpm
|
|
rm -f /var/cache/apt/archives/partial/*
|