昨天一个同事问起来这件事情
于是我又把以前处理过这种事情后发的信给搜了出来
(年纪大了,记不住东西,幸好原来的邮件还在
再找了一下
发现blog上没有
所以今天就贴出来
免得以后再有人问起来又得翻邮件^_^
这次问题是libintl.so.1找不到
其实这个文件是存在的(我处理的这个例子里是这样的,但不知道是否具有广泛性)
在/usr/local/lib下(很有可能是安装gettext是装上的,因为软件通过ports安装多在/usr/local目录下)
假设是/usr/libexec/libintl.so.1或者是/usr/lib/libintl.so.1找不到
解决问题的基本思想就是把/usr/local/lib/libintl.so.1拷贝到/usr/lib/目录下
思想定了,解决方法就好办了
把/usr/local/lib/libintl.so.1和/usr/lib/目录所在分区分别mount上
然后再把文件拷过去
这里需要注意的是
/usr/local/lib下除了文件libintl.so.1外
还有个libintl.so的软链
是指向libintl.so.1的 所以我们在/usr/lib下也建一个软链
指向/usr/lib下的libintl.so.1
再umount
搞定
具体:
我用FreeBSD live cd把机器起起来
mkdir /tmp/temp
mount /dev/da0s1a /tmp/temp
mount /dev/da0s1e /tmp/temp1
cp /tmp/temp1/lib/libintl.so.1 /tmp/temp/usr/libexec/
cd /tmp/temp/usr/libexec
ln -s libintl.so.1 libintl.so
重起
发现还是不行
但现在有了live cd
网络可以起来
原来的硬盘也可以mount
所以我想可以通过网络把数据备出去了
数据分区是da0s1a、da0s1e、da0s1f、da0s1g、da0s1h
都准备撤了
最后一次
cp /tmp/temp/libexec/libintl.so.1 /tmp/temp/usr/lib/libintl.so.1
cd /tmp/temp/usr/lib
ln -s libintl.so.1 libintl.so
cd umount /tmp/temp
重起
居然起来了
FreeBSD下只需要设定一个环境变量PACKAGEROOT
就能用命令pkg_add -r 直接从网络下载、安装ports里的软件
比如: setenv PACKAGEROOT ftp://ftp.freebsd.org/
或者
export PACKAGEROOT=ftp://ftp.freebsd.org/
这样的话就可以用命令 pkg_add -r lynx来装ports里的软件了(这里是lynx)
再或者自己做台server
把ftp://ftp.freebsd.org/pub/FreeBSD/ 下的ports、packages目录mirror下来
就可以把PACKAGEROOT指向自己的机器
这样安装速度会快很多
我在公司就是这么做的
以前的mod_gzip 1.3.19a的时候好象使用命令
/path/to/apxs -i -a -c mod_gzip.c
来安装的
(这里的/path/to/apxs是apache的应用程序apxs的路径
比如说/usr/local/apache/bin/apxs)
这种方法好像在最新的mod_gzip(版本是1.3.26)里不行
看了看文档
好像是这样:
make APXS=/path/to/apxs;make install APXS=/path/to/apxs
(这里的/path/to/apxs跟上面的意思一样)
# for 1.3.x
./configure \
–enable-module=so \
–disable-module=negotiation \
–disable-module=status \
–disable-module=autoindex \
–disable-module=actions \
–disable-module=userdir \
–disable-module=cgi \
–enable-module=expires \
–enable-module=headers \
–disable-module=asis \
–disable-module=imap
make
make install
strip /usr/local/apache/bin/httpd
# for apache2.0.x on linux or sun box
./configure \
–disable-negotiation \
–disable-status \
–disable-autoindex \
–disable-actions \
–disable-userdir \
–disable-cgid \
–enable-expires \
–enable-headers \
–disable-asis \
–disable-imap \
–with-mpm=worker
make
make install
strip /usr/local/apache2/bin/httpd
注意:在linux2.4上,推荐用apache1.3
在linux2.6的机器上,推荐用apache2
我的客户端是一台openvpn client
配置文件如下:
[@41.108 ~]# cat /etc/openvpn/client.conf
client
dev tun
proto udp
remote 192.168.13.15 1194
nobind
user nobody
group nobody
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
tls-auth ta.key 1
ns-cert-type server
comp-lzo
verb 3
mute 20
者是跑在一台freebsd上面的openvpn server
bash-2.05b# cat /usr/local/etc/openvpn/openvpn.conf
local 192.168.13.15
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
crl-verify vpncrl.pem
dh dh1024.pem
server 172.16.13.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway"
keepalive 10 120
tls-auth ta.key 0
comp-lzo
max-clients 10
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log openvpn.log
log-append openvpn.log
verb 3
mute 20
原文是英文的,在这里
最简单的办法就是
rm ./-filename
(这里"-filename"在当前目录下)
很多命令,尤其是那些使用"getopt(3)"做常规参数解析的
会接受"–"作为参数,而且这意味着“这是最后一个选项”
所以,你的rm的版本也许能够操作"rm — -filename"这种方式
还有一些没有用getopt()的版本的rm认为单个"-"跟上面提到的"–"一样的作用
所以在这种版本的rm,可以用命令"rm – -filename"
Sending email with attachments on UNIX systems(UNIX系统下发带附件的邮件)
以下的例子都使用了下面的这几个变量
TXTFILE=/tmp/textfile
ATTFILE=/tmp/binary_file
SUBJECT="Your attachment"
MAILTO=user@where.ever
一共可以有n种办法
下面列出几种
- uuencode
uuencode $ATTFILE $ATTFILE | \
mail -s "$SUBJECT" $MAILTO
(uuencode $FILE1 $FILE1; uuencode $FILE2\
$FILE2)| mail -s "$SUBJECT" $MAILTO
- simple shell commands
echo "From: $LOGNAME\n\
To: $MAILTO\nSubject: $SUBJECT\n\
Mime-Version: 1.0\n\
Content-Type: text/plain\n\
" > /tmp/file
cat $TXTFILE >> /tmp/file
/usr/lib/sendmail -t -oi < /tmp/file
- metamail
metasend -b -s "$SUBJECT"\
-f $TXTFILE -m text/plain -e none -n \
-f $ATTFILE -m application/octet-stream \
-e base64 -t $MAILTO
- mpack
mpack -s "$SUBJECT" -c \
application/octet-stream $ATTFILE $MAILTO
- mutt
mutt -a $ATTFILE -s "$SUBJECT" $MAILTO <\
$TXTFILE
- Elm
elm -s"$SUBJECT" -A $ATTFILE $MAILTO < $TXTFIL
- Pine – (to be investigated but it doesn’t look good; maybe the c-client?)
- uuenview
uuenview -m $MAILTO -b -a $ATTFILE < $TXTFILE
- nail
nail -s "$SUBJECT" -a $ATTFILE $MAILTO < $TXTFILE
- Z-Mail
For a single file:
cat $TXTFILE | zmail.small -subject "$SUBJECT"\
-attach application/octet-stream:${ATTFILE}\
$MAILTO Bart Schaefer offers the following\
for multiple attachments.\
(untested by myself)
zmail.small -rf /dev/null -e \
'mail -z -s "$SUBJECT" $MAILTO' \
-e 'compcmd attach-file $ATTACHFILE \
application/msword base64 \
"$DESCRIPTION"' \
-e! 'compcmd send'
cp boot.flp /root/
cd
vnconfig -c vn0 boot.flp;mount /dev/vn0 /mnt
cp /mnt/mfsroot.gz .
umount /mnt;vnconfig -u vn0
gzip -d mfsroot.gz
vnconfig -c vn0 mfsroot;mount /dev/vn0 /mnt
然后
/mnt目录下的东西就可以修改了
改完再
umount /mnt;vnconfig -u vn0
我们的应用主要是改mfsroot.gz中stand目录下的东西
这个可以这样做到
cd /usr/src/release;make boot.flp
在make boot.flp之前需要根据需要修改一下文件/usr/src/release/i386/boot_crunch.conf
这里面定义的有stand目录下需要哪些程序的定义
而且make boot.flp的时候也许会出点错
一步一步试吧
其实我们不需要真正做出boot.flp来
我们只需要把stand目录下的东西做出来就ok了
所以如果是在这之后出错
我们就不用去管它(我的情况正是如此)
然后就是把编好的stand目录下的东西拷贝到目的目录(这里应该是/mnt/stand/)下去
首先需要把目的目录下inode号一样的文件全部删掉
然后把文件boot_crunch拷过来
cp /R/stage/mfsfd/stand/boot_crunch /mnt/stand
然后
把其他/R/stage/mfsfd/stand/目录下和boot_crunch的inode号一样的程序弄过来
比如说这些程序有dhclient dialog find这几个
那么
cd /mnt/stand
for i in dhclient dialog find; do ln boot_crunch $i; done
再然后
cd
umount /mnt;vnconfig -u vn0
gzip -9 mfsroot
vnconfig -c vn0 boot.flp;mount /dev/vn0 /mnt
cp mfsroot.gz /mnt/
umount /mnt;vnconfig -u vn0
OK
这样我们就得到了定制的boot.flp
近期评论