Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 655234

Summary: sys-apps/mlocate-0.26-r2: add an optional dependency on sys-power/powermgmt-base
Product: Gentoo Linux Reporter: selurvedu <selurvedu>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description selurvedu 2018-05-07 23:57:25 UTC
```
$ cat /etc/cron.daily/mlocate
#! /bin/sh
set -e

# check if we run on battery and if so then don't run
if which on_ac_power >/dev/null 2>&1; then
	ON_BATTERY=0
	on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
	if [ "${ON_BATTERY}" -eq 1 ]; then
			exit 0
	fi
fi

...
```

My system did not have the on_ac_power script installed, so the above cron script was unable to detect whether the laptop is running on battery (`which` never succeeded, so no checks were performed).

I think that the sys-apps/mlocate ebuild should either write a post-install message about an optional dependency to let the user decide whether he needs that kind of check, or there should be a corresponding USE flag.