Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
laptop-mode-tools
install_sh.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File install_sh.diff of Package laptop-mode-tools
Index: b/install.sh =================================================================== --- a/install.sh +++ b/install.sh @@ -3,8 +3,9 @@ # If your distribution puts this in other locations, please adjust the values of # these variables before installing! # INIT_D=/etc/init.d -MAN_D=/usr/local/man/man8 +MAN_D=${MAN_D:-usr/local/man/man8} +if [ -z "$DESTDIR" ] ; then if [ "$INIT_D" = "" ] ; then # Try non-link directories first, then try links. This helps if one of # the locations is linked to another, which is the case on some distros. @@ -51,21 +52,25 @@ fi echo 'Stopping existing laptop mode service (if any).' $RCPROG $INITSCRIPT stop +fi -INSTALL="install -o root -g root" +INSTALL="${INSTALL:-install -o root -g root}" -mkdir -p /etc/laptop-mode /etc/laptop-mode/batt-start /etc/laptop-mode/batt-stop /etc/laptop-mode/lm-ac-start /etc/laptop-mode/lm-ac-stop /etc/laptop-mode/nolm-ac-start /etc/laptop-mode/nolm-ac-stop /usr/share/laptop-mode-tools/modules /etc/laptop-mode/conf.d /etc/laptop-mode/modules +pushd $DESTDIR/ +mkdir -p etc/laptop-mode etc/laptop-mode/batt-start etc/laptop-mode/batt-stop etc/laptop-mode/lm-ac-start etc/laptop-mode/lm-ac-stop etc/laptop-mode/nolm-ac-start etc/laptop-mode/nolm-ac-stop usr/share/laptop-mode-tools/modules etc/laptop-mode/conf.d etc/laptop-mode/modules +popd ALREADY_EXISTED=0 if [ -f /etc/laptop-mode/laptop-mode.conf ] ; then echo "Not reinstalling configuration file: /etc/laptop-mode/laptop-mode.conf exists." ALREADY_EXISTED=1 -elif ( ! $INSTALL -m 644 etc/laptop-mode/laptop-mode.conf /etc/laptop-mode ) ; then +elif ( ! $INSTALL -m 644 etc/laptop-mode/laptop-mode.conf "$DESTDIR"/etc/laptop-mode ) ; then echo "$0: Failed to install configuration file in /etc/laptop-mode/laptop-mode.conf. Installation failed." exit 12 fi +if [ -z "$DESTDIR" ] ; then if [ -f /etc/default/laptop-mode -a "$ALREADY_EXISTED" -eq 0 ] ; then echo "Found old configuration file in /etc/default/laptop-mode. Moving to the new location." if ( ! mv /etc/default/laptop-mode /etc/laptop-mode/laptop-mode.conf ) ; then @@ -80,11 +85,12 @@ if [ -f /etc/sysconfig/laptop-mode -a "$ exit 21 fi fi +fi for CONF in etc/laptop-mode/conf.d/* ; do if [ -f /"$CONF" ] ; then echo "Not reinstalling configuration file /$CONF." - elif ( ! $INSTALL -m 600 "$CONF" /"$CONF" ) ; then + elif ( ! $INSTALL -m 600 "$CONF" "$DESTDIR"/"$CONF" ) ; then echo "$0: Failed to install configuration file /$CONF. Installation failed." exit 12 fi @@ -93,48 +99,51 @@ done if [ -f /etc/laptop-mode/lm-profiler.conf ] ; then echo "Configuration file /etc/laptop-mode/lm-profiler.conf already exists." -elif ( ! $INSTALL -m 600 etc/laptop-mode/lm-profiler.conf /etc/laptop-mode ) ; then +elif ( ! $INSTALL -m 600 etc/laptop-mode/lm-profiler.conf "$DESTDIR"/etc/laptop-mode ) ; then echo "$0: Failed to install configuration file in /etc/laptop-mode/lm-profiler.conf. Installation failed." exit 12 fi -if ( ! $INSTALL -m 700 usr/sbin/laptop_mode /usr/sbin ) ; then +if ( ! $INSTALL -m 700 -D usr/sbin/laptop_mode "$DESTDIR"/usr/sbin/laptop_mode ) ; then echo "$0: Failed to install /usr/sbin/laptop_mode. Installation failed." exit 11 fi -if ( ! $INSTALL -m 700 usr/sbin/lm-syslog-setup /usr/sbin ) ; then +if ( ! $INSTALL -m 700 usr/sbin/lm-syslog-setup "$DESTDIR"/usr/sbin ) ; then echo "$0: Failed to install /usr/sbin/lm-syslog-setup. installation failed." exit 25 fi -if ( ! $INSTALL -m 700 usr/sbin/lm-profiler /usr/sbin ) ; then +if ( ! $INSTALL -m 700 usr/sbin/lm-profiler "$DESTDIR"/usr/sbin ) ; then echo "$0: Failed to install /usr/sbin/lm-profiler. Installation failed." exit 11 fi +if [ -z "$DESTDIR" ]; then if [ -f /usr/share/laptop-mode-tools/modules/core ] ; then if ( ! rm /usr/share/laptop-mode-tools/modules/core ) ; then echo "$0: Failed to install modules into /usr/share/laptop-mode-tools/modules. Installation failed." exit 35 fi fi +fi -if ( ! $INSTALL -m 700 usr/share/laptop-mode-tools/modules/* /usr/share/laptop-mode-tools/modules ) ; then +if ( ! $INSTALL -m 700 usr/share/laptop-mode-tools/modules/* "$DESTDIR"/usr/share/laptop-mode-tools/modules ) ; then echo "$0: Failed to install modules into /usr/share/laptop-mode-tools/modules. Installation failed." exit 26 fi -if ( ! mkdir -p $MAN_D ) ; then +if ( ! mkdir -p $DESTDIR/$MAN_D ) ; then echo "$0: Could not create directory $MAN_D. Installation failed." exit 22 fi -if ( ! cp man/* $MAN_D ) ; then +if ( ! cp man/* $DESTDIR/$MAN_D ) ; then echo "$0: Could not copy manual pages to $MAN_D. Installation failed." exit 23 fi +if [ -z "$DESTDIR" ]; then ACPI_DONE=0 if [ ! -d /proc/pmu -a -d /etc/acpi ] ; then mkdir -p /etc/acpi/actions @@ -208,9 +217,10 @@ if [ $APM_DONE -eq 0 -a $ACPI_DONE -eq 0 echo "ACPI/APM/PMU support was not found. Laptop mode will not start automatically." echo "Install either acpid, apmd, pbbuttonsd or pmud (depending on what your laptop supports) and reinstall." fi +fi -if [ -d $INIT_D ] ; then - if ( ! $INSTALL -m 700 etc/init.d/laptop-mode $INIT_D ) ; then +if [ -d $DESTDIR/$INIT_D ] ; then + if ( ! $INSTALL -m 700 etc/init.d/laptop-mode $DESTDIR/$INIT_D ) ; then echo "$0: failed to install init script in $INIT_D. Installation failed." exit 16 fi @@ -234,18 +244,20 @@ else echo "laptop mode at boot time." fi -if ( ! mkdir -p $MAN_D ) ; then +if ( ! mkdir -p $DESTDIR/$MAN_D ) ; then echo "$0: Could not create directory $MAN_D. Installation failed." exit 22 fi -if ( ! cp man/* $MAN_D ) ; then +if ( ! cp man/* $DESTDIR/$MAN_D ) ; then echo "$0: Could not copy manual pages to $MAN_D. Installation failed." exit 23 fi +if [ -z "$DESTDIR" ]; then if ( ! $RCPROG $INITSCRIPT start ) ; then echo "$0: Could not start laptop mode init script /etc/init.d/laptop-mode." exit 24 fi +fi echo "Installation complete."
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor