Installing Debian as an upgrade/script: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (Reverted edits by Vandal (Talk); changed back to last version by 65.75.18.227)
(changed the shebang to bash as it uses bashisms)
Line 5: Line 5:
<pre>
<pre>
<nowiki>
<nowiki>
#!/bin/sh -ex
#!/bin/bash -ex


tgz_url="http://dev.laptop.org/~cscott/xo-debian.tgz"
tgz_url="http://dev.laptop.org/~cscott/xo-debian.tgz"

Revision as of 21:46, 10 August 2008

The following script, which only follows the instructions on Installing Debian as an upgrade, should install Debian on your XO. Just copy/paste it into a file on the XO, chmod +x, and run. I just tested it, and it worked. YMMV. It will stop midway if there is any error, including in the wget image download.

By the way, it's totally unsafe to run code from a wiki like this without reading it.


#!/bin/bash -ex

tgz_url="http://dev.laptop.org/~cscott/xo-debian.tgz"

cd /versions/pristine
mkdir debian
cd debian

# wget -O- "$tgz_url" | tar xz
wget -q -O- "$tgz_url" | tar xvz

cp /etc/{hosts,fstab} /versions/pristine/debian/etc/
cp -r /lib/modules/* /versions/pristine/debian/lib/modules
cp -r /lib/firmware/* /versions/pristine/debian/lib/firmware
mkdir -p /versions/pristine/debian/{versions,security,var/cache/apt/cache}
rm -rf /versions/pristine/debian/boot
cp -r /boot /versions/pristine/debian

cat <<END > /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh
#! /bin/sh
mount -t sysfs /sys /sys
echo 0 > /sys/devices/platform/dcon/freeze
umount /sys
END

chmod a+rx /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh

echo 'tmpfs   /var/cache/apt/cache  tmpfs defaults 0 0' >> /versions/pristine/debian/etc/fstab 

cat <<END > /versions/pristine/debian/etc/apt/apt.conf.d/00-tmpfs-cache
 Dir {
  Cache "var/cache/apt/" {
   srcpkgcache "cache/srcpkgcache.bin";
   pkgcache "cache/pkgcache.bin";
  };
 };
END

cd /versions/boot
rm -rf alt
ln -s /versions/pristine/debian alt
cp -rl /versions/pristine/debian /versions/run/debian
/usr/sbin/setattr -R --iunlink /versions/run/debian
echo 'Debian is installed!  Reboot and hold down the game key labelled "O"'