私は、samba conf ファイルを変更するために、この小さなシェル関数を作成しました。しかし、この行のどこかで失敗しているようsed -e "$t1,$t2 d" $CFGFILE > $TMPFILE
です。エラーは次のとおりです。
Doing Samba customization...
/etc/samba/smb.conf
/etc/samba/smb.conf.tmp
sed: -e expression #1, char 1: unknown command: `,'
最後にも直面している同じ問題sed
:
sed -e "$t1, $ d" $CFGFILE > $TMPFILE
// 目的は、行番号 t1 から最後まで削除することです
シェル関数は次のとおりです。
updateSmbConf()
{
SMBCFG="$DIR_ETCSAMBA/smb.conf"
SMBCFGTMP="$SMBCFG.tmp"
echo $SMBCFG
echo $SMBCFGTMP
# Fix for bug #3147
sed "s/INSITEONE-CIFS/DELL-CIFS/" $SMBCFG > $SMBCFGTMP
sed "s/InSiteOne CIFS Archive/DCCA CIFS Archive/" $SMBCFG > $SMBCFGTMP
cp $SMBCFGTMP $SMBCFG
rm $SMBCFGTMP
t1=` grep -n "\[Archive\]" $CFGFILE | cut -f1 -d:`
t2=$(($t1+11-1)) # Remove the next 11 lines
sed -e "$t1,$t2 d" $CFGFILE > $TMPFILE
cp $TMPFILE $CFGFILE
rm $TMPFILE
#[SampleHA]
#t1=` grep -n "\[SampleHA\]" $CFGFILE | cut -f1 -d:`
#sed -e "$t1, $ d" $CFGFILE > $TMPFILE
#cp $TMPFILE $CFGFILE
#rm $TMPFILE
}
変更しようとしているsmb.confは次のとおりです。
------------------------------------------------------------------------------------
COMPLETE SMB.CONF
------------------------------------------------------------------------------------
cat /etc/samba/smb.conf
# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
# Date: 2006-07-13
[global]
guest account = insite1
oplocks = no
msdfs root = yes
workgroup = INSITEONE-CIFS
server string = "InSiteOne CIFS Archive"
security = SHARE
syslog = 0
max smbd processes = 15
interfaces = eth* lo
bind interfaces only = no
#[Archive]
# hosts allow = 127.0.0.1 10.135.30.135 10.135.30.135
# hosts deny = ALL
# vfs objects = relay:"host = localhost; \
# port = 1025; \
# log_level = 0"
# comment = InSiteOne Archive File System
# path = /opt/samba
# read only = No
# guest ok = Yes
# locking = no
[DCCAArchive]
comment = DCCA Archive File System
path = /opt/insiteone/fuse-mount/ifm
read only = No
public = yes
writeable = yes
create mask=0777
guest ok = Yes
#[SampleHA]
# comment = High Availability Share
# path = <Path of Local Archive e.g. /opt/samba3/archive>
# read only = No
# guest ok = Yes
# locking = no
# hosts allow = 127.0.0.1 OTHERPROXYIP
# hosts deny = ALL
# directory mode = 0775
# create mode = 0664