1b819cea2SGordon Ross#!/bin/sh 2b819cea2SGordon Ross 3b819cea2SGordon Ross# 4b819cea2SGordon Ross# This file and its contents are supplied under the terms of the 5b819cea2SGordon Ross# Common Development and Distribution License ("CDDL"), version 1.0. 6b819cea2SGordon Ross# You may only use this file in accordance with the terms of version 7b819cea2SGordon Ross# 1.0 of the CDDL. 8b819cea2SGordon Ross# 9b819cea2SGordon Ross# A full copy of the text of the CDDL should have accompanied this 10b819cea2SGordon Ross# source. A copy of the CDDL is also available via the Internet at 11b819cea2SGordon Ross# http://www.illumos.org/license/CDDL. 12b819cea2SGordon Ross# 13b819cea2SGordon Ross 14b819cea2SGordon Ross# 15*12b65585SGordon Ross# Copyright 2014 Nexenta Systems, Inc. All rights reserved. 16b819cea2SGordon Ross# 17b819cea2SGordon Ross 18b819cea2SGordon Ross# Helper program to run fksmbd (user-space smbd for debugging) 19b819cea2SGordon Ross# using binaries from the proto area. 20b819cea2SGordon Ross 21b819cea2SGordon Ross[ -n "$ROOT" ] || { 22b819cea2SGordon Ross echo "Need a bldenv to set ROOT=..." 23b819cea2SGordon Ross exit 1; 24b819cea2SGordon Ross} 25b819cea2SGordon Ross 26b819cea2SGordon Rossif [[ ! -w /var/smb || ! -w /var/run/smb ]] 27b819cea2SGordon Rossthen 28b819cea2SGordon Ross echo "Need to create/chown/chmod /var/smb /var/run/smb" 29b819cea2SGordon Ross echo "mkdir -p /var/run/smb" 30b819cea2SGordon Ross echo "chown -R $USER /var/smb /var/run/smb" 31b819cea2SGordon Ross echo "chmod -R a+rw /var/smb /var/run/smb" 32b819cea2SGordon Ross exit 1; 33b819cea2SGordon Rossfi 34b819cea2SGordon Ross 35*12b65585SGordon Rossif [[ ! -r /var/smb/smbpasswd ]] 36*12b65585SGordon Rossthen 37*12b65585SGordon Ross echo "Need readable /var/smb/smbpasswd, i.e." 38*12b65585SGordon Ross echo 'chgrp staff /var/smb/smbpasswd' 39*12b65585SGordon Ross echo 'chmod 440 /var/smb/smbpasswd' 40*12b65585SGordon Ross exit 1; 41*12b65585SGordon Rossfi 42*12b65585SGordon Ross 43*12b65585SGordon Rossif [[ -e /var/smb/.pwd.lock && ! -w /var/smb/.pwd.lock ]] 44*12b65585SGordon Rossthen 45*12b65585SGordon Ross echo "Need to cleanup /var/smb/.pwd.lock, i.e." 46*12b65585SGordon Ross echo "rm -f /var/smb/.pwd.lock" 47*12b65585SGordon Ross exit 1; 48*12b65585SGordon Rossfi 49*12b65585SGordon Ross 50*12b65585SGordon Ross# OK, setup env. to run it. 51*12b65585SGordon Ross 52b819cea2SGordon Rossexport SMBD_DOOR_NAME="/tmp/fksmbd_door" 53b819cea2SGordon Rossexport SMB_SHARE_DNAME="/tmp/fksmbshare_door" 54b819cea2SGordon Ross 55b819cea2SGordon RossLD_LIBRARY_PATH=$ROOT/usr/lib/smbsrv:$ROOT/usr/lib:$ROOT/lib 56b819cea2SGordon Rossexport LD_LIBRARY_PATH 57b819cea2SGordon Ross 58b819cea2SGordon Ross# normally runs with cwd=/ but this is more careful 59b819cea2SGordon Rosscd /var/smb 60b819cea2SGordon Ross 61b819cea2SGordon Ross# run with the passed options 62b819cea2SGordon Rossexec $ROOT/usr/lib/smbsrv/fksmbd "$@" 63