View Single Post
Old 08-26-2017, 03:01 AM   #1
zaoqi
github.com/zaoqi
zaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beautyzaoqi does all things with Zen-like beauty
 
Posts: 87
Karma: 32020
Join Date: Mar 2017
Location: - Zhejiang China
Device: Boox c67ml,Note S,Max2,KT3,KPW4,Kobo AurdHD,Touch N905C
Ubuntu on KT3 without *.ext3

STEP 1:
Copy get.sh, inst.x.*.sh, chroot.sh to Kindle
STEP 2
STEP 3:
Code:
/mnt/us/get.sh
/mnt/us/inst.x.*.sh
STEP 4: Chroot into ubuntu
Code:
/mnt/us/chroot.sh
get.sh
Code:
#!/bin/sh
root=/mnt/base-us/root
mkdir -p $root
wget -O - "http://cdimage.ubuntu.com/ubuntu-base/releases/17.04/release/ubuntu-base-17.04-base-armhf.tar.gz" | tar -xzvf - -C $root
inst.x.xfce4.zh.CN.sh
Code:
#!/bin/sh
root=/mnt/base-us/root
cat > $root/root/inst.sh << 'EOF'
apt update
apt install -f -y
apt full-upgrade -y
apt install -y locales
sed -i '/zh_CN.UTF-8/s/^#//' /etc/locale.gen
locale-gen zh_CN.UTF-8
apt install -y xserver-xephyr xfce4 onboard xfce4-terminal fonts-wqy-microhei fcitx-googlepinyin
EOF
#APT::Install-Recommends "0";
#APT::Install-Suggests "0";
cat >> $root/etc/apt/apt.conf << 'EOF'
APT::Sandbox::User root;
EOF
cat > $root/usr/local/bin/start-x-flip << 'EOF'
#!/bin/bash
export DISPLAY=:0
Xephyr :1 -title "L:A_N:application_ID:xephyr_O:R_PC:N" -screen 800x600 -cc 4 -dpi 167 -nocursor &
sleep 3
export DISPLAY=:1
startxfce4
EOF
mkdir -p $root/usr/share/applications/
cat > $root/usr/share/applications/stopx.desktop << 'EOF'
[Desktop Entry]
Categories=Network;InstantMessaging;GTK;GNOME;
Name=Stop X
Version=1.0
Exec=killall Xephyr xfce4-session
Terminal=false
Type=Application
EOF

chmod +x $root/root/inst.sh
chmod +x $root/usr/local/bin/start-x-flip

/mnt/us/chroot.sh /root/inst.sh

rm $root/root/inst.sh
chroot.sh
Code:
#!/bin/sh
root=/mnt/base-us/root
for d in dev dev/pts proc sys ;do
	mount -o bind /$d $root/$d || exit
done
temp="$(mktemp -d)"
mount -o bind "$temp" $root/tmp || exit
cp /etc/hostname /etc/hosts /etc/resolv.conf $root/etc/
shell=/bin/sh
if [ -f $root/bin/bash ] ;then
	shell=/bin/bash
fi
if [ -n "$1" ] ;then
	shell="$1"
fi
HOME=/root chroot $root $shell
for d in dev/pts dev proc sys tmp ;do
	umount $root/$d
done
rm -fr "$temp"
zaoqi is offline   Reply With Quote