login.sh
#!/bin/sh CHROOT=$(dirname "$0") CHMODE=$1 CHUSER=$2 my_usage(){ echo "usage: login [cli|lxde] [root|user]" } my_mount(){ mount -o remount,rw,auto,sync,suid "$CHROOT" mount -o bind /dev "$CHROOT/dev" mount -o bind /sys "$CHROOT/sys" mount -o bind /proc "$CHROOT/proc" mount -o bind /dev/pts "$CHROOT/dev/pts" mount -o bind /dev/shm "$CHROOT/dev/shm" mount -o bind /etc/group "$CHROOT/etc/group" } my_umount(){ umount "$CHROOT/sys" umount "$CHROOT/proc" umount "$CHROOT/dev/pts" umount "$CHROOT/dev/shm" umount "$CHROOT/dev" umount "$CHROOT/etc/group" } if [ `whoami` != "root" ] ; then echo "run me as root !" my_usage() exit 1 fi if [ "$CHMODE" != "cli" ] && [ "$CHMODE" != "lxde" ] ; then echo "only support cli and lxde mode !" my_usage() exit 2 fi my_umount > /dev/null 2>&1 my_mount if [ "$CHMODE" == "lxde" ] ; then DISPLAY=:0.0 export DISPLAY xhost + chroot $CHROOT su - "$CHUSER" -c 'startlxde' killall lxpanel killall pcmanfm else chroot $CHROOT su - "$CHUSER" fi my_umount > /dev/null 2>&1 exit 0
P.S. 將login.sh放到Debian系統根目錄下
使用如下指令執行Debian系統:
$ sudo xxx/login lxde user
進入Debian系統後,從Debian Terminal執行如下命令,否則會遇到dpkg: unrecoverable fatal error
$ sudo umount /etc/group $ sudo vim /etc/resolv.conf nameserver 8.8.8.8
中文輸入法(scim)
$ XMODIFIERS=@im=SCIM GTK_IM_MODULE=scim QT4_IM_MODULE=scim leafpad
中文輸入法(ibus),執行ibus service就可以