Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

#!/bin/sh
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
for i in ac97-powersave.conf auto-hibernate.conf bluetooth.conf \
configuration-file-control.conf cpufreq.conf dpms-standby.conf \
ethernet.conf hal-polling.conf intel-sata-powermgmt.conf \
lcd-brightness.conf sched-mc-power-savings.conf \
start-stop-programs.conf terminal-blanking.conf video-out.conf \
wireless-ipw-power.conf wireless-iwl-power.conf ; \
do config etc/laptop-mode/conf.d/$i.new ; \
done
config etc/laptop-mode/laptop-mode.conf.new
config etc/laptop-mode/lm-profiler.conf.new
# We want to run laptop-mode-tools on boot
exist_local=$(grep "/etc/rc.d/rc.laptop-mode" etc/rc.d/rc.local)
if [[ "${exist_local}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local
# Run laptop-mode-tools:
if [ -x /etc/rc.d/rc.laptop-mode ]; then
/etc/rc.d/rc.laptop-mode start
fi
EOF
fi
# If rc.local_shutdown doesn't exist (like on a stock Slackware 12.1 install), create it
if [ ! -e etc/rc.d/rc.local_shutdown ]; then
echo "#!/bin/sh" > etc/rc.d/rc.local_shutdown
echo "" >> etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
fi
# We want to stop laptop-mode-tools on shutdown
exist_local_shutdown=$(grep "/etc/rc.d/rc.laptop-mode" etc/rc.d/rc.local_shutdown)
if [[ "${exist_local_shutdown}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local_shutdown
# Stop laptop-mode-tools:
if [ -x /etc/rc.d/rc.laptop-mode ]; then
/etc/rc.d/rc.laptop-mode stop
fi
EOF
fi