现在在学习脚本,没事折腾了这个,升级后,不能启动,会卡 ldconfig 那里,不知道什么原因.
估计内核还得重新折腾,暂时不深入...把脚本记录一下.
- #!/bin/bash
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
- export PATH
- Var_find_dir=./ttylinuxfilesys
- Var_find_args1="-perm 755 -size 383k"
- Var_find_args2="-perm 4711 -size 59k"
- Var_list_templist=`mktemp /tmp/tmp.XXXXXXX`
- Var_list_tempdiff=`mktemp /tmp/tmp.XXXXXXX`
- Var_other=""
- find busybox ! -type d -exec ls {} \; | sed "s:^busybox:\./ttylinuxfilesys:" | grep -v busybox >busybox.list
- #删除383k可执行文件
- find $Var_find_dir $Var_find_args1 -exec rm {} \;
- #得到4711权限文件列表
- find $Var_find_dir $Var_find_args2 >$Var_list_templist
- #删除4711权限文件
- find $Var_find_dir $Var_find_args2 -exec rm -f {} \;
- cp busybox-i686 $Var_find_dir/bin/busybox
- chmod 755 $Var_find_dir/bin/busybox
- chown root.root $Var_find_dir/bin/busybox
- cp busybox-i686 $Var_find_dir/bin/busybox-suid
- chmod 4711 $Var_find_dir/bin/busybox-suid
- chown root.root $Var_find_dir/bin/busybox-suid
- #余下的可执行文件
- find $Var_find_dir/bin ! -type d >$Var_list_tempdiff
- find $Var_find_dir/sbin ! -type d >>$Var_list_tempdiff
- find $Var_find_dir/usr/bin ! -type d >>$Var_list_tempdiff
- find $Var_find_dir/usr/sbin ! -type d >>$Var_list_tempdiff
- #比较
- for i in `cat $Var_list_tempdiff`
- do
- sed -i "/${i##*/}/d" busybox.list
- done
- for i in `cat $Var_list_templist`
- do
- sed -i "/${i##*/}/d" busybox.list
- done
- sed -i '/busybox-suid/d' $Var_list_templist
- #得到全部文件,创建链接
- for i in `cat busybox.list`
- do
- ln $Var_find_dir/bin/busybox $i
- done
- for i in `cat $Var_list_templist`
- do
- ln $Var_find_dir/bin/busybox-suid $i
- done
- rm -f $Var_list_templist $Var_list_tempdiff
本文转自 nonono11 51CTO博客,原文链接:http://blog.51cto.com/abian/1127735,如需转载请自行联系原作者