File google-instance-setup.suse of Package google-compute-engine.7175

#!/bin/sh
# Copyright 2016 Google Inc. All Rights Reserved.
# Copyright 2016 SUSE LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.
#
### BEGIN INIT INFO
# Provides:          google_instance_setup
# X-Start-Before:    ssh
# Required-Start:    $local_fs $network $syslog $remote_fs
# Required-Stop:     $null
# Default-Start:     2 3 5
# Default-Stop:
# Short-Description: Google Compute Engine Instance Setup
# Description:       Runs instance setup on boot.
### END INIT INFO

NAME=google-instance-setup
SCRIPTNAME=/etc/init.d/$NAME

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - misc error
# 2 - invalid or excess args
# 3 - unimplemented feature (e.g. reload)
# 4 - insufficient privilege
# 5 - program not installed
# 6 - program not configured
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
        echo -n "Starting $NAME "
        # This is a one shot script, do not run with startproc
        startproc /usr/bin/google_instance_setup

        # Remember status and be verbose
        rc_status -v
        ;;
    *)
        echo $"Usage: $0 start"
        exit 1
        ;;
esac