lupin/0000755000000000000000000000000012243426527007102 5ustar lupin/locale/0000755000000000000000000000000011015504505010326 5ustar lupin/locale/hooks/0000755000000000000000000000000011542174352011461 5ustar lupin/locale/hooks/root_locale0000755000000000000000000000221411542174352013710 0ustar #! /bin/sh set -e # Adds support for the system default locale to the initramfs # and stores the locale name in the initramfs /conf/conf.d/root_locale # so that the premount script can pick it up through $ROOT_LOCALE PREREQ="" prereqs () { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions CONF="$DESTDIR/conf/conf.d/root_locale" # Accept overrides but will rewrite the initramfs conf file anyway [ -r $CONF ] && . $CONF rm -f $CONF # Base the locale on the system default LANG and mangle it as # needed to match the /usr/lib/locale naming. [ -r /etc/default/locale ] && . /etc/default/locale [ -z "$ROOT_LOCALE" ] && ROOT_LOCALE=`echo $LANG | sed -e 's/UTF/utf/' -e 's/utf-8/utf8/'` if [ -n "$ROOT_LOCALE" ] && [ -d /usr/lib/locale/$ROOT_LOCALE ]; then [ "${verbose}" = "y" ] && echo "Adding locale: $ROOT_LOCALE" mkdir -p "$DESTDIR/usr/lib/locale" cp -r /usr/lib/locale/$ROOT_LOCALE "$DESTDIR/usr/lib/locale" echo "ROOT_LOCALE=$ROOT_LOCALE" > $CONF echo "export ROOT_LOCALE" >> $CONF echo "export FSTYPE" >> $CONF else echo "Warning: No support for locale: $ROOT_LOCALE" >&2 fi exit 0 lupin/locale/scripts/0000755000000000000000000000000011015504505012015 5ustar lupin/locale/scripts/local-premount/0000755000000000000000000000000011015504505014756 5ustar lupin/locale/scripts/local-premount/root_locale0000755000000000000000000000044411015504505017210 0ustar #! /bin/sh case $1 in prereqs) exit 0 ;; esac if [ "$FSTYPE" = "ntfs" ] && [ -n "$ROOT_LOCALE" ]; then if [ -z "${ROOTFLAGS}" ]; then ROOTFLAGS="-o " else ROOTFLAGS="${ROOTFLAGS}," fi echo ROOTFLAGS=\"${ROOTFLAGS}locale=$ROOT_LOCALE\" >> /conf/param.conf fi exit 0 lupin/debian/0000755000000000000000000000000012243426570010322 5ustar lupin/debian/lupin-support.preinst0000644000000000000000000000022111271305264014560 0ustar #! /bin/sh set -e dpkg-divert --package lupin-support --divert /usr/sbin/grub-install.real --rename /usr/sbin/grub-install #DEBHELPER# exit 0 lupin/debian/lupin-casper.install0000644000000000000000000000012011035117267014303 0ustar casper/hooks usr/share/initramfs-tools casper/scripts usr/share/initramfs-tools lupin/debian/lupin-support.mounthost.init0000755000000000000000000000531111003342164016077 0ustar #! /bin/sh # /etc/init.d/mounthost: Remount /host folder read write # # Written by Agostino Russo based on checkroot.sh # ### BEGIN INIT INFO # Provides: mounthost # Required-Start: mountdevsubfs # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Remount /host folder read write. ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting host filesystem read-write" hosttype=none hostopts=defaults hostmode=rw hostcheck=no host_mountpoint= host_device= loop_file= ES=$? #Find loopmounted root in fstab while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK;do [ -z "${DEV%%#*}" ] || [ ! "$MTPT" = "/" ] && continue [ "${OPTS#*loop}" = "$OPTS" ] && continue case "$OPTS" in ro|ro,*|*,ro|*,ro,*) hostmode=ro;; esac host_mountpoint="$DEV" loop_file="$DEV" break done < /etc/fstab [ "$loop_file" ] || exit 0 #Find host device host_device= while [ -n "$host_mountpoint" ]; do while read DEV MTPT FSTYPE OPTS REST; do if [ "$MTPT" = "$host_mountpoint" ]; then host_device=$DEV break fi done < /proc/mounts host_mountpoint="${host_mountpoint%/*}" [ -z "$host_device" ] || break done #Remount hostdevice if [ -n "$host_device" ]; then if [ "$hostcheck" = yes ]; then if \ ! mount -n -o remount,ro "$host_device" /host \ && ! mount -n -o remount,ro -t dummytype "$host_device" /host 2>/dev/null \ && ! mount -n -o remount,ro "$host_device" /host 2>/dev/null then log_failure_msg "Cannot check host file system because it is not mounted read-only." rootcheck=no fi #TBD add fs checking #skipping since not supported by ntfs-3g fi mount -n -o remount,$hostopts,$hostmode "$host_device" /host ES=$? #make sure that the loopdevice is also set rw/ro if [ -f "$loop_file" ]; then loop_device=$(losetup -a | grep "($loop_file)") loop_device=${loop_device%%:*} if [ -b "$loop_device" ]; then blockdev --set$hostmode "$loop_device" || true fi fi fi [ "$VERBOSE" = no ] || log_action_end_msg "$ES" } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac exit 0 lupin/debian/lupin-support.postrm0000644000000000000000000000064711271305265014435 0ustar #!/bin/sh set -e case "$1" in remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) if dpkg --compare-versions "$2" lt 0.26; then dpkg-divert --package lupin-support --rename --remove /usr/sbin/grub-install fi update-initramfs -u ;; purge) update-initramfs -u ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 lupin/debian/rules0000755000000000000000000000003611252022212011361 0ustar #! /usr/bin/make -f %: dh $@ lupin/debian/copyright0000644000000000000000000000166310665310753012264 0ustar Copyright (C) 2007 Agostino Russo . Packaged by Colin Watson . Licence: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. lupin/debian/lupin-support.install0000644000000000000000000000044012243217775014556 0ustar locale/hooks usr/share/initramfs-tools locale/scripts usr/share/initramfs-tools grub.d etc grub-install/grub-mkimage /usr/share/lupin-support grub-install/grub-install /usr/sbin grub-install/newns /usr/lib/lupin-support scripts usr/share/initramfs-tools/ hooks usr/share/initramfs-tools/ lupin/debian/compat0000644000000000000000000000000211252022215011503 0ustar 7 lupin/debian/control0000644000000000000000000000231212243426447011726 0ustar Source: lupin Section: misc Priority: extra Maintainer: Agostino Russo Uploaders: Colin Watson Build-Depends: debhelper (>= 7) Standards-Version: 3.9.3 Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-installer/lupin/hardy Package: lupin-casper Architecture: all Depends: ${misc:Depends}, initramfs-tools (>= 0.40ubuntu11), casper (>= 0.98) Description: Add support for loop-mount installations to casper The Wubi installer provides a means for installing Ubuntu into a loop-mounted filesystem image hosted on a Windows filesystem. lupin-casper provides hooks to find an ISO image on a hard disk and to read a preseed file from a hard disk, which are used in the early part of this process. Package: lupin-support Architecture: any-i386 any-amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, procps, lsb-base (>= 3.0-6), user-setup, grub-common (>= 2.00-5) Breaks: grub-pc (<< 1.99~20101122-1) Description: Support files for loop-mount installations The Wubi installer provides a means for installing Ubuntu into a loop-mounted filesystem image hosted on a Windows filesystem. lupin-support provides a few extra files needed in such installations to make them work well. lupin/debian/changelog0000644000000000000000000004014212243426566012202 0ustar lupin (0.55) trusty; urgency=low * Rewrite /usr/share/lupin-support/grub-install to avoid depending on being able to call the real grub-install with --grub-mkimage and --grub-probe options, which stopped working when it was rewritten in C on 2013-11-16. -- Colin Watson Thu, 21 Nov 2013 15:57:28 +0000 lupin (0.54) saucy; urgency=low [ James M Leddy ] * casper-premount/20iso-scan: Don't panice the system if try_mount function returns error when it encount a CD/DVD device does not have any meidum or a partition has a file system does not be supported by kernel. This should not panic the system because the target file could be in other devices. (LP: #670096) * debian/control: bump standards version. -- Steve Langasek Mon, 13 May 2013 22:44:04 -0500 lupin (0.53) quantal; urgency=low * Only build lupin-support on architectures that also have grub-pc. -- Colin Watson Thu, 04 Oct 2012 17:20:11 +0100 lupin (0.52) quantal; urgency=low * Sync up /etc/grub.d/10_lupin with the version of /etc/grub.d/10_linux in GRUB 2.00. -- Colin Watson Mon, 01 Oct 2012 14:45:00 +0100 lupin (0.51) precise; urgency=low * Never use 'set gfxpayload=keep' in recovery mode (LP: #916209). -- Colin Watson Wed, 18 Jan 2012 16:32:40 +0000 lupin (0.50) precise; urgency=low * Bring /etc/grub.d/10_lupin recovery mode into sync with recent Ubuntu-specific changes to /etc/grub.d/10_linux (LP: #889650): - Add "nomodeset". - Replace "single" by "recovery" if friendly-recovery is installed. -- Colin Watson Sun, 13 Nov 2011 00:48:26 +0000 lupin (0.49) oneiric; urgency=low * Fix broken patch in previous upload. -- Evan Dandrea Fri, 30 Sep 2011 16:27:13 +0100 lupin (0.48) oneiric; urgency=low * Fix globbing on copying the language support note in Wubi disk images (LP: #863053). Thanks Jean-Baptiste Lallement! -- Evan Dandrea Fri, 30 Sep 2011 10:26:36 +0100 lupin (0.47) oneiric; urgency=low * Fix a typo that was preventing the timezone from getting set in Wubi disk image installs (LP: #855287). * Provide a warning that the desktop is not localized and that Language Support needs to be run, for Wubi disk image installs in languages other than English (LP: #855295). -- Evan Dandrea Thu, 22 Sep 2011 12:20:19 +0100 lupin (0.46) oneiric; urgency=low * Provide the Wubi system with swap space when using a disk image. -- Evan Dandrea Wed, 21 Sep 2011 15:28:07 +0100 lupin (0.45) oneiric; urgency=low * Don't try to bind mount /root/host, as it's already done. -- Evan Dandrea Tue, 20 Sep 2011 11:38:57 +0100 lupin (0.44) oneiric; urgency=low * Better error handling in grub-mkimage wrapper. -- Evan Dandrea Mon, 15 Aug 2011 16:05:19 +0100 lupin (0.43) oneiric; urgency=low * Add missing configfile module to wubildr. -- Evan Dandrea Tue, 09 Aug 2011 10:04:41 +0100 lupin (0.42) oneiric; urgency=low * Pipe preseed file from the correct location. -- Evan Dandrea Tue, 02 Aug 2011 15:33:40 +0100 lupin (0.41) oneiric; urgency=low * Add necessary modules for disk image first boot. -- Evan Dandrea Tue, 02 Aug 2011 15:21:11 +0100 lupin (0.40) oneiric; urgency=low * Add a plymouth message. * Properly use the noninteractive frontend. * Bind-mount /host for update-grub. * Add hostname. * Match addition of wubildr-disk.cfg disk install grub configuration from Wubi. -- Evan Dandrea Wed, 27 Jul 2011 11:00:41 +0100 lupin (0.39) oneiric; urgency=low * Support setting up Wubi from the initramfs in disk image installs. -- Evan Dandrea Tue, 26 Jul 2011 20:39:25 +0100 lupin (0.38) oneiric; urgency=low * Include the probe module for grub. -- Evan Dandrea Tue, 26 Jul 2011 20:30:35 +0100 lupin (0.37) oneiric; urgency=low * Use a slightly more modular GRUB core image; there's no reason why things like loader and video modules need to be in the core when they can be loaded from (loop0)/boot/grub instead. This saves us having to keep track of new modules required by the default grub.cfg. We still need enough modules to find /boot/grub and to execute our bootstrap configuration file. -- Colin Watson Tue, 21 Jun 2011 13:22:20 +0100 lupin (0.36) oneiric; urgency=low * Add the gzio module to the wubildr image, since normal.mod loads it unconditionally nowadays. -- Colin Watson Tue, 21 Jun 2011 10:07:43 +0100 lupin (0.35) oneiric; urgency=low * Bring /etc/grub.d/10_lupin up to date with /etc/grub.d/10_linux (LP: #771732): - Enable menu entry translation. - Set classes for the benefit of gfxmenu themes. - Handle rootflags for btrfs. - Add vt.handoff=7 if a splash screen is active. - Don't save a new default entry if recovery mode is selected. - Set gfxpayload=keep unless the hardware is blacklisted. - Cache commands required to access /boot. - Print extra debugging messages in recovery mode. - Move second and subsequent kernels to a submenu. - Check GRUB_DISABLE_RECOVERY rather than GRUB_DISABLE_LINUX_RECOVERY. -- Colin Watson Wed, 25 May 2011 15:09:10 +0100 lupin (0.34) natty; urgency=low * Use 'set -e' rather than '#! /bin/sh -e', to avoid accidents when debugging with 'sh -x'. * Fix output of '/usr/share/lupin-support/grub-probe --target=partmap' to be 'msdos' rather than 'part_msdos'. * Detect the case where Wubi's disk images were installed to a different partition from Windows, which means that wubildr will not be on /host: update all wubildr images we can find (LP: #610898). * Add the vbe, vga, video_bochs, and video_cirrus modules to the wubildr image. -- Colin Watson Wed, 06 Apr 2011 16:23:13 +0100 lupin (0.33) natty; urgency=low * Add the true module to the wubildr image, to support our default configuration file. -- Colin Watson Fri, 11 Mar 2011 13:25:30 +0000 lupin (0.32) maverick; urgency=low * Add the font, gfxterm, and gettext modules to the wubildr image, to support our default configuration file (LP: #653134). -- Colin Watson Mon, 04 Oct 2010 16:40:23 +0100 lupin (0.31) maverick; urgency=low * wubildr.cfg needs to be run using GRUB's normal parser rather than its rescue parser. Rather than embedding it directly as a configuration file, embed it as a memdisk and add wubildr-bootstrap.cfg which invokes it using normal mode (LP: #617715). -- Colin Watson Thu, 02 Sep 2010 12:23:00 +0100 lupin (0.30) maverick; urgency=low * Pass new -O option to grub-mkimage (see Debian #584415). * Include normal.mod rather than sh.mod, due to upstream changes on 2010-06-10. -- Colin Watson Wed, 16 Jun 2010 17:28:08 +0100 lupin (0.29) lucid; urgency=low * Fix infinite loop if there's no initrd (LP: #540579). -- Colin Watson Tue, 23 Mar 2010 09:16:15 +0000 lupin (0.28) lucid; urgency=low * Don't corrupt wubildr if grub-mkimage is interrupted. * Fix /etc/grub.d/10_lupin to handle separate /boot (thanks, Mark Abene; LP: #477104). * Handle separate /boot in grub-mkimage, based on a patch from Mark Abene (LP: #477104). * Source /scripts/casper-functions only after processing 'prereqs' argument, to avoid warnings with new initramfs-tools. -- Colin Watson Fri, 19 Mar 2010 19:11:03 +0000 lupin (0.27) karmic; urgency=low * Support ext4 in lupin-helpers, since it's now the default filesystem (thanks, Kano; LP: #460740). -- Colin Watson Mon, 26 Oct 2009 12:10:05 +0000 lupin (0.26) karmic; urgency=low * Divert grub-install and replace it with a wrapper that upgrades wubildr if running in a loop-mounted installation (LP: #460192). -- Colin Watson Mon, 26 Oct 2009 11:46:07 +0000 lupin (0.25) karmic; urgency=low * Put lupin-waited-for-devs state file in /dev/.initramfs; there's no /var/run in the initramfs. -- Colin Watson Wed, 23 Sep 2009 15:23:04 +0100 lupin (0.24) karmic; urgency=low * Call update-grub on lupin-support installation. This is needed for fresh Wubi installs, since lupin-support is installed after grub-installer runs. -- Colin Watson Tue, 22 Sep 2009 19:54:28 +0100 lupin (0.23) karmic; urgency=low [ Colin Watson ] * Upgrade to debhelper v7. [ Agostino Russo ] * Added script to upgrade grub (wubildr) on the host, (needs to be hooked) * Added grub.d script to support loopinstallations, the file was contributed by Colin Watson * Removed old lupin sysctl file -- Colin Watson Wed, 16 Sep 2009 17:37:27 +0100 lupin (0.22) intrepid; urgency=low * Disabling lupin-sysctl since its functionality has been replaced by syncio (LP: #204133). Lupin-sysctl is not actively removed if already installed since syncio also requires a change to menu.lst. -- Agostino Russo Thu, 02 Oct 2008 23:27:48 +0100 lupin (0.21) intrepid; urgency=low * Add an initramfs hook to copy scripts/lupin-helpers over. initramfs-tools (>= 0.86) will no longer copy it automatically. -- Colin Watson Wed, 09 Jul 2008 12:26:05 +0100 lupin (0.20) hardy-proposed; urgency=low * Use the absolute path when testing the iso_path. (See LP #226622) -- Agostino Russo Sat, 14 Jun 2008 09:11:28 +0100 lupin (0.19) hardy-proposed; urgency=low [ Agostino Russo ] * Fixed typos (thanks Steve Langasek and JP Vossen) * Do not set LIVEMEDIA_OFFSET if the target is not an (ISO) file. This is a useful check per se', but it is also required to allow using iso_scan to look for iso content such as squashfs which in turn would help with LP: #207137 * Provide a clearer error when required installation files cannot be found (LP: #226622) [ Evan Dandrea ] * Note that you need to reboot twice when using chkdsk. [ Tormod Volden ] * Add locale support to ntfs host filesystems, to keep files and directories with non-C characters (utf) from disappearing. (LP: #136682) -- Evan Dandrea Thu, 29 May 2008 10:53:15 -0400 lupin (0.16) hardy; urgency=low * Tighten /proc/mounts test to avoid e.g. /dev/sda10 matching a search for /dev/sda1, thereby causing partman-auto-loop to operate on the wrong partition (thanks, Agostino Russo; LP: #216161). -- Colin Watson Tue, 22 Apr 2008 15:57:27 +0100 lupin (0.15) hardy; urgency=low * Adjust sysctl calls per comments from Colin King in 204133. -- Evan Dandrea Thu, 10 Apr 2008 10:53:55 -0400 lupin (0.14) hardy; urgency=low * Disable the mounthost initscript. /host is already rw when it runs. -- Evan Dandrea Wed, 09 Apr 2008 09:59:40 -0400 lupin (0.13) hardy; urgency=low [ Colin Watson ] * Remove 'set -x' to make the boot process less verbose. Such things should only be put in place temporarily for debugging, not checked in. [ Agostino Russo ] * Do not use awk in mounthost (LP: #198007) * Do not use awk in lupin-sysctl (thanks to Luke Yelavich for pointing it out) * Do not assume that mounthost has to always remount rw * Try to set the ro/rw status of the loopdevice as well using blockdev (thanks to Colin Watson for the tip) * Add ISO 9660 to is_supported_fs function (LP: #206989) * In mounthost ignore fstab lines that are commented out [ Evan Dandrea ] * Replace use of sed in mounthost and lupin-sysctl with a cleaner loop. -- Evan Dandrea Mon, 07 Apr 2008 11:07:42 -0400 lupin (0.12) hardy; urgency=low * Removed lupin-support/umounthost since it's functionality has been merged upstream within umountroot. * When scanning the devices, repeat the process to give time to devices to appear (LP: #188952) * Cleaned debian rules from old entries * Updated changelog * Replicated local-bottom/ntfs_3g into casper-bottom, in order to ensure that ntfs_3g is not killed by sendsigs (LP: #191036) * Renamed find_iso -> iso-scan/filename (LP: #189630) -- Agostino Russo Mon, 11 Feb 2008 21:59:59 +0000 lupin (0.11) hardy; urgency=low [ Colin Watson ] * Vcs-Bzr is now an official field. Use an unauthenticated URL for it. [ Agostino Russo ] * Added more generic external hooks. * Modified algorithm to detect loopinstallations * Removed ntfs-3g fixes which have ben merged upstream [ Evan Dandrea ] * Pointed VCS-Bzr to the Hardy branch. * Removed custom-installation= option (debian-installer/custom- installation= still exists). * Removed unnecessary debian/ directory files. -- Evan Dandrea Fri, 18 Jan 2008 10:10:14 -0500 lupin (0.10) gutsy; urgency=low [ Agostino Russo ] * Use find command instead of root command in update-grub to go around different grub4dos device mapping ordering * Added mounthost (preliminary) to remount the host device at boot -- Agostino Russo Sun, 20 Oct 2007 23:00:24 +0100 lupin (0.9) gutsy; urgency=low [ Agostino Russo ] * Added init scripts to handle reboot of loopinstallations. * Added patched version of update-grub * Added patch for initramfs-tools to properly set sendsigs.omit -- Agostino Russo Sun, 20 Oct 2007 23:00:24 +0100 lupin (0.8) gutsy; urgency=low [ Agostino Russo ] * Added importing of override_files, so that external files can be used by early_command (once that is supported). * Removed importing of early_command, late_command and packages, to be replaced with native facilities in ubiquity at a later point. [ Colin Watson ] * Fix typo that broke find_path_cleanup. -- Colin Watson Tue, 02 Oct 2007 23:29:11 +0100 lupin (0.7) gutsy; urgency=low [ Agostino Russo ] * Mount /isodevice read-write, and move-mount it into /root once that's possible. -- Colin Watson Fri, 21 Sep 2007 15:41:24 +0100 lupin (0.6) gutsy; urgency=low * Don't call find_path_cleanup in find_iso script; it breaks it (thanks, Agostino Russo). -- Colin Watson Tue, 11 Sep 2007 19:56:39 +0100 lupin (0.5) gutsy; urgency=low * Install a bit more defence against device names containing slashes after "/dev/". * Unmount and remove the mountpoint created by find_path when we're finished with it. * Localise a few more variables in find_path to avoid interfering with callers. * Call wait_for_devs within find_path, and have it remember for itself whether it's been called already. * While debconf-set-selections doesn't care about CR/LF line endings in preseed files, fix_preseed does. Oops. Strip off stray CRs there. * Suppress an error message when copying the preseed file. -- Colin Watson Tue, 11 Sep 2007 19:46:13 +0100 lupin (0.4) gutsy; urgency=low * Skip waiting for devices if find_iso= is not on the kernel command line. -- Colin Watson Fri, 07 Sep 2007 16:31:26 +0100 lupin (0.3) gutsy; urgency=low [ Agostino Russo ] * Allow scanning devices that are already mounted. * Fix some minor bugs. [ Colin Watson ] * Fix preseeding if partition number is greater than 9. -- Colin Watson Fri, 07 Sep 2007 14:50:19 +0100 lupin (0.2) gutsy; urgency=low [ Geza Kovacs ] * Add XFS and JFS to supported filesystems. Fix broken reiserfs string which causes reiser4 (unsupported) to be detected as reiserfs (supported). [ Colin Watson ] * Remove xinit-ubiquity, now integrated into ubiquity. -- Colin Watson Thu, 06 Sep 2007 17:24:48 +0100 lupin (0.1) gutsy; urgency=low * Initial release. -- Colin Watson Thu, 30 Aug 2007 21:08:00 +0100 lupin/debian/lupin-support.postinst0000644000000000000000000000064311256216273014773 0ustar #!/bin/sh set -e case "$1" in configure) update-initramfs -u if which update-grub >/dev/null 2>&1; then update-grub || true fi ;; abort-upgrade|abort-remove|abort-deconfigure) update-initramfs -u if which update-grub >/dev/null 2>&1; then update-grub || true fi ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 lupin/Makefile0000644000000000000000000000004711547046775010554 0ustar all clean: $(MAKE) -C grub-install $@ lupin/grub-install/0000755000000000000000000000000012243426570011503 5ustar lupin/grub-install/grub-mkimage0000755000000000000000000001353711636067234014014 0ustar #! /bin/sh -e # grub-install helper script for lupin. This script will upgrade # the grub bootloader installed on the host (wubildr). # # Copyright (C) Agostino Russo # # Lupin is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of # the License, or (at your option) any later version. # # Lupin is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . newns () { [ "$LUPIN_NEWNS" ] || exec /usr/lib/lupin-support/newns "$0" "$@" } # Look for wubildr on all partitions of BIOS-accessible disk devices. # We can safely ignore the hibernation case here, because the Windows boot # loader boots straight into Windows if Windows was hibernated. find_wubildr () { local partitions= for disk in $(grub-mkdevicemap -m - | cut -f2); do disk="$(readlink -f "$disk")" || continue sysdisk="/sys$(udevadm info -q path -n "$disk" 2>/dev/null)" || continue for syspartition in "$sysdisk"/*[0-9]; do [ -d "$syspartition" ] || continue partition="/dev/$(udevadm info -q name -p "$syspartition" 2>/dev/null)" || continue fs="$(grub-probe -t fs -d "$partition" 2>/dev/null)" || continue [ "$fs" = fat ] || [ "$fs" = ntfs ] || continue if [ "$(grub-fstest "$partition" ls /wubildr 2>/dev/null)" ]; then partitions="${partitions:+$partitions }$partition" fi done done echo "$partitions" } parse_proc_mounts () { while read -r line; do set -- $line printf '%s %s %s\n' "$(readlink -f "$1")" "$2" "$3" done } unescape_mount () { printf %s "$1" | \ sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g' } newns "$@" prefix= test_only=false for option in "$@"; do case "$option" in --prefix=*) prefix=`echo "$option" | sed 's/--prefix=//'` ;; --test) test_only=: ;; esac done GRUB_DEVICE_BOOT="`grub-probe --target=device /boot`" case ${GRUB_DEVICE_BOOT} in /dev/loop/*|/dev/loop[0-9]) loop_file=`losetup ${GRUB_DEVICE_BOOT} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` ;; esac # Is /boot loop-mounted from a file on another filesystem? if [ "x${loop_file}" = x ] || [ ! -f "${loop_file}" ]; then exit 1 fi mtpt="${loop_file%/*}" while [ -n "$mtpt" ]; do while read DEV MTPT FSTYPE OPTS REST; do if [ "$MTPT" = "$mtpt" ]; then loop_file=${loop_file#$MTPT} host_mountpoint=$MTPT break fi done < /proc/mounts mtpt="${mtpt%/*}" [ -z "$host_mountpoint" ] || break done if [ "x${host_mountpoint}" = x ]; then exit 1 fi target="${host_mountpoint}/wubildr" if $test_only; then if [ -f "$target" ]; then # Found on this partition exit 0 elif [ "$(find_wubildr)" ]; then # Found on some other partition exit 0 else # Not found exit 1 fi fi wubildr_partitions="$(find_wubildr)" if [ ! -f "$target" ] && [ -z "$wubildr_partitions" ]; then exit 1 fi # TODO You might want to have this as a proper file somewhere in /usr/share tmp="$(mktemp -dt)" echo 'normal (memdisk)/wubildr.cfg' > "$tmp/wubildr-bootstrap.cfg" cat << EOF > "$tmp/wubildr.cfg" set show_panic_message=true if search -s -f -n $loop_file; then if loopback loop0 $loop_file; then set root=(loop0) if [ -e /boot/grub/grub.cfg ]; then set prefix=(loop0)/boot/grub if configfile /boot/grub/grub.cfg; then set show_panic_message=false fi elif [ -e /grub/grub.cfg ]; then set prefix=(loop0)/grub if configfile /grub/grub.cfg; then set show_panic_message=false fi else if search -s -f -n /ubuntu/install/wubildr-disk.cfg; then if configfile /ubuntu/install/wubildr-disk.cfg; then set show_panic_message=false fi fi fi fi fi if [ \${show_panic_message} = true ]; then echo "It is not possible to boot from the Ubuntu image." echo "The Windows partition might be corrupted." echo "Please reboot into Windows and run: chkdsk /r" echo "Then try again." fi EOF (cd "$tmp" && tar cf wubildr.tar wubildr.cfg) # Watch the modules order! modules=" \ biosdisk part_msdos part_gpt fat ntfs ext2 ntfscomp iso9660 loopback \ search linux boot echo test gzio normal memdisk tar probe configfile" # Ensure errors pass through the pipeline. s="$( ((grub-mkimage -O i386-pc ${prefix:+--prefix="$prefix"} -c "$tmp/wubildr-bootstrap.cfg" -m "$tmp/wubildr.tar" $modules; echo $? >&3) | cat /usr/lib/grub/i386-pc/lnxboot.img - > "$tmp/wubildr") 3>&1)"; [ "$s" = 0 ] if [ -f "$target" ]; then cp -af "$tmp/wubildr" "$target.new" mv -f "$target.new" "$target" fi grep ^/dev/ /proc/mounts | parse_proc_mounts >"$tmp/mounted-map" mkdir -p "$tmp/mnt" for partition in $wubildr_partitions; do if grep -q "^$partition " "$tmp/mounted-map"; then mpoint="$(grep "^$partition " "$tmp/mounted-map" | head -n1 | cut -d' ' -f2)" mpoint="$(unescape_mount "$mpoint")" if [ "$mpoint" = /host ]; then continue fi else mount "$partition" "$tmp/mnt" 2>/dev/null || continue mpoint="$tmp/mnt" fi if [ -f "$mpoint/wubildr" ]; then cp -af "$tmp/wubildr" "$mpoint/wubildr.new" mv -f "$mpoint/wubildr.new" "$mpoint/wubildr" fi if ! grep -q "^$partition " "$tmp/mounted-map"; then umount "$tmp/mnt" || true fi done rm -rf --one-file-system "$tmp" || true lupin/grub-install/Makefile0000644000000000000000000000014211547052041013132 0ustar CFLAGS := -O2 -g -Wall all: newns newns: newns.c $(CC) $(CFLAGS) $^ -o $@ clean: rm -f newns lupin/grub-install/grub-install0000755000000000000000000000644212243220174014032 0ustar #! /bin/sh set -e # grub-install replacement for use in Wubi installations. This arranges for # the grub bootloader installed on the host (wubildr) to be reinstalled # rather than installing it to a boot sector. # # To get at the real MBR if you wish to do so, use grub-install.real # instead. # # Copyright (C) 2009, 2013 Canonical Ltd. # # Lupin is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Lupin is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Lupin; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. want_passthrough () { while [ $# -gt 0 ]; do option="$1" shift case $option in -h|--help|-v|--version) return 0 ;; --debug-image) debug_image="$1" shift ;; --debug-image=*) debug_image="${option#--debug-image=}" ;; esac done return 1 } if want_passthrough "$@" || ! /usr/share/lupin-support/grub-mkimage --test; then grub-install.real "$@" exit $? fi # The C rewrite of grub-install no longer offers --grub-probe or # --grub-mkimage options, so we now have to roll our own installation. This # is arguably clearer anyway, although it's unfortunately verbose and it # will only work on BIOS. On the other hand, there is relatively little # need to track the real grub-install code, as it's now in a different # language and most of it is unused here anyway. source_dir=/usr/lib/grub/i386-pc if [ ! -d "$source_dir" ]; then echo "$source_dir doesn't exist; GRUB cannot be installed." >&2 exit 1 fi pkgdatadir=/usr/share/grub localedir=/usr/share/locale grubdir=/boot/grub mkdir -p "$grubdir/i386-pc" for dir in "$grubdir" "$grubdir/i386-pc"; do for file in "$dir"/*.mod "$dir"/*.lst "$dir"/*.img "$dir"/efiemu??.o; do if [ -f "$file" ] && [ "$(basename "$file")" != menu.lst ]; then rm -f "$file" fi done done for file in "$source_dir"/*.mod "$source_dir"/*.lst "$source_dir"/*.img "$source_dir"/efiemu??.o; do cp -f "$file" "$grubdir/i386-pc/" done mkdir -p "$grubdir/locale" for dir in "$localedir"/* "$localedir-langpack"/*; do if [ -f "$dir/LC_MESSAGES/grub.mo" ]; then cp -f "$dir/LC_MESSAGES/grub.mo" "$grubdir/locale/${dir##*/}.mo" fi done if [ -f "$pkgdatadir/themes/starfield/theme.txt" ]; then mkdir -p "$grubdir/themes/starfield" cp "$pkgdatadir/themes/starfield"/* "$grubdir/themes/starfield/" fi if [ -f "$pkgdatadir/unicode.pf2" ]; then mkdir -p "$grubdir/fonts" cp "$pkgdatadir/unicode.pf2" "$grubdir/fonts/" fi if [ ! -f "$grubdir/grubenv" ]; then grub-editenv "$grubdir/grubenv" create fi /usr/share/lupin-support/grub-mkimage # If vestiges of GRUB Legacy still exist, tell the Debian packaging that # they can ignore them. if [ -e /boot/grub/stage2 ] && [ -e /boot/grub/menu.lst ]; then touch /boot/grub/grub2-installed fi echo "Installation finished. No error reported." >&2 echo >&2 exit 0 lupin/grub-install/newns.c0000644000000000000000000000124411547047303013001 0ustar #define _GNU_SOURCE #include #include #include #include #include int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "Usage: newns PROGRAM [ARGUMENTS ...]\n"); exit(1); } /* This is best-effort; if the kernel is too old (Linux << 2.6.16), * or indeed if the kernel isn't Linux so we don't have * unshare(CLONE_NEWNS), don't worry about it. */ #ifdef __linux__ if (unshare(CLONE_NEWNS) < 0 && errno != ENOSYS) perror("unshare failed"); /* ... but continue anyway */ #endif /* __linux__ */ setenv("LUPIN_NEWNS", "1", 1); execvp(argv[1], argv + 1); perror("execvp failed"); _exit(127); } lupin/grub.d/0000755000000000000000000000000012032317103010244 5ustar lupin/grub.d/10_lupin0000755000000000000000000002461212032317103011626 0ustar #! /bin/sh set -e # grub-mkconfig helper script for lupin. Some of this is based on 10_linux, # but with irrelevant bits removed and the rest extended to cope with # loopback mounts. # # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. # Copyright (C) 2009 Canonical Ltd. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GRUB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . prefix="/usr" exec_prefix="${prefix}" datarootdir="${prefix}/share" . "${datarootdir}/grub/grub-mkconfig_lib" export TEXTDOMAIN=grub export TEXTDOMAINDIR="${datarootdir}/locale" CLASS="--class gnu-linux --class gnu --class os" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux else OS="${GRUB_DISTRIBUTOR}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" fi case ${GRUB_DEVICE} in /dev/loop/*|/dev/loop[0-9]) loop_file=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` ;; esac # Is the root filesystem loop-mounted from a file on another filesystem? if [ "x${loop_file}" = x ] || [ ! -f "${loop_file}" ]; then exit 0 fi dev_mountpoint="$(awk '"'${loop_file}'" ~ "^"$2 && $2 != "/" { print $1";"$2 }' /proc/mounts | tail -n1)" host_device="${dev_mountpoint%;*}" host_mountpoint="${dev_mountpoint#*;}" if [ "x${host_device}" = x ]; then exit 0 fi loop_file_relative="${loop_file#$host_mountpoint}" # Device containing the host filesystem. host_device_uuid="`${grub_probe} --device "${host_device}" --target=fs_uuid 2> /dev/null`" || true if [ "x${host_device_uuid}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ || ! test -e "/dev/disk/by-uuid/${host_device_uuid}" \ || [ "`${grub_probe} -t abstraction --device ${host_device} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm" ] ; then LINUX_HOST_DEVICE=${host_device} else LINUX_HOST_DEVICE=UUID=${host_device_uuid} fi GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" if [ x"$GRUBFS" = x ]; then GRUBFS="$(stat -f --printf=%T / || true)" fi case x"$GRUBFS" in xbtrfs) rootsubvol="`make_system_path_relative_to_its_root /`" rootsubvol="${rootsubvol#/}" if [ "x${rootsubvol}" != x ]; then GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" fi;; xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" ;; esac title_correction_code= for word in $GRUB_CMDLINE_LINUX_DEFAULT; do if [ "$word" = splash ]; then GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \$vt_handoff" fi done # add crashkernel option if we have the required tools if [ -x "/usr/bin/makedumpfile" ] && [ -x "/sbin/kexec" ]; then GRUB_CMDLINE_EXTRA="$GRUB_CMDLINE_EXTRA crashkernel=384M-2G:64M,2G-:128M" fi lupin_entry () { os="$1" version="$2" type="$3" args="$4" if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi if [ x$type != xsimple ] ; then case $type in recovery) title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;; *) title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;; esac if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" fi if [ x$type != xrecovery ] ; then save_default_entry | sed -e "s/^/\t/" echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/" fi echo " insmod gzio" | sed "s/^/$submenu_indentation/" if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" fi printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" if [ x$type != xsimple ]; then message="$(gettext_printf "Loading Linux %s ..." ${version})" sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' EOF fi sed "s/^/$submenu_indentation/" << EOF linux ${rel_dirname}/${basename} root=${LINUX_HOST_DEVICE} loop=${loop_file_relative} ro ${args} EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. if [ x$type != xsimple ]; then message="$(gettext_printf "Loading initial ramdisk ...")" sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' EOF fi sed "s/^/$submenu_indentation/" << EOF initrd ${rel_dirname}/${initrd} EOF fi sed "s/^/$submenu_indentation/" << EOF } EOF } machine=`uname -m` case "x$machine" in xi?86 | xx86_64) list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` ;; *) list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` ;; esac case "$machine" in i?86) GENKERNEL_ARCH="x86" ;; mips|mips64) GENKERNEL_ARCH="mips" ;; mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;; arm*) GENKERNEL_ARCH="arm" ;; *) GENKERNEL_ARCH="$machine" ;; esac prepare_boot_cache= boot_device_id= title_correction_code= cat << 'EOF' function gfxmode { set gfxpayload="${1}" if [ "${1}" = "keep" ]; then set vt_handoff=vt.handoff=7 else set vt_handoff= fi } EOF # Use ELILO's generic "efifb" when it's known to be available. # FIXME: We need an interface to select vesafb in case efifb can't be used. if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ]; then echo "set linux_gfx_mode=$GRUB_GFXPAYLOAD_LINUX" else cat << EOF if [ "\${recordfail}" != 1 ]; then if [ -e \${prefix}/gfxblacklist.txt ]; then if hwmatch \${prefix}/gfxblacklist.txt 3; then if [ \${match} = 0 ]; then set linux_gfx_mode=keep else set linux_gfx_mode=text fi else set linux_gfx_mode=text fi else set linux_gfx_mode=keep fi else set linux_gfx_mode=text fi EOF fi cat << EOF export linux_gfx_mode if [ "\${linux_gfx_mode}" != "text" ]; then load_video; fi EOF # Extra indentation to add to menu entries in a submenu. We're not in a submenu # yet, so it's empty. In a submenu it will be equal to '\t' (one tab). submenu_indentation="" is_first_entry=true while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` gettext_printf "Found linux image: %s\n" "$linux" >&2 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" initrd= for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ "initrd-${version}" "initramfs-${version}.img" \ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ "initrd-${alt_version}" "initramfs-${alt_version}.img" \ "initramfs-genkernel-${version}" \ "initramfs-genkernel-${alt_version}" \ "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do if test -e "${dirname}/${i}" ; then initrd="$i" break fi done config= for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do if test -e "${i}" ; then config="${i}" break fi done initramfs= if test -n "${config}" ; then initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` fi if test -n "${initrd}" ; then gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 else # None of this can work without an initrd, so don't even bother. list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` continue fi if [ "x$is_first_entry" = xtrue ]; then lupin_entry "${OS}" "${version}" simple \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" submenu_indentation="\t" if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi # TRANSLATORS: %s is replaced with an OS name echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" fi lupin_entry "${OS}" "${version}" advanced \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then if [ -x /lib/recovery-mode/recovery-menu ]; then lupin_entry "${OS}" "${version}" recovery \ "recovery nomodeset ${GRUB_CMDLINE_LINUX}" else lupin_entry "${OS}" "${version}" recovery \ "single nomodeset ${GRUB_CMDLINE_LINUX}" fi fi list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` is_first_entry=false done # If at least one kernel was found, then we need to # add a closing '}' for the submenu command. if [ x"$is_first_entry" != xtrue ]; then echo '}' fi echo "$title_correction_code" lupin/hooks/0000755000000000000000000000000011636067234010226 5ustar lupin/hooks/lupin_setup0000755000000000000000000000007011636067234012520 0ustar #!/bin/sh -e case "$1" in prereqs) exit 0 ;; esac lupin/casper/0000755000000000000000000000000011035116767010357 5ustar lupin/casper/hooks/0000755000000000000000000000000011542174362011500 5ustar lupin/casper/hooks/lupin_casper0000755000000000000000000000031011542174362014104 0ustar #! /bin/sh set -e PREREQ="casper" prereqs () { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac cp -p /usr/share/initramfs-tools/scripts/lupin-helpers $DESTDIR/scripts/ exit 0 lupin/casper/scripts/0000755000000000000000000000000012243426447012047 5ustar lupin/casper/scripts/casper-premount/0000755000000000000000000000000011444722154015167 5ustar lupin/casper/scripts/casper-premount/30custom_installation0000755000000000000000000000643511350143574021362 0ustar #!/bin/sh PREREQ="" DESCRIPTION="Importing custom installation settings..." prereqs() { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions . /scripts/lupin-helpers fix_preseed(){ #TBD what follows tries to find Linux devices if preseed is generated from another OS #a proper fix should be to find reliable device mappings in the preseed-generator preseed_file="$1" preseed_dev="$2" #Find Linux device of User Folder for importing settings by m-a user_folder=$(grep "#UserFolder" "$preseed_file" | sed 's/[[:space:]]*$//') user_folder=${user_folder#'#UserFolder='} if find_path "$user_folder"; then dev="$FOUNDDEV" else dev="$preseed_dev" fi dev=${dev#/dev/} sed -i "s:MADEVICE:$dev:g" "$preseed_file" #Find Linux device of loopinstall folder loopinstall_folder=$(grep "#LoopInstallFolder" "$preseed_file" | sed 's/[[:space:]]*$//') loopinstall_folder=${loopinstall_folder#'#LoopInstallFolder='} if find_path "${loopinstall_folder}"; then dev="${FOUNDDEV}" else dev="$preseed_dev" fi check_loopinstall_folder "$dev" "$loopinstall_folder" disk="$(echo "$dev" | sed 's/[0-9]*$//')" partn=${dev#${disk}} sed -i "s:LIDISK:$disk:g" "$preseed_file" sed -i "s:LIPARTITION:$partn:g" "$preseed_file" } check_loopinstall_folder(){ loopinstall_dev=${1} loopinstall_folder=${2} #TBD Check whether LOOPINSTALL_FOLDER is vergin or not #Can we install on top of an existing installation? #Shall we overwrite? ignore and simply boot the live CD or panic? #Do we do the check here or later on? } custom_installation_path= for x in $(cat /proc/cmdline); do case ${x} in debian-installer/custom-installation=*) custom_installation_path=${x#debian-installer/custom-installation=} ;; esac done if [ -n "$custom_installation_path" ]; then if find_path "${custom_installation_path}"; then custom_installation_path="$FOUNDPATH" custom_installation_dev="$FOUNDDEV" mkdir -p /custom-installation cp -af "$custom_installation_path"/* /custom-installation/ cp -af /custom-installation/initrd-override/* / || true rm -rf /custom-installation/initrd-override || true if [ -x /custom-installation/hooks/casper-premount.sh ]; then /custom-installation/hooks/casper-premount.sh fi if [ -e /custom-installation/preseed.cfg ]; then cp /custom-installation/preseed.cfg / #fix parameters that cannot be set from a non-linux OS fix_preseed /preseed.cfg "$custom_installation_dev" fi else panic " Could not find the installation files $custom_installation_path This could also happen if the file system is not clean because of an operating system crash, an interrupted boot process, an improper shutdown, or unplugging of a removable device without first unmounting or ejecting it. To fix this, simply reboot into Windows, let it fully start, log in, run 'chkdsk /r', then gracefully shut down and reboot back into Windows. After this you should be able to reboot again and resume the installation. " fi find_path_cleanup fi lupin/casper/scripts/casper-premount/20iso_scan0000755000000000000000000000215211350143564017053 0ustar #!/bin/sh PREREQ="" prereqs() { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions . /scripts/lupin-helpers iso_path= for x in $(cat /proc/cmdline); do case ${x} in iso-scan/filename=*) iso_path=${x#iso-scan/filename=} ;; esac done if [ "$iso_path" ]; then if find_path "${iso_path}" /isodevice rw; then echo "LIVEMEDIA=${FOUNDPATH}" >> /conf/param.conf if [ -f "${FOUNDPATH}" ]; then echo "LIVEMEDIA_OFFSET=0" >> /conf/param.conf fi else panic " Could not find the ISO $iso_path This could also happen if the file system is not clean because of an operating system crash, an interrupted boot process, an improper shutdown, or unplugging of a removable device without first unmounting or ejecting it. To fix this, simply reboot into Windows, let it fully start, log in, run 'chkdsk /r', then gracefully shut down and reboot back into Windows. After this you should be able to reboot again and resume the installation. " fi fi lupin/casper/scripts/casper-bottom/0000755000000000000000000000000011350143550014613 5ustar lupin/casper/scripts/casper-bottom/10ntfs_3g0000755000000000000000000000052411350143543016250 0ustar #! /bin/sh PREREQ="" DESCRIPTION="Setting sendsigs.omit..." prereqs () { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions mkdir -p /dev/.initramfs/varrun pidof mount.ntfs >> /dev/.initramfs/varrun/sendsigs.omit pidof mount.ntfs-3g >> /dev/.initramfs/varrun/sendsigs.omit lupin/casper/scripts/casper-bottom/10custom_installation0000755000000000000000000000102711350143533020776 0ustar #! /bin/sh PREREQ="" DESCRIPTION="Running casper hooks..." prereqs () { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions if [ -d /custom-installation ]; then cp -af /custom-installation/ /root/custom-installation || true cp -af /custom-installation/iso-override/* /root/ || true rm -rf /custom-installation/iso-override || true if [ -x /custom-installation/hooks/casper-bottom.sh ]; then /custom-installation/hooks/casper-bottom.sh fi fi lupin/casper/scripts/casper-bottom/05mountpoints_lupin0000755000000000000000000000047211350143522020516 0ustar #! /bin/sh PREREQ="" DESCRIPTION="Moving mount points..." prereqs () { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac . /scripts/casper-functions if grep -q '^[^ ]* /isodevice ' /proc/mounts; then mkdir -p /root/isodevice mount -n -o move /isodevice /root/isodevice fi lupin/casper/scripts/lupin-helpers0000644000000000000000000000521312243426447014562 0ustar . /scripts/casper-helpers is_supported_fs(){ [ -z "${1}" ] && return 1 case ${1} in ext2|ext3|ext4|xfs|jfs|reiserfs|vfat|ntfs|iso9660) return 0 ;; esac return 1 } wait_for_devs(){ if [ -e /dev/.initramfs/lupin-waited-for-devs ]; then return fi [ "$quiet" != "y" ] && log_begin_msg "...waiting for devs..." udevadm trigger --subsystem-match=block udevadm settle #TBD, modprobe on demand? modprobe ext3 modprobe ext4 modprobe reiserfs modprobe xfs modprobe jfs modprobe vfat modprobe fuse [ "$quiet" != "y" ] && log_end_msg "...devs loaded..." touch /dev/.initramfs/lupin-waited-for-devs } find_path() { local path="${1}" # must match find_path_cleanup local default_mountpoint="${2:-/tmpmountpoint}" local mountoptions="${3:-ro}" local mountpoint= local dev devname devfstype local trial_number FOUNDDEV= FOUNDPATH= [ -z "${path}" ] && return 1 wait_for_devs mkdir -p "${default_mountpoint}" for trial_number in 1 2 3; do [ $trial_number -gt 1 ] && sleep 3 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v /ram | grep -v /loop | grep -v /fd); do for dev in $(subdevices "${sysblock}"); do devname=$(sys2dev "${dev}") devfstype="$(get_fstype ${devname})" if is_supported_fs "${devfstype}" ; then #if device is already mounted, do not remount if grep -q "^${devname} " /proc/mounts; then mountpoint=$(grep "^${devname} " /proc/mounts|cut -d ' ' -f 2) unmount=false else mountpoint="${default_mountpoint}" try_mount "$devname" "$mountpoint" "$mountoptions" || continue unmount=true fi if [ -e "${mountpoint}${path}" ]; then FOUNDDEV="${devname}" FOUNDPATH="${mountpoint}${path}" return 0 fi [ "${unmount}" = "true" ] && umount ${mountpoint} 2> /dev/null || true fi done done done return 1 } find_path_cleanup() { # must match find_path local default_mountpoint="${1:-/tmpmountpoint}" if grep -q "^[^ ]* $default_mountpoint " /proc/mounts; then umount "$default_mountpoint" 2>/dev/null || true fi rmdir "$default_mountpoint" 2>/dev/null || true } lupin/scripts/0000755000000000000000000000000011636067234010572 5ustar lupin/scripts/local-bottom/0000755000000000000000000000000011641714145013162 5ustar lupin/scripts/local-bottom/lupin_setup0000755000000000000000000001666511641714145015475 0ustar #!/bin/sh -e case "$1" in prereqs) exit 0 ;; esac preseed= diskimage=false for x in $(cat /proc/cmdline); do case $x in preseed/file=*) preseed="${x#preseed/file=}" ;; wubi-diskimage) diskimage=: ;; esac done $diskimage || exit 0 [ -z "$preseed" ] && exit 1 if [ -x /bin/plymouth ] && plymouth --ping; then plymouth message --text="Preparing to run Ubuntu for the first time..." fi chroot /root mount -o remount,rw / # All needed for update-grub chroot /root mount -t proc proc /proc chroot /root mount -t sysfs sysfs /sys chroot /root mount -t devtmpfs devtmpfs /dev chroot /root debconf-set-selections < /root/host/$preseed get_debconf() { var=$(echo "GET $1" | chroot /root debconf-communicate | cut -d' ' -f2) echo $var } cslayout="$(get_debconf "keyboard-configuration/layoutcode")" csvariant="$(get_debconf "keyboard-configuration/variantcode")" csmodel= csoptions= # TODO: This is horribly cloned from casper; keep it in sync. # TODO: This is a horrible clone-and-hack from console-setup. We should # definitely be calling console-setup instead; however, that's too risky for # 8.04 since it will need careful installer testing and will probably be # slower. adjust_console_setup () { if [ -z "$csmodel" ]; then if [ "$cslayout" = br ]; then csmodel=abnt2 elif [ "$cslayout" = jp ]; then csmodel=jp106 fi fi latin= case $cslayout in jp) case $csvariant in ''|106|common|OADG109A|nicola_f_bs) latin=yes ;; *) latin=no cslayout=jp,jp csvariant="106,$csvariant" ;; esac ;; lt) latin=no cslayout=lt,lt case $csvariant in us) csvariant=us, ;; *) csvariant="$csvariant,us" ;; esac ;; me) case $csvariant in ''|basic|latin*) latin=yes ;; cyrillicyz) latin=no cslayout=me,me csvariant="latinyz,$csvariant" ;; cyrillicalternatequotes) latin=no cslayout=me,me csvariant="latinalternatequotes,$csvariant" ;; *) latin=no cslayout=me,me csvariant="basic,$csvariant" ;; esac ;; rs) case $csvariant in ''|basic|latin*) latin=yes ;; yz) latin=no cslayout=rs,rs csvariant="latinyz,$csvariant" ;; alternatequotes) latin=no cslayout=rs,rs csvariant="latinalternatequotes,$csvariant" ;; *) latin=no cslayout=rs,rs csvariant="latin,$csvariant" ;; esac ;; am|ara|ben|bd|bg|bt|by|deva|ge|gh|gr|guj|guru|il|in|ir|iku|kan|kh|la|lao|lk|mk|mm|mn|mv|mal|ori|pk|ru|scc|sy|syr|tel|th|tj|tam|ua|uz) latin=no cslayout="us,$cslayout" csvariant=",$csvariant" ;; *) latin=yes esac if [ "$latin" = no ]; then csoptions="${csoptions:+$csoptions,}grp:alt_shift_toggle" fi if [ "$cslayout" != us ] || [ "$csvariant" ]; then csoptions="${csoptions:+$csoptions,}lv3:ralt_switch" fi } # First user chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null # Locale locale="$(get_debconf "debian-installer/locale")" printf 'LANG="%s"\n' "$locale" >> /root/etc/default/locale printf 'LANG="%s"\n' "$locale" >> /root/etc/environment chroot /root /usr/sbin/locale-gen "$locale" || true if ! echo "$locale" | grep -qs '^en_'; then cp /root/usr/share/language-support/incomplete-language-support-*.note \ /root/var/lib/update-notifier/user.d/ fi # Timezone zone="$(get_debconf "time/zone")" echo "$zone" > /root/etc/timezone rm -f /root/etc/localtime cp -f /root/usr/share/zoneinfo/$zone /root/etc/localtime # We skip setting the clock via NTP for now. It's time consuming, unlikely to # work given the lack of networking in the initramfs :), and the clock being # set to the same time as Windows isn't a bad thing. utc="$(get_debconf "clock-setup/utc")" rcsfile=/root/etc/default/rcS if [ "$utc" = true ]; then sed -i -e 's:^UTC="no":UTC="yes":' -e 's:^UTC=no:UTC=yes:' $rcsfile else sed -i -e 's:^UTC="yes":UTC="no":' -e 's:^UTC=yes:UTC=no:' $rcsfile fi adjust_console_setup CONFIGFILE=/etc/default/keyboard chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"$cslayout\"/" "$CONFIGFILE" if [ "$csvariant" ]; then chroot /root sed -i "s/^XKBVARIANT=.*/XKBVARIANT=\"$csvariant\"/" \ "$CONFIGFILE" fi if [ "$csmodel" ]; then chroot /root sed -i "s/^XKBMODEL=.*/XKBMODEL=\"$csmodel\"/" \ "$CONFIGFILE" fi if [ "$csoptions" ]; then chroot /root sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"$csoptions\"/" \ "$CONFIGFILE" fi chroot /root dpkg-reconfigure -fnoninteractive console-setup # Hostname HOST="$(get_debconf "netcfg/get_hostname")" echo "$HOST" > /root/etc/hostname cat > /root/etc/hosts <> /root/etc/fstab chroot /root swapon "$SWAP" fi chroot /root umount /proc chroot /root umount /sys chroot /root umount /dev chroot /root mount -o remount,ro /