12V - Synology DS212j
5V - Cubox
5V - Fiber Ethernet Converter
5V - Network Hub
2013-06-02, 共花了一天
apt-get update && apt-get -y upgrade; apt-get -y remove --purge language-pack-*; apt-get -y install lighttpd language-pack-en-base;
dpkg-reconfigure locales; export LANG=en_HK.UTF-8; dpkg-reconfigure tzdata; apt-get update && apt-get -y upgrade; echo "export LANG=en_HK.UTF-8;" >> /root/.profile; apt-get -y autoremove; reboot
echo "alias ls='ls -la --color=auto'" >> /root/.profile;2. 設定 mpd 的 configure 檔
cd /var; mv /var/log /run
ln -s ../run/log log
cd /var/lib; mv /var/lib/urandom /run
ln -s /run/urandom /var/lib/urandom
mv /var/lib/dhcp /run
ln -s /run/dhcp /var/lib/dhcp
mv /root/.bash_history /run
ln -s /run/.bash_history /root/.bash_history
mkdir -p /run/music
ln -s /run/music /music
ln -s /music /var/www/music
mv /etc/mpd.conf /etc/mpd.conf.org(nano 的簡單教學: [轉] 基本 Nano 指南)
nano /etc/mpd.conf
music_directory "/music"請自行修改粉紅色的內容, 其中,
playlist_directory "/music/.mpdConf/playlists"
db_file "/music/.mpdConf/cubox/db"
log_file "/run/mpd/log"
pid_file "/run/mpd/pid"
state_file "/music/.mpdConf/cubox/state"
sticker_file "/music/.mpdConf/cubox/sticker.sql"
audio_buffer_size "8192"
buffer_before_play "90%"
user "mpd"
group "audio"
zeroconf_enabled "yes"
zeroconf_name "Cubox"
mixer_type "disabled"
filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"
realtime_option {
memlock "yes"
stack_reserve "2048"
heap_reserve "10240"
main_priority "OTHER:0"
player_priority "FIFO:52"
decoder_priority "FIFO:51"
update_priority "OTHER:0"
}
decoder {
plugin "dsdiff"
enabled "yes" # DSD native
}
decoder {
plugin "dsdiff_native"
enabled "yes"
dsdsampleformat "24"
tagsupport "id3pref"
}
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
priority "FIFO:52"
dsd_usb "yes"
}
chown mpd:audio /etc/mpd.conf
(nano 的簡單教學: [轉] 基本 Nano 指南)
nano -w /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chrt -f -p 53 `pgrep -n cifsd`
chrt -f -p 53 `pgrep -o cifsd`
mount -t cifs -o uid=mpd,file_mode=0666,dir_mode=0766,iocharset=utf8,\請自行修改粉紅色的內容, 其中,
rsize=130048,wsize=4096,\
username=mpduser,password=mpd1234 192.168.0.101:/Music /run/music
service mpd restart
mpc update
find /run/music/USB -type d -empty -delete
exit 0
nano /etc/init.d/readonlySetup(nano 的簡單教學: [轉] 基本 Nano 指南)
#!/bin/sh
### BEGIN INIT INFO
# Provides: read-only file-system preparation
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: prepare for read-only root FS
# Description: prepare for read-only root FS
### END INIT INFO
prep_start () {
echo "Prep for read-only FS"
echo heartbeat > /sys/class/leds/cubox:red:health/trigger
/bin/mkdir -p /run/log/lighttpd /run/tmp /run/urandom /run/dhcp /run/music/.mpdConf/cubox /run/music/.mpdConf/playlists
/bin/touch /run/.bash_history /run/music/.mpdConf/cubox/db /run/music/.mpdConf/cubox/state /run/music/.mpdConf/cubox/sticker.sql
/bin/chmod -R 777 /run/log /run/tmp /run/urandom /run/dhcp /run/music
#/bin/mount -o remount,ro /
}
prep_stop () {
echo "Prep for read-only FS (stop)"
/bin/mount -o remount,rw /
}
case "$1" in
start)
prep_start
;;
stop)
prep_stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 2
;;
esac
chmod 777 /etc/init.d/readonlySetupReboot 後, 你可用 MPaD (或任何 mpd controller) 見到 "Cubox".
cd /etc/rc2.d
ln -s ../init.d/readonlySetup S10readonlySetup
cd ..
cd /etc/rc3.d
ln -s ../init.d/readonlySetup S10readonlySetup
cd ..
cd /etc/rc4.d
ln -s ../init.d/readonlySetup S10readonlySetup
cd ..
cd /etc/rc5.d
ln -s ../init.d/readonlySetup S10readonlySetup
reboot
原始碼 1.1:
|
# nano 檔案名稱
|
原始碼 1.2:
|
# nano -w /etc/fstab
|
警告: 這非常重要,如果您忘了使用 -w 參數編輯一個設定檔,您的系統可能會出現問題。
|