root@LS-VL815:/mnt/disk1/share/hackkit# cat debootstrap_110103.sh #!/bin/sh # # Copyright (C) 2011 Yasunari YAMASHITA. All Rights Reserved. # set -x DEBOOTSTRAP=debootstrap_1.0.26_all.deb DEBINST=/mnt/disk1/debinst # get wget cd /tmp wget http://ftp.jp.debian.org/debian/pool/main/d/debootstrap/$DEBOOTSTRAP # extract wget ar -xv $DEBOOTSTRAP # install wget cd / tar zxvf /tmp/data.tar.gz # exec debootstrap cd / date /usr/sbin/debootstrap --arch armel squeeze $DEBINST http://ftp.jp.debian.org/debian date # create /initrd mkdir $DEBINST/initrd # edit /etc/apt/sources.list ( echo deb-src http://ftp.jp.debian.org/debian squeeze main echo echo deb http://security.debian.org/ squeeze/updates main echo deb-src http://security.debian.org/ squeeze/updates main ) >> $DEBINST/etc/apt/sources.list # update package lists chroot $DEBINST apt-get update chroot $DEBINST apt-get -y -f install chroot $DEBINST apt-get -y upgrade # create device special files chroot $DEBINST apt-get -y install makedev mkdir $DEBINST/tmp/dev chroot $DEBINST sh -c "mount -t proc /proc proc ; cd /tmp/dev ; MAKEDEV generic ; umount /proc" (cd $DEBINST/tmp/dev; tar cf - *)|(cd $DEBINST/dev; tar xvf - ) rm -fr $DEBINST/tmp/dev # edit /etc/inittab TARGETFILE=$DEBINST/etc/inittab mv $TARGETFILE{,.orig} sed \ -e 's/^\([0-9]:[0-9]*:respawn:.*\)$/#\1/' \ -e '/^#T1/aT0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' \ $TARGETFILE.orig > $TARGETFILE #rm $TARGETFILE.orig # edit /etc/default/rcS TARGETFILE=$DEBINST/etc/default/rcS mv $TARGETFILE{,.orig} sed \ -e 's/UTC=yes/UTC=no/' \ $TARGETFILE.orig > $TARGETFILE #rm $TARGETFILE.orig # reconfigure TimeZone chroot $DEBINST dpkg-reconfigure tzdata # install some packages chroot $DEBINST apt-get -y install xfsprogs locales psmisc inetutils-telnetd smartmontools less nkf ftp # reconfigure locales chroot $DEBINST dpkg-reconfigure locales # edit /etc/inetd.conf TARGETFILE=$DEBINST/etc/inetd.conf mv $TARGETFILE{,.orig} sed \ -e 's/^## telnet/telnet/' \ $TARGETFILE.orig > $TARGETFILE #rm $TARGETFILE.orig # update password of root chroot $DEBINST passwd root # add guest user chroot $DEBINST adduser --gecos "" guest rm -fr $DEBINST/home/guest # clean up chroot $DEBINST apt-get clean root@LS-VL815:/mnt/disk1/share/hackkit#
root@LS-VL815:/mnt/disk1/share/hackkit# sh debootstrap_110103.sh + DEBOOTSTRAP=debootstrap_1.0.26_all.deb + DEBINST=/mnt/disk1/debinst + cd /tmp + wget http://ftp.jp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.26_all.deb --2011-01-03 13:54:02-- http://ftp.jp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.26_all.deb Resolving ftp.jp.debian.org... 150.65.7.130 Connecting to ftp.jp.debian.org|150.65.7.130|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 58232 (57K) [application/x-debian-package] Saving to: `debootstrap_1.0.26_all.deb' 100%[======================================>] 58,232 --.-K/s in 0.07s 2011-01-03 13:54:02 (858 KB/s) - `debootstrap_1.0.26_all.deb' saved [58232/58232] + ar -xv debootstrap_1.0.26_all.deb rw-r--r-- 0/0 4 Nov 12 21:07 2010 debian-binary rw-r--r-- 0/0 1171 Nov 12 21:07 2010 control.tar.gz rw-r--r-- 0/0 56868 Nov 12 21:07 2010 data.tar.gz + cd / + tar zxvf /tmp/data.tar.gz ./ ./usr/ ./usr/sbin/ ./usr/sbin/debootstrap ./usr/share/ : : ./usr/share/debootstrap/scripts/unstable ./usr/share/debootstrap/scripts/hardy + cd / + date Mon Jan 3 13:54:02 JST 2011 + /usr/sbin/debootstrap --arch armel squeeze /mnt/disk1/debinst http://ftp.jp.debian.org/debian I: Retrieving Release I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... I: Resolving dependencies of base packages... I: Found additional required dependencies: insserv libbz2-1.0 libdb4.8 libslang2 I: Found additional base dependencies: libnfnetlink0 libsqlite3-0 libudev0 I: Checking component main on http://ftp.jp.debian.org/debian... I: Retrieving libacl1 I: Validating libacl1 I: Retrieving adduser I: Validating adduser : : I: Configuring debian-archive-keyring... I: Configuring apt... I: Configuring libept1... I: Configuring apt-utils... I: Configuring aptitude... I: Configuring tasksel-data... I: Configuring tasksel... I: Base system installed successfully. + date Mon Jan 3 14:20:50 JST 2011 + mkdir /mnt/disk1/debinst/initrd + echo deb-src http://ftp.jp.debian.org/debian squeeze main + echo + echo deb http://security.debian.org/ squeeze/updates main + echo deb-src http://security.debian.org/ squeeze/updates main + chroot /mnt/disk1/debinst apt-get update Get:1 http://ftp.jp.debian.org squeeze Release.gpg [835 B] Ign http://ftp.jp.debian.org/debian/ squeeze/main Translation-en Hit http://ftp.jp.debian.org squeeze Release Get:2 http://ftp.jp.debian.org squeeze/main Sources [4834 kB] Get:3 http://security.debian.org squeeze/updates Release.gpg [835 B] Ign http://security.debian.org/ squeeze/updates/main Translation-en Get:4 http://security.debian.org squeeze/updates Release [44.6 kB] Get:5 http://ftp.jp.debian.org squeeze/main armel Packages/DiffIndex [2038 B] Get:6 http://security.debian.org squeeze/updates/main Sources [7582 B] Get:7 http://security.debian.org squeeze/updates/main armel Packages [40.0 kB] Fetched 4930 kB in 6s (807 kB/s) Reading package lists... Done + chroot /mnt/disk1/debinst apt-get -y -f install Reading package lists... Done Building dependency tree... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. + chroot /mnt/disk1/debinst apt-get -y upgrade Reading package lists... Done Building dependency tree... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. + chroot /mnt/disk1/debinst apt-get -y install makedev Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: makedev 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 42.4 kB of archives. After this operation, 152 kB of additional disk space will be used. Get:1 http://ftp.jp.debian.org/debian/ squeeze/main makedev all 2.3.1-89 [42.4 kB] Fetched 42.4 kB in 0s (341 kB/s) Can not write log, openpty() failed (/dev/pts not mounted?) Selecting previously deselected package makedev. (Reading database ... 8457 files and directories currently installed.) Unpacking makedev (from .../makedev_2.3.1-89_all.deb) ... update-rc.d: using dependency based boot sequencing Processing triggers for man-db ... Can not write log, openpty() failed (/dev/pts not mounted?) Setting up makedev (2.3.1-89) ... .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. + mkdir /mnt/disk1/debinst/tmp/dev + chroot /mnt/disk1/debinst sh -c 'mount -t proc /proc proc ; cd /tmp/dev ; MAKEDEV generic ; umount /proc' + cd /mnt/disk1/debinst/tmp/dev + tar cf - atibm audio audio1 audio2 audio3 audioctl console core dsp dsp1 dsp2 dsp3 fb0 fb1 fb2 fb3 fb4 fb5 fb6 fb7 fd fd0 fd0CompaQ fd0d360 fd0h1200 fd0h1440 fd0h1476 fd0h1494 fd0h1600 fd0h360 fd0h410 fd0h420 fd0h720 fd0h880 fd0u1040 fd0u1120 fd0u1440 fd0u1600 fd0u1680 fd0u1722 fd0u1743 fd0u1760 fd0u1840 fd0u1920 fd0u2880 : : xdb7 xdb8 zero Package configuration lqqqqqqqqqqqqqqqqqqqqqqqu Configuring tzdata tqqqqqqqqqqqqqqqqqqqqqqqk x Please select the city or region corresponding to your time zone. x x x x Time zone: x x x x Muscat x x Nicosia a x x Novokuznetsk a x x Novosibirsk a x x Omsk a x x Oral a x x Phnom_Penh a x x Pontianak a x x Pyongyang a x x Qatar a x x Qyzylorda a x x Rangoon a x x Riyadh a x x Riyadh87 a x x Riyadh88 a x x Riyadh89 a x x Sakhalin a x x Samarkand a x x Seoul a x x Shanghai a x x Singapore a x x Taipei a x x Tashkent a x x Tbilisi a x x Tehran a x x Tel_Aviv a x x Thimphu a x x Tokyo a x x Ujung_Pandang a x x Ulaanbaatar a x x Urumqi x x Vientiane a x x Vladivostok a x x Yakutsk a x x Yekaterinburg a x x Yerevan x x x x x x <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj + rm -fr /mnt/disk1/debinst/tmp/dev + TARGETFILE=/mnt/disk1/debinst/etc/inittab + mv /mnt/disk1/debinst/etc/inittab /mnt/disk1/debinst/etc/inittab.orig + sed -e 's/^\([0-9]:[0-9]*:respawn:.*\)$/#\1/' -e '/^#T1/aT0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' /mnt/disk1/debinst/etc/inittab.orig + TARGETFILE=/mnt/disk1/debinst/etc/default/rcS + mv /mnt/disk1/debinst/etc/default/rcS /mnt/disk1/debinst/etc/default/rcS.orig + sed -e s/UTC=yes/UTC=no/ /mnt/disk1/debinst/etc/default/rcS.orig + chroot /mnt/disk1/debinst dpkg-reconfigure tzdata Current default time zone: 'Asia/Tokyo' Local time is now: Mon Jan 3 14:22:47 JST 2011. Universal Time is now: Mon Jan 3 05:22:47 UTC 2011. + chroot /mnt/disk1/debinst apt-get -y install xfsprogs locales psmisc inetutils-telnetd smartmontools less nkf ftp Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: heirloom-mailx inetutils-inetd libcap-ng0 libdb4.7 libfile-copy-recursive-perl libgcrypt11 libgnutls26 libgpg-error0 libgssapi-krb5-2 libidn11 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libreadline5 libshishi0 libtasn1-3 libwrap0 perl perl-modules shishi-common tcpd update-inetd Suggested packages: exim4 mail-transport-agent rng-tools gnutls-bin krb5-doc krb5-user shishi perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl make gsmartcontrol smart-notifier xfsdump acl attr quota Recommended packages: mailx mailutils The following NEW packages will be installed: ftp heirloom-mailx inetutils-inetd inetutils-telnetd less libcap-ng0 libdb4.7 libfile-copy-recursive-perl libgcrypt11 libgnutls26 libgpg-error0 libgssapi-krb5-2 libidn11 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libreadline5 libshishi0 libtasn1-3 libwrap0 locales nkf perl perl-modules psmisc shishi-common smartmontools tcpd update-inetd xfsprogs 0 upgraded, 31 newly installed, 0 to remove and 0 not upgraded. Need to get 17.9 MB of archives. After this operation, 56.8 MB of additional disk space will be used. Get:1 http://ftp.jp.debian.org/debian/ squeeze/main ftp armel 0.17-23 [59.2 kB] Get:2 http://ftp.jp.debian.org/debian/ squeeze/main less armel 436-1+b1 [121 kB] Get:3 http://ftp.jp.debian.org/debian/ squeeze/main libdb4.7 armel 4.7.25-9 [595 kB] : : Setting up shishi-common (1.0.0-1) ... Setting up libshishi0 (1.0.0-1) ... Setting up perl-modules (5.10.1-16) ... Setting up perl (5.10.1-16) ... update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode. Setting up libfile-copy-recursive-perl (0.38-1) ... Setting up update-inetd (4.38) ... Setting up inetutils-inetd (2:1.6-3) ... Not starting internet superserver: no services enabled. ... (warning). Setting up inetutils-telnetd (2:1.6-3) ... + chroot /mnt/disk1/debinst dpkg-reconfigure locales Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk x Locales are a framework to switch between multiple languages and allow x x users to use their language, country, characters, collation order, etc. x x x x Please choose which locales to generate. UTF-8 locales should be chosen x x by default, particularly for new installations. Other character sets may x x be useful for backwards compatibility with older systems and software. x x x x Locales to be generated: x x x x [ ] iw_IL ISO-8859-8 x x [ ] iw_IL.UTF-8 UTF-8 a x x [*] ja_JP.EUC-JP EUC-JP a x x [*] ja_JP.UTF-8 UTF-8 a x x [ ] ka_GE GEORGIAN-PS a x x [ ] ka_GE.UTF-8 UTF-8 a x x [ ] kk_KZ PT154 a x x x x x x <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk x Many packages in Debian use locales to display text in the correct x x language for the user. You can choose a default locale for the system x x from the generated locales. x x x x This will select the default language for the entire system. If this x x system is a multi-user system where not all users are able to speak the x x default language, they will experience difficulties. x x x x Default locale for the system environment: x x x x None x x ja_JP.EUC-JP x x ja_JP.UTF-8 x x x x x x <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj Generating locales (this might take a while)... ja_JP.EUC-JP... done ja_JP.UTF-8... done Generation complete. + TARGETFILE=/mnt/disk1/debinst/etc/inetd.conf + mv /mnt/disk1/debinst/etc/inetd.conf /mnt/disk1/debinst/etc/inetd.conf.orig + sed -e 's/^## telnet/telnet/' /mnt/disk1/debinst/etc/inetd.conf.orig + chroot /mnt/disk1/debinst passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully + chroot /mnt/disk1/debinst adduser --gecos '' guest Adding user `guest' ... Adding new group `guest' (1000) ... Adding new user `guest' (1000) with group `guest' ... Creating home directory `/home/guest' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully + rm -fr /mnt/disk1/debinst/home/guest + chroot /mnt/disk1/debinst apt-get clean root@LS-VL815:/mnt/disk1/share/hackkit#
root@LS-VL815:~# cd /mnt/disk1/debinst/ root@LS-VL815:/mnt/disk1/debinst# ls bin etc lib opt sbin sys var boot home media proc selinux tmp dev initrd mnt root srv usr root@LS-VL815:/mnt/disk1/debinst#できている
root@LS-VL815:/mnt/disk1/debinst# cat etc/apt/sources.list deb http://ftp.jp.debian.org/debian squeeze main deb-src http://ftp.jp.debian.org/debian squeeze main deb http://security.debian.org/ squeeze/updates main deb-src http://security.debian.org/ squeeze/updates main root@LS-VL815:/mnt/disk1/debinst#OK
root@LS-VL815:/mnt/disk1/debinst# ls dev atibm hdh12 psaux ram13 sdp14 ttyt3 audio hdh13 ptmx ram14 sdp15 ttyt4 : : hdh10 par2 ram11 sdp12 ttyt1 hdh11 port ram12 sdp13 ttyt2 root@LS-VL815:/mnt/disk1/debinst#OK
root@LS-VL815:/mnt/disk1/debinst# diff etc/inittab{,.orig} --- etc/inittab Mon Jan 3 14:22:38 2011 +++ etc/inittab.orig Mon Nov 15 07:42:29 2010 @@ -51,18 +51,17 @@ # Note that on most Debian systems tty7 is used by the X Window System, # so if you want to add more getty's go ahead but skip tty7 if you run X. # -#1:2345:respawn:/sbin/getty 38400 tty1 -#2:23:respawn:/sbin/getty 38400 tty2 -#3:23:respawn:/sbin/getty 38400 tty3 -#4:23:respawn:/sbin/getty 38400 tty4 -#5:23:respawn:/sbin/getty 38400 tty5 -#6:23:respawn:/sbin/getty 38400 tty6 +1:2345:respawn:/sbin/getty 38400 tty1 +2:23:respawn:/sbin/getty 38400 tty2 +3:23:respawn:/sbin/getty 38400 tty3 +4:23:respawn:/sbin/getty 38400 tty4 +5:23:respawn:/sbin/getty 38400 tty5 +6:23:respawn:/sbin/getty 38400 tty6 # Example how to put a getty on a serial line (for a terminal) # #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100 -T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 # Example how to put a getty on a modem line. # root@LS-VL815:/mnt/disk1/debinst#OK
root@LS-VL815:/mnt/disk1/debinst# diff etc/default/rcS{.orig,} --- etc/default/rcS.orig Mon Nov 15 07:39:06 2010 +++ etc/default/rcS Mon Jan 3 14:22:38 2011 @@ -10,7 +10,7 @@ TMPTIME=0 SULOGIN=no DELAYLOGIN=no -UTC=yes +UTC=no VERBOSE=no FSCKFIX=no RAMRUN=no root@LS-VL815:/mnt/disk1/debinst#
root@LS-VL815:/mnt/disk1/debinst# diff etc/inetd.conf{.orig,} --- etc/inetd.conf.orig Mon Jan 3 14:53:23 2011 +++ etc/inetd.conf Mon Jan 3 14:54:25 2011 @@ -20,7 +20,7 @@ #time stream tcp nowait root internal #:STANDARD: These are standard services. -#<off># telnet stream tcp nowait root /usr/sbin/telnetd telnetd +telnet stream tcp nowait root /usr/sbin/telnetd telnetd #:BSD: Shell, login, exec and talk are BSD protocols. root@LS-VL815:/mnt/disk1/debinst#OK
ここまで、スクリプトの修正と実行を何回も繰り返したのは内緒。
root@LS-VL815:/mnt/disk1/debinst# tar zcvf /mnt/disk1/share/hackkit/hackkit_squeeze_110103.tar.gz . ./ ./var/ ./var/lib/ ./var/lib/apt/ ./var/lib/apt/lists/ ./var/lib/apt/lists/partial/ ./var/lib/apt/lists/ftp.jp.debian.org_debian_dists_squeeze_Release ./var/lib/apt/lists/ftp.jp.debian.org_debian_dists_squeeze_main_binary-armel_Packages : : ./selinux/ ./sys/ ./srv/ ./opt/ ./media/ ./initrd/ root@LS-VL815:/mnt/disk1/debinst#できあがり
← Squeeze のインストール(15)ファンコントロール |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ lenny で smartctl |