yasunari@ude:/home/linkstation/HackKit/unified$ diff -u hackkit_090222.sh hackki
t_090222D.sh
--- hackkit_090222.sh 2009-02-22 21:03:03.175142750 +0900
+++ hackkit_090222D.sh 2009-02-22 17:53:10.111523000 +0900
@@ -26,10 +26,18 @@
ROOTPARTITION=/dev/sdb2
SWAPPARTITION=/dev/sdb3
DATAPARTITION=/dev/sdb4
+
+ETH=eth0
+
#======================================================================
-# 各パーティションのフォーマット(LS-WSGL 以外)
+# 各パーティションのフォーマット(LS-WSGL,LS-QL 以外)
format_disk() {
+ if [ $MACHINE = LSWSGL -o $MACHINE = LSQL ]
+ then
+ return
+ fi
+
echo formating hard drive ...
# /boot
@@ -105,6 +113,11 @@
# fstab の修正(LS-WSGL,LS-QL のみ)
create_fstab() {
+ if [ $MACHINE != LSWSGL -a $MACHINE != LSQL ]
+ then
+ return
+ fi
+
echo creating /etc/fstab ...
cat > etc/fstab <<EOF
@@ -126,9 +139,13 @@
}
#---------------------------------------------------------
-# miconapl のコピー(LS-GL/HS-DHGLのみ)
+# miconapl のコピー(LS-GL,HS-DHGLのみ)
copy_miconapl() {
+ if [ $MACHINE != LSGL -a $MACHINE != HSDHGL ]
+ then
+ return
+ fi
echo copying miconapl ...
cd /
@@ -143,9 +160,11 @@
create_miconapl() {
echo creating miconapl ...
-
cd $MOUNTPOINT
+ if [ $MACHINE != LSGL -a $MACHINE != HSDHGL ]
+ then
+
cat > etc/init.d/miconapl <<EOF
#!/bin/sh
@@ -172,16 +191,8 @@
exit 0
EOF
- chmod +x etc/init.d/miconapl
- ln -s ../init.d/miconapl etc/rc0.d/K10miconapl
- ln -s ../init.d/miconapl etc/rc6.d/K10miconapl
- ln -s ../init.d/miconapl etc/rcS.d/S80miconapl
-}
-
-create_miconapl_lsgl() {
- echo creating miconapl ...
+ else
- cd $MOUNTPOINT
cat > etc/init.d/miconapl <<EOF
#!/bin/sh
@@ -203,6 +214,7 @@
exit 0
EOF
+ fi
chmod +x etc/init.d/miconapl
ln -s ../init.d/miconapl etc/rc0.d/K10miconapl
ln -s ../init.d/miconapl etc/rc6.d/K10miconapl
@@ -213,6 +225,10 @@
#---------------------------------------------------------
# Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
create_fancontrol() {
+ if [ $MACHINE != LSGL -a $MACHINE != HSDHGL ]
+ then
+ return
+ fi
echo creating fancontrol ...
cd $MOUNTPOINT
@@ -349,6 +365,10 @@
# カーネルモジュールのコピー
copy_modules() {
+ if [ $MACHINE != LSWSGL -a $MACHINE != LSQL ]
+ then
+ return
+ fi
echo copying /lib/modules ...
cd /
@@ -478,12 +498,6 @@
#======================================================================
# setup network
network_interfaces() {
- ETH=eth0
- if [ $MACHINE = LSXHL ]
- then
- ETH=eth1
- fi
-
cat > $MOUNTPOINT/etc/network/interfaces <<EOF
######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
@@ -562,9 +576,13 @@
}
#---------------------------------------------------------
-# copy_boot
+# /boot のコピー(LS-WSGL,LS-QL 以外)
copy_boot() {
+ if [ $MACHINE = LSWSGL -o $MACHINE = LSQL ]
+ then
+ return
+ fi
echo copying /boot ...
(cd /boot ; tar cf - initrd.buffalo uImage.buffalo)|(cd $MOUNTPOINT/boot; tar xvf -)
@@ -681,86 +699,9 @@
case "$PRODUCTID" in
0x00000009)
MACHINE=LSGL
- # 各パーティションのフォーマット(LS-WSGL 以外)
- format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- #create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl_lsgl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
0x0000000A)
MACHINE=HSDHGL
-
- # 各パーティションのフォーマット(LS-WSGL 以外)
- format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- #create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl_lsgl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
0x0000000B)
MACHINE=LSLGL
@@ -769,129 +710,14 @@
;;
0x0000000E)
MACHINE=LSHGL
-
- # 各パーティションのフォーマット(LS-WSGL 以外)
- format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- #create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- #copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- # create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
0x0000000F)
MACHINE=LSCL
-
- # 各パーティションのフォーマット(LS-WSGL 以外)
- format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- #create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- #copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- # create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
0x00000011)
MACHINE=LSXHL
- # 各パーティションのフォーマット(LS-WSGL 以外)
- format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- #create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- #copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- # create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
+ ETH=eth1
;;
0x00003002)
MACHINE=LSWSGL
@@ -901,45 +727,6 @@
ROOTPARTITION=/dev/md1
SWAPPARTITION=/dev/md10
DATAPARTITION=""
-
- # 各パーティションのフォーマット(LS-WSGL 以外)
- # format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- #copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- # create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- # copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- # copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
0x00004000)
MACHINE=LSQL
@@ -949,48 +736,49 @@
ROOTPARTITION=/dev/md1
SWAPPARTITION=/dev/md10
DATAPARTITION=""
-
- # 各パーティションのフォーマット(LS-WSGL 以外)
- # format_disk
- # / のマウント
- mount_root
- # アーカイブの展開
- extract_hackkit
- # fstab の修正(LS-WSGL のみ)
- create_fstab
- # miconapl のコピー(LS-GL/HS-DHGLのみ)
- #copy_miconapl
- # LED コントロールスクリプトの作成
- create_miconapl
- # Fan コントロールスクリプトの作成(LS-GL/HS-DHGLのみ)
- # create_fancontrol
- # 電源 SW による電源 OFF 対応
- create_kernelmon
- # カーネルモジュールのコピー(LS-WSGL 以外)
- # copy_modules
- # カーネルモジュールのロードスクリプトの作成
- create_usb
-
- # ネットワークのセットアップ
- network_interfaces
- resolv_conf
- hosts
- hostname
-
- # / のアンマウント
- umount_root
-
- # /boot のマウント
- mount_boot
- # /boot のコピー(LS-WSGL 以外)
- # copy_boot
- # initrd の編集
- edit_initrd
- # /boot のアンマウント
- umount_boot
;;
*)
echo unknown PRODUCTID = "$PRODUCTID"
exit
;;
esac
+
+# 各パーティションのフォーマット
+format_disk
+
+# / のマウント
+mount_root
+# アーカイブの展開
+extract_hackkit
+# fstab の修正
+create_fstab
+# miconapl のコピー
+copy_miconapl
+# LED コントロールスクリプトの作成
+create_miconapl
+# Fan コントロールスクリプトの作成
+create_fancontrol
+# 電源 SW による電源 OFF 対応
+create_kernelmon
+# カーネルモジュールのコピー
+copy_modules
+# カーネルモジュールのロードスクリプトの作成
+create_usb
+
+# ネットワークのセットアップ
+network_interfaces
+resolv_conf
+hosts
+hostname
+
+# / のアンマウント
+umount_root
+
+# /boot のマウント
+mount_boot
+# /boot のコピー
+copy_boot
+# initrd の編集
+edit_initrd
+# /boot のアンマウント
+umount_boot
yasunari@ude:/home/linkstation/HackKit/unified$
これまで PRODUCTID による機種判別 case 文内で できるだけの機種依存処理をしようと思っていたが、限界があり、 どうせ各処理関数内で機種による if 文 / case 文を作るのだから PRODUCTID による機種判別 case 文内での処理は最低限にして 各処理関数内で機種による場合わけをするようにした。
でも、、、、差分だと全然わからんな。
まあインストーラなんて、「ハックキット」だから必要なのであって、
普通にインストールするなら要らない物だし。
|
← 3歩進む |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ USB メモリ |