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