/* AddShare script for Samba Server for eCS (OS/2) Copyright (C) netlabs.org 2007-2009 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Purpose: Let a remote user add a new share to a Samba Server Required smb.conf changes: [global] add share command = x:\Samba\addshare.cmd */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs /* parse arguments into appropriate variables */ parse arg '"'smbconf'" "'sharename'" "'sharepath'" "'sharecomment'" 'maxconnections /* determine where to put the logfile */ parse source . . scriptcmd smbpath = strip(filespec('D',scriptcmd)||filespec('P',scriptcmd),,'\') UnixRoot = strip(value('UNIXROOT',,'OS2ENVIRONMENT'),,'\') LogPath = strip(value('LOGFILES',,'OS2ENVIRONMENT'),,'\') if LogPath = "" then LogPath = strip(value('ETC',,'OS2ENVIRONMENT'),,'\')||'samba\logs' LogFile = LogPath'\'left(filespec('N',scriptcmd),length(filespec('N',scriptcmd))-3)'log' /* translate remaining '/' into '\' */ smbconf = translate(smbconf,'\','/') /* indent statements by a tabulator (as testparm -v does) */ Indent = '09'x /* write logfile */ call lineout LogFile, '['date('S')' 'time()'] 'filespec('N',scriptcmd)' started.' call lineout LogFile, '['date('S')' 'time()'] smb.conf="'smbconf'"' call lineout LogFile, '['date('S')' 'time()'] sharename="'sharename'"' call lineout LogFile, '['date('S')' 'time()'] path="'sharepath'"' call lineout LogFile, '['date('S')' 'time()'] comment="'sharecomment'"' call lineout LogFile, '['date('S')' 'time()'] max connections="'maxconnections'"' /* create the new share in smb.conf */ call lineout smbconf, '['sharename']' call lineout smbconf, Indent||'path = 'sharepath call lineout smbconf, Indent||'comment = 'sharecomment call lineout smbconf, Indent||'browseable = yes' call lineout smbconf, Indent||'printable = no' if maxconnections <> 0 then call lineout smbconf, Indent'max connections = 'maxconnections call lineout smbconf, Indent call lineout smbconf /* call beep 1880, 10 call beep 2440, 10 */ call lineout LogFile, '['date('S')' 'time()'] 'filespec('N',scriptcmd)' done.'