Western Digital My Book 所使用的 BusyBox 可塑性还是很高的。

想到正好在用 PPA 在 PSP 上通过 WiFi 看电影,干脆把 nethostfs 服务也集成到 My Book 里面好了。(English Version

前期准备:在 My Book 上加装 SSH 服务

第一步:按照下面的方法下载 nethostfs v1.5 源代码,解包,编译。

bash
  1. wget http://www.snailium.net/mbwe/nethostfs15src.tar.gz
  2. tar -xzvf nethostfs15src.tar.gz
  3. cd nethostfs15src
  4. make
  5. cp nethostfs /usr/sbin
  6. chmod 755 /usr/sbin/nethostfs
  7. chown root:root /usr/sbin/nethostfs

第二步:通过 My Book 共享储存管理器建立 PSP 共享文件夹。

第三步:在 /etc/init.d/ 下建立 nethostfs 服务脚本。

/etc/init.d/nethostfs
  1. #!/bin/sh
  2. #
  3. # Starts or stops the nethostfs for remote PSP access.
  4.  
  5. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  6. NAME="nethostfs"
  7. DESC="Remote PSP access"
  8.  
  9. case "$1" in
  10.   start)
  11.         echo -n "Starting $DESC: $NAME"
  12.         nice -n 10 nethostfs /shares/internal/PSP &
  13.         echo "..."
  14.         ;;
  15.    stop)
  16.         echo -n "Stopping $DESC: $NAME"
  17.         killall nethostfs
  18.         echo "."
  19.         ;;
  20.    *)
  21.         N=/etc/init.d/$NAME
  22.         echo "Usage: $N {start|stop}" >&2
  23.         exit 2
  24. esac
  25.  
  26. exit 0
  27.  

第四步:在 /etc/init.d/ 下建立相关启动/关闭服务链接。

bash
  1. cd /etc/init.d/
  2. ln -s /etc/init.d/nethostfs S91nethostfs
  3. ln -s /etc/init.d/nethostfs K09nethostfs

第五步:重启 My Book。


注意 1:在服务脚本中,使用了 nice -n 10 调整进程的优先级,防止 nethostfs 占用过多资源。
注意 2:此方法也适用于 iRshell。(PPA 的 WiFi 部分使用的是 iRshell 的源代码)