1*f875b4ebSrica#!/bin/sh 2*f875b4ebSrica# 3*f875b4ebSrica# CDDL HEADER START 4*f875b4ebSrica# 5*f875b4ebSrica# The contents of this file are subject to the terms of the 6*f875b4ebSrica# Common Development and Distribution License (the "License"). 7*f875b4ebSrica# You may not use this file except in compliance with the License. 8*f875b4ebSrica# 9*f875b4ebSrica# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*f875b4ebSrica# or http://www.opensolaris.org/os/licensing. 11*f875b4ebSrica# See the License for the specific language governing permissions 12*f875b4ebSrica# and limitations under the License. 13*f875b4ebSrica# 14*f875b4ebSrica# When distributing Covered Code, include this CDDL HEADER in each 15*f875b4ebSrica# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*f875b4ebSrica# If applicable, add the following below this CDDL HEADER, with the 17*f875b4ebSrica# fields enclosed by brackets "[]" replaced with your own identifying 18*f875b4ebSrica# information: Portions Copyright [yyyy] [name of copyright owner] 19*f875b4ebSrica# 20*f875b4ebSrica# CDDL HEADER END 21*f875b4ebSrica# 22*f875b4ebSrica# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*f875b4ebSrica# Use is subject to license terms. 24*f875b4ebSrica# 25*f875b4ebSrica# This program is invoked to do the actual file transfer 26*f875b4ebSrica# associated with an invocation of the setflabel(3TSOL) function. 27*f875b4ebSrica# 28*f875b4ebSrica# It executes in the global zone with the user's identity and 29*f875b4ebSrica# basic privileges plus the file_dac_search privilege. This 30*f875b4ebSrica# script should not not assume that stdio is available or that 31*f875b4ebSrica# any particular environment variables are set. In particular, 32*f875b4ebSrica# the DISPLAY variable will not normally be pre-set. 33*f875b4ebSrica# 34*f875b4ebSrica# Authorization checks and zone limit privilege checks 35*f875b4ebSrica# are done before calling this script. Auditing is done 36*f875b4ebSrica# upon return. 37*f875b4ebSrica# 38*f875b4ebSrica############################################################## 39*f875b4ebSrica# 40*f875b4ebSrica# Calling sequence: 41*f875b4ebSrica# 42*f875b4ebSrica# $1 is the global zone real pathname of the source file 43*f875b4ebSrica# 44*f875b4ebSrica# $2 is the global zone real destination pathname 45*f875b4ebSrica# 46*f875b4ebSrica# Exit status: 47*f875b4ebSrica# 48*f875b4ebSrica# 0 on success 49*f875b4ebSrica# 1 on error 50*f875b4ebSrica# 51*f875b4ebSrica############################################################## 52*f875b4ebSrica# 53*f875b4ebSrica# This script can be customized or replaced to perform 54*f875b4ebSrica# additional processing such as tranquility checks, dirty 55*f875b4ebSrica# word filtering, copying instead of moving, etc. 56*f875b4ebSrica# 57*f875b4ebSrica# By default it does a check to determine if the source file 58*f875b4ebSrica# is in use by calling fuser(1). However, this check 59*f875b4ebSrica# does not work for filesystems that were automounted in 60*f875b4ebSrica# non-global zones. 61*f875b4ebSrica# 62*f875b4ebSrica# Perform a simple tranquility check 63*f875b4ebSrica# 64*f875b4ebSricainuse=`/usr/sbin/fuser $1 2>&1 | /usr/bin/cut -d ":" -f2` 65*f875b4ebSricaif [ $inuse ]; then 66*f875b4ebSrica# 67*f875b4ebSrica# file is in use 68*f875b4ebSrica# 69*f875b4ebSrica exit 1 70*f875b4ebSricaelse 71*f875b4ebSrica# 72*f875b4ebSrica# Perform an inter-zone move of the data 73*f875b4ebSrica /usr/bin/mv $1 $2 74*f875b4ebSrica exit $? 75*f875b4ebSricafi 76