Skip to content

Instantly share code, notes, and snippets.

@fcwu
Created July 26, 2013 09:54
Show Gist options
  • Save fcwu/6087697 to your computer and use it in GitHub Desktop.
Save fcwu/6087697 to your computer and use it in GitHub Desktop.
dell-recovery phase 2 patch. Please put it into scripts/chroot-scripts/os-post/99-kylin.sh
#!/bin/dash
set -e
WDIR=/tmp/kylin
rm -rf ${WDIR}
Exit ()
{
echo "cleanup"
#umount ${WDIR}/recovery || true
}
echo "kylin-initrd.sh"
mkdir -p ${WDIR}/ramdisk
cd ${WDIR}
if ! mount -o rw,remount /cdrom; then
echo "Failed to mount sda2"
exit 1
fi
trap 'Exit' EXIT HUP INT QUIT TERM
cd ${WDIR}/ramdisk/ && lzma -dc -S .lz /cdrom/casper/initrd* | cpio -imd --no-absolute-filenames
[ -e ${WDIR}/ramdisk/scripts/casper-bottom/99kylin ] && echo "already patched" && exit 0
echo "start to patch"
cat > ${WDIR}/ramdisk/scripts/casper-bottom/99kylin <<EOF
#!/bin/sh
PREREQ=""
DESCRIPTION="Running kylin bootstrap..."
prereqs ()
{
echo "\$PREREQ"
}
case \$1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /scripts/casper-functions
load_confmodule
log_begin_msg "\$DESCRIPTION"
#chroot /root apt-cdrom -d /cdrom add
#chroot /root apt-get update
chroot /root apt-get -y install ubiquity ubiquity-slideshow-ubuntu ubuntukylin-theme ubuntukylin-wallpapers
EOF
chmod +x ${WDIR}/ramdisk/scripts/casper-bottom/99kylin
cat >> ${WDIR}/ramdisk/scripts/casper-bottom/ORDER << EOF
/scripts/casper-bottom/99kylin
[ -e /conf/param.conf ] && . /conf/param.conf
EOF
cd ${WDIR}/ramdisk/ && find . | cpio --quiet --dereference -o -H newc | lzma -7 > /cdrom/casper/initrd.lz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment