~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/oss-preserve

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
### BEGIN INIT INFO
4
 
# Provides:          oss-preserve
5
 
# Required-Start:    $remote_fs
6
 
# Required-Stop:     $remote_fs
7
 
# Default-Start:     2 3 4 5
8
 
# Default-Stop:      0 1 6
9
 
### END INIT INFO
10
 
 
11
 
# $Id: init.d 2966 2006-08-15 05:11:48Z cph $
12
 
#
13
 
# Copyright (c) 2001 Hewlett-Packard Company
14
 
#
15
 
# This program is free software; you can redistribute it and/or modify
16
 
# it under the terms of the GNU General Public License as published by
17
 
# the Free Software Foundation; either version 2 of the License, or (at
18
 
# your option) any later version.
19
 
#
20
 
# This program is distributed in the hope that it will be useful, but
21
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
22
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
 
# General Public License for more details.
24
 
#
25
 
# You should have received a copy of the GNU General Public License
26
 
# along with this program; if not, write to the Free Software
27
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28
 
# USA.
29
 
 
30
 
set -e
31
 
 
32
 
OSSCTL="/usr/lib/oss-preserve/ossctl"
33
 
FIXED="/etc/default/oss-preserve"
34
 
PREVIOUS="/var/lib/oss-preserve/settings"
35
 
 
36
 
[ -x "${OSSCTL}" ] || exit 0
37
 
 
38
 
case "$1" in
39
 
start)
40
 
    SETTINGS=""
41
 
    if [ -s "${FIXED}" ]; then
42
 
        SETTINGS="${FIXED}"
43
 
    elif [ -s "${PREVIOUS}" ]; then
44
 
        SETTINGS="${PREVIOUS}"
45
 
    fi
46
 
    if [ -n "${SETTINGS}" ]; then
47
 
        echo -n "Restoring OSS mixer settings..."
48
 
        "${OSSCTL}" restore < "${SETTINGS}"
49
 
        echo "done."
50
 
    fi
51
 
    ;;
52
 
stop)
53
 
    echo -n "Saving OSS mixer settings..."
54
 
    "${OSSCTL}" save > "${PREVIOUS}"
55
 
    echo "done."
56
 
    ;;
57
 
restart|force-reload)
58
 
    $0 stop
59
 
    $0 start
60
 
    ;;
61
 
status)
62
 
    # http://refspecs.freestandards.org/LSB_2.1.0/LSB-generic/LSB-generic/iniscrptact.html
63
 
    # does not really specify an exit code:
64
 
    exit 4
65
 
    ;;
66
 
*)
67
 
    echo "Usage: $0 {start|stop|restart|force-reload}"
68
 
    exit 1
69
 
    ;;
70
 
esac
71
 
 
72
 
exit 0