1: #!/bin/bash
2: #
3: #############################################################################
4: #
5: # =======================================================
6: # zyx-liveinstaller-cli - rebootless live media installer
7: # =======================================================
8: # version - see latest changelog entry
9: #
10: # licence:
11: # Copyright 2007-2009 Douglas McClendon <dmc AT viros DOT org>
12: # Licensed under the GPL version 3, see end of file
13: #
14: # website: http://viros.org/rebootless or
15: # http://filteredperception.org/smiley/projects/zyx-liveinstaller
16: #
17: #############################################################################
18:
19: #############################################################################
20: #
21: # changelog:
22: #
23: # v0.3-2010.02.12
24: # - mkinitramfs: --preload .. --add syntax change
25: # - bugfix: make ownerships of tmpfs links the same as the original
26: # - zyx: no more /tmp(fs)
27: # v0.3-2010.01.19
28: # - bugfix: ensure set 777+t on /tmp
29: # - bugfix: leave autojam out of grub.conf as well
30: # v0.3-2009.11.10
31: # - bugfix: single-sole-part installs weren't getting type flag set
32: # v0.3-2009.10.26
33: # - bugfix: yes, there seems to have indeed been a bug with no-swap installs
34: # v0.3-2009.10.24
35: # - enhancement: centos-5.4 support
36: # - bugfix: enforce install target size minimums
37: # v0.3-2009.10.13
38: # - bugfix: yes, there seems to have indeed been a bug with no-swap installs
39: # - bugfix: handle nondefault kernel cmdline args
40: # v0.3-2009.10.08
41: # - debug: more error condition checks
42: # - bugfix: use tune2fs to randomize new rootfs uuid
43: # - bugfix: use blkid instead of deprecated vol_id (gone in f12)
44: # - bugfix: unmounting automounted stuff broke in 2k9.09.03
45: # - bugfix: clean eject broke in 2k9.09.21
46: # - bugfix: newer udev path_id need non /sys prefix format
47: # - use ext4 for /boot if it is used for / and not f11
48: # v0.3-2009.09.21
49: # - handle f12 style lack of useful udev entries for LiveOS
50: # - handle f12 style dracut mkinitrd replacement (I hope the rename it back)
51: # v0.3-2009.09.03
52: # - massive variable quoting style change as per ch5 of adv bash scr guide
53: # - fix /boot partition typeflag and bootflag not getting set
54: # - fix inexact f11 checking for seperate /boot partition requirement
55: # v0.3-2009.08.15
56: # - more debug logging
57: # - genericize automounting mitigation
58: # - rename rliveinst.zyx -> zyx-liveinstaller-cli
59: # - relabel new rootfs after install
60: # v0.3-2009.07.31
61: # - better logging to /var/log/zyx-liveinstaller.*
62: # v0.3-2009.07.24
63: # - comment removed
64: # v0.3-2009.07.16
65: # - zyx support again, cleanup
66: # v0.3-2009.07.12
67: # - better grub config, cleanup
68: # v0.3-2009.06.26
69: # - f11 rebase
70: # v0.1-2007.07.14
71: # - initial release, f7 based
72: #
73: #############################################################################
74:
75: #############################################################################
76: #
77: # Usage
78: # -----
79: #
80: # usage: zyx-liveinstaller-cli \
81: # <target_root_volume> \
82: # <target_boot_volume> \
83: # [<target_swap_volume>=none]
84: #
85: # e.g. zyx-liveinstaller-cli /dev/sda2 /dev/sda1 /dev/sda3
86: #
87: # Installs liveOS onto target_partition, reboot not needed after completion.
88: #
89: #############################################################################
90:
91: #############################################################################
92: #
93: # Manual
94: # ------
95: #
96: # zyx-liveinstaller-cli is a program which when run on a supported "liveCD"
97: # or similar environment, will install that operating system distribution
98: # to disk. What is unique about zyx-liveinstaller-cli, is that when
99: # installation is complete, no reboot is necessary to start working in the
100: # installed system.
101: #
102: # One such supported system, is the Fedora-11-Live-i686 "liveCD", which
103: # can be downloaded from
104: #
105: # http://download.fedora.redhat.com/pub/fedora/linux/releases
106: #
107: #
108: # Method for using zyx-liveinstaller-cli with the Fedora-11-Live-i686 liveCD
109: # --------------------------------------------------------------
110: #
111: # WARNING- THIS COMMAND WILL DESTROY THE CONTENTS OF THE INSTALLATION PARTITIONS!!!
112: #
113: # 1) install zyx-liveinstaller from the official fedora updates repsitory.
114: # - go to the main menu -> system -> administration -> add/remove software
115: # - search for zyx-liveinstaller, and install
116: #
117: # 2) run the gui from main_menu -> system tools -> Rebootless LiveOS Installation
118: #
119: # or run this program directly as zyx-liveinstaller-cli.
120: #
121: # For instance, to install to the first partition on the first hard drive that the
122: # OS discovered, issue this command- (and /boot on /dev/sda1 and swap on /dev/sda2)
123: #
124: # zyx-liveinstaller-cli /dev/sda3 /dev/sda1 /dev/sda2
125: #
126: # WARNING- THIS COMMAND WILL DESTROY THE CONTENTS OF THE INSTALLATION PARTITIONS!!!
127: #
128: #############################################################################
129:
130:
131: #############################################################################
132: ## logfile init
133: #############################################################################
134:
135: LOGFILE="/var/log/zyx-liveinstaller.log"
136: ERRLOGFILE="/var/log/zyx-liveinstaller.err.log"
137: exec 3>&1 > >(tee -a "${LOGFILE}")
138: exec 4>&2 2> >(tee -a "${ERRLOGFILE}")
139:
140:
141: #############################################################################
142: ## derived constants
143: #############################################################################
144:
145: progname=$( basename "${0}" )
146: progdir=$( dirname "${0}" )
147:
148:
149: #############################################################################
150: #############################################################################
151: ##
152: ## functions
153: ##
154: #############################################################################
155: #############################################################################
156:
157: # e.g. extract 'a' from '/dev/sda1'
158: function get_target_disk_let {
159: echo "${1}" | sed -e 's/\(\/dev\/.d\)\(.\)\(.\)/\2/'
160: }
161:
162: # e.g. extract '1' from '/dev/sda1'
163: function get_target_part_num {
164: echo "${1}" | sed -e 's/\(\/dev\/.d\)\(.\)\(.\)/\3/'
165: }
166:
167: # e.g. extract 's' from '/dev/sda1'
168: function get_target_disk_type {
169: echo "${1}" | sed -e 's/\/dev\/\(.\)d\(.\)\(.\)/\1/'
170: }
171:
172: # in grub units: e.g. extract '0' from '/dev/sda1', or '2' from '/dev/sdc4'
173: function get_grub_target_disk_num {
174: targetdisklet=$( echo "${1}" |sed -e 's/\(\/dev\/.d\)\(.\)\(.\)/\2/' )
175: if [ "${targetdisklet}" == "a" ]; then
176: grub_targetdisknum=0
177: elif [ "${targetdisklet}" == "b" ]; then
178: grub_targetdisknum=1
179: elif [ "${targetdisklet}" == "c" ]; then
180: grub_targetdisknum=2
181: elif [ "${targetdisklet}" == "d" ]; then
182: grub_targetdisknum=3
183: elif [ "${targetdisklet}" == "e" ]; then
184: grub_targetdisknum=4
185: elif [ "${targetdisklet}" == "f" ]; then
186: grub_targetdisknum=5
187: elif [ "${targetdisklet}" == "g" ]; then
188: grub_targetdisknum=6
189: elif [ "${targetdisklet}" == "h" ]; then
190: grub_targetdisknum=7
191: else
192: status "sorry, only /dev/[a-z]d[a-h]X partitions are supported"
193: exit 1
194: fi
195: echo "${grub_targetdisknum}"
196: return
197: }
198:
199: # in grub units: e.g. extract '0' from '/dev/sda1', or '3' from '/dev/sdc4'
200: function get_grub_target_part_num {
201: targetpartnum=$( get_target_part_num "${1}" )
202: # note: quoting style: $(( apparently doesn't handle quoted variables
203: echo $(( ${targetpartnum} - 1 ))
204: return
205: }
206:
207: # get a major_minor string for a device
208: function get_major_minor {
209:
210: # remove leading - from possible bogus filename
211: safe_name=$( echo "${1}" | sed -e 's/^\-//' )
212:
213: canonicalization=$( readlink -e "${safe_name}" )
214: if [ ! -b "${canonicalization}" ]; then
215: # not a block special device
216: echo "na,na"
217: else
218: # note: this is turning something like "... 1, 23 ..." into "1,23"
219: echo "$( ls -l ${canonicalization} | awk '{print $5 $6}' )"
220: fi
221: }
222:
223: # try to unmount the specified device if possible
224: function try_unmount {
225:
226: # ignore possible none value for swap, or other non block device values
227: if [ ! -b "${1}" ]; then
228: echo none
229: return
230: fi
231:
232: status "trying to unmount mounts of device:${1}"
233: target_major_minor=$( get_major_minor "${1}" )
234:
235: if [ -f /proc/self/mountinfo ]; then
236: # normal case
237: while read mountline; do
238: mount_major_minor=$( echo "${mountline}" | awk '{print $3}' | sed -e 's/:/,/' )
239: if [ "${target_major_minor}" == "${mount_major_minor}" ]; then
240: mount_point=$( echo "${mountline}" | awk '{print $5}' )
241: # we're just trying
242: status "trying to unmount mountpoint ${mount_point}"
243: umount "${mount_point}"
244: fi
245: done < /proc/self/mountinfo
246: elif [ -f /proc/self/mounts ]; then
247: # legacy case (centos-5.x)
248: while read mountline; do
249: mount_device=$( echo "${mountline}" | awk '{print $1}' )
250: mount_major_minor=$( get_major_minor "${mount_device}" )
251: if [ "${target_major_minor}" == "${mount_major_minor}" ]; then
252: mount_point=$( echo "${mountline}" | awk '{print $2}' )
253: # we're just trying
254: status "trying to unmount mountpoint ${mount_point}"
255: umount "${mount_point}"
256: fi
257: done < /proc/self/mounts
258: else
259: # assertion
260: error "no /proc/self/mounts ???"
261: fi
262: }
263:
264: # get /dev/mapper/<name> name, from an equivalent device node or link
265: function get_target_map_name {
266:
267: # ignore possible none value for swap
268: if [ "${1}" == "none" ]; then
269: echo none
270: return
271: fi
272:
273: target_abspath=$( readlink -e "${1}" )
274:
275: # sanity check, perhaps should be done elsewhere
276: if [ ! -b "${target_abspath}" ]; then
277: error "device ${1} is not a block device or a link to one"
278: fi
279:
280: target_major_minor=$( get_major_minor "${target_abspath}" )
281: for device in $( ls -1A /dev/mapper ); do
282: device_major_minor=$( ls -l "/dev/mapper/${device}" | awk '{print $5 $6}' )
283: if [ "${target_major_minor}" == "${device_major_minor}" ]; then
284: # if found, this is the /dev/mapper/ canonicalization
285: echo "/dev/mapper/${device}"
286: return
287: fi
288: done
289:
290: # if it wasn't found, there is no canonicalization to be done
291: echo "${1}"
292: }
293:
294: # get uuid for device
295: function get_uuid {
296: # todo: replace with -o udev and simpler parsing once that version
297: # exists in all supported base OSs
298: /sbin/blkid -o full "${1}" | sed -e 's/^.*UUID=\"//' | sed -e 's/\".*$//'
299: }
300:
301: # log to stdout (and logfile via fh redirect magic)
302: function status {
303: echo "${progname}: $@"
304: }
305:
306: # raise an exception and exit
307: # TODO: check return values on all external commands, raising exception
308: # via this function if so, then of course propogate that exception
309: # to the existing gui exception/error page/mode/facility.
310: function error {
311: status "error: $@"
312: echo -en "\n\n"
313: exit 1
314: }
315:
316: # text based progress 'meter'
317: function progress {
318: status "installation progress - ${1} %"
319: }
320:
321: # dump info into the output/log that may be useful to debug errors
322: function dump_debug_info {
323: status "DEBUG: DUMPING CURRENT mount/dmsetup/losetup STATE"
324: cat /proc/self/mounts
325: if [ -f /proc/self/mountinfo ]; then
326: cat /proc/self/mountinfo
327: fi
328: dmsetup status
329: losetup -a
330: ls -l /dev/root /dev/mapper
331: status "DEBUG: DONE DUMPING CURRENT mount/dmsetup/losetup STATE"
332: }
333:
334: # get_live_loopdev <loopfile>
335: #
336: # returns: /dev/loopNUM that currently maps to specified loopfile
337: #
338: # note: there used to be truncation of long filenames for losetup, however
339: # for this usecase of fedora12+ loop devices, that should not
340: # be a problem (due to known reasonably short paths)
341: #
342: # note: it is extremely convenient that for fedora style LiveOS's that
343: # the in-ram overlay file is named /overlay and that it happens
344: # to be a substring of the persistence overlay file with the
345: # name /overlayfs/overlay-SOME_ID. Long term I'll push for the
346: # reintroduction of the udev rules for the overlay device which
347: # will allow for the removal of this note (and function).
348: #
349: function get_live_loopdev {
350:
351: #
352: # check arg(s)
353: #
354:
355: if [ $# != 1 ]; then
356: error "get_live_loopdev takes a single argument"
357: fi
358:
359: if (! echo "${1}" | grep -q "^/"); then
360: error "get_live_loopdev's target must be an absolute path starting with '/'"
361: else
362: target_looped_file="${1}"
363: fi
364:
365: if (! /sbin/losetup -a | grep -q "${target_looped_file}"); then
366: error "get_live_loopdev: ${target_looped_file} IS NOT CURRENTLY LOOPED"
367: fi
368:
369: result=$( /sbin/losetup -a | \
370: grep "${target_looped_file}" | \
371: sed -e 's/^\(\/.*\):\s.*$/\1/' )
372:
373: echo "${result}"
374: }
375:
376: # set type flag on a partition
377: # note: using sfdisk or parted would probably be an improvement
378: function set_partition_flag {
379: disk="${1}"
380: partition="${2}"
381: type="${3}"
382:
383: num_parts=$( fdisk -l "${disk}" | grep "^${disk}" | wc -l )
384: if [ "${num_parts}" == "1" ]; then
385: echo -en "t\n${type}\nw\n" | fdisk "${disk}"
386: else
387: echo -en "t\n${partition}\n${type}\nw\n" | fdisk "${disk}"
388: fi
389: }
390:
391: #############################################################################
392: #############################################################################
393: ##
394: ## main
395: ##
396: #############################################################################
397: #############################################################################
398:
399: #############################################################################
400: ## inspect running liveos
401: #############################################################################
402:
403: # get running kernel
404: kernelversion=$( uname -r )
405:
406: # get running distrotype
407: if [ -e /etc/zyx-release ]; then
408: distro_type="zyx"
409: distro_string="ZyX"
410: elif [ -e /etc/fedora-release ]; then
411: distro_type="fedora"
412: distro_string="Fedora"
413: elif [ -d /usr/share/doc/centos-release-5 ]; then
414: # centos is close enough to fedora
415: distro_type="fedora"
416: distro_string="CentOS"
417: else
418: error "unknown distro type, not zyx or fedora"
419: fi
420:
421: # i.e. ext3/4
422: rootfs_type=$( cat /etc/fstab | awk '{print $2,$3}' | grep "^/ " | awk '{print $2}' )
423:
424: # check for f11(but not zyx) style seperate /boot requirement
425: # (due to grub-no-grok-ext4-yet)
426: need_seperate_boot="no"
427: if [ -f /etc/fedora-release ]; then
428: if [ "$( < /etc/fedora-release )" == "Fedora release 11 (Leonidas)" ]; then
429: need_seperate_boot="yes"
430: fi
431: fi
432:
433:
434: #############################################################################
435: ## parse commandline
436: #############################################################################
437: if [ $# -ne 3 ]; then
438: if [ $# -eq 2 ]; then
439: target_swap="none"
440: else
441: echo "usage: zyx-liveinstaller <target_root_volume> \\"
442: echo "usage: <target_boot_volume> \\"
443: echo "usage: [<target_swap_volume>=none]"
444: exit 1
445: fi
446: else
447: target_swap="${3}"
448: if [ "${target_swap}" != "none" ]; then
449: if [ ! -e "${target_swap}" ]; then
450: error "target swap device ${target_swap} does not exist"
451: else
452: target_swap=$( readlink -e "${target_swap}" )
453: fi
454: fi
455: fi
456:
457: if [ ! -e "${1}" ]; then
458: error "target root device ${1} does not exist"
459: else
460: target_root=$( readlink -e "${1}" )
461: fi
462:
463: if [ ! -e "${2}" ]; then
464: error "target boot device ${2} does not exist"
465: else
466: # /boot needs to get canonicalized
467: target_boot=$( readlink -e "${2}" )
468: # /boot cannot be lvm (until grub2 in f13?)
469: if ( ! echo "${target_boot}" | grep -q "^/dev/.d." ); then
470: error "/boot must be on a simple partition referencable by /dev/[a-z]d[a-h]*"
471: fi
472: fi
473:
474: # handle case of root and boot on the same volume
475: if [ "${target_root}" == "${target_boot}" ]; then
476: if [ "${need_seperate_boot}" == "yes" ]; then
477: # enforce possible f11 style restriction
478: error "this LiveOS requires seperate / and /boot filesystems"
479: fi
480: # path_to_boot is used to craft the grub config properly
481: path_to_boot="/boot"
482: else
483: path_to_boot=""
484: fi
485:
486: # canonicalize possible lvm root and swap, since external gui passes us
487: # what the /dev/disk/by-id/ symlinks point to
488: target_root=$( get_target_map_name "${target_root}" )
489: target_swap=$( get_target_map_name "${target_swap}" )
490:
491: #############################################################################
492: ## set device name variables for detected LiveOS naming scheme
493: #############################################################################
494:
495: if [ "${distro_type}" == "zyx" ]; then
496: ############
497: # zyx layout
498: ############
499: #
500: # /dev/zyx_root_base -> loop1 ->
501: # -> /container_rootfs/boot/LiveOS/zyx/Guitar-ZyX-0.3.ext3.img
502: liveos_root_base_dev="zyx_root_base"
503: # /dev/zyx_root_container -> loop0 ->
504: # -> /prime_rootfs/boot/LiveOS/zyx/Guitar-ZyX-0.3.squashfs.img
505: liveos_root_container_dev="zyx_root_container"
506: # /dev/zyx_root_overlay -> loop2 ->
507: liveos_root_overlay_dev="zyx_root_overlay"
508: # -> /mnt/.LiveOS/overlayfs/boot/LiveOS/zyx/overlay-Guitar-ZyX-0.3
509: # /dev/zyx_root_overlay_readonly -> loop3 ->
510: # -> /mnt/.LiveOS/overlayfs/boot/LiveOS/zyx/overlay-Guitar-ZyX-0.3
511: # /dev/zyx_root_prime -> sdb1
512: #
513: # /dev/mapper/zyx-liveos-ro -> linear(/dev/zyx_root_base)
514: liveos_root_ro_dev="zyx-liveos-ro"
515: # TODO: ro_dev_mntp could be derived from above and /proc/mounts
516: liveos_root_ro_dev_mntp="/mnt/.LiveOS/precow_rootfs"
517: # /dev/mapper/zyx-liveos-rw -> snapshot(zyx_root_base under zyx_root_overlay)
518: liveos_root_dev="zyx-liveos-rw"
519:
520: # osmin not used by zyx (osimg is already minimized via tar copy)
521: liveos_root_min_overlay_dev="none"
522: liveos_root_min_container_dev="none"
523:
524: elif [ "${distro_type}" == "fedora" ]; then
525:
526: if [ ! -b /dev/live-overlay ]; then
527: ############
528: # f12 layout (sans useful udev links)
529: ############
530: #
531: # loop3 -> /squashfs/LiveOS/ext[34]fs.img
532: liveos_root_base_dev="$( basename $( get_live_loopdev /squashfs/LiveOS/ext.fs.img ) )"
533: # loop1 -> /squashfs.osmin/osmin
534: liveos_root_min_overlay_dev="$( basename $( get_live_loopdev /squashfs.osmin/osmin ) )"
535: # loop4 -> /overlay
536: # note: that /overlay will be a substring in both the normal and
537: # persistence cases.
538: liveos_root_overlay_dev="$( basename $( get_live_loopdev /overlay ) )"
539: # loop2 -> /sysroot/LiveOS/squashfs.img
540: liveos_root_container_dev="$( basename $( get_live_loopdev /sysroot/LiveOS/squashfs.img ) )"
541: # loop0 -> /osmin.img
542: liveos_root_min_container_dev="$( basename $( get_live_loopdev /osmin.img ) )"
543:
544: else
545:
546: ############
547: # f11 layout
548: ############
549: #
550: # /dev/live-osimg -> loop3 -> /squashfs/LiveOS/ext3fs.img
551: liveos_root_base_dev="live-osimg"
552: # /dev/live-osmin -> loop1 -> /squashfs.osmin/osmin
553: liveos_root_min_overlay_dev="live-osmin"
554: # /dev/live-overlay -> loop4 -> /overlay
555: liveos_root_overlay_dev="live-overlay"
556: # /dev/live-squashed -> loop2 -> /sysroot/LiveOS/squashfs.img
557: liveos_root_container_dev="live-squashed"
558: # /dev/live-squashed-osmin -> loop0 -> /osmin.img
559: liveos_root_min_container_dev="live-squashed-osmin"
560:
561: fi
562:
563: #
564: # common
565: #
566:
567: # /dev/mapper/live-rw snapshot(live-osimg under live-overlay)
568: liveos_root_dev="live-rw"
569: liveos_root_ro_dev="none"
570: liveos_root_ro_dev_mntp="none"
571:
572: fi
573:
574:
575: #############################################################################
576: ## setup environment dependent configuration (and sanity checks)
577: #############################################################################
578:
579: if [ -x /sbin/dracut ]; then
580: mkinitramfs=/sbin/dracut
581: initramfs_name="initramfs"
582: elif [ -x /sbin/mkinitrd ]; then
583: mkinitramfs=/sbin/mkinitrd
584: initramfs_name="initrd"
585: else
586: error "no initramfs generator found, need mkinitrd or dracut"
587: fi
588:
589: # need blkid for device uuid retrieval
590: if [ ! -x /sbin/blkid ]; then
591: error "/sbin/blkid not found"
592: fi
593:
594: # check if root and boot devices are large enough
595: if [ "$( fdisk -s ${target_root} )" -lt "$( fdisk -s /dev/root )" ]; then
596: error "target root size - $( fdisk -s ${target_root} )(kb) - is less than live root size - $( fdisk -s /dev/root )(kb)"
597: fi
598:
599: if [ "$( fdisk -s ${target_boot} )" -lt "$(( 32 * 1024 ))" ]; then
600: error "target boot size - $( fdisk -s ${target_boot} )(kb) - is less than 32MB"
601: fi
602:
603:
604: #############################################################################
605: ## hello user
606: #############################################################################
607:
608: status "beginning install to targets:: root:${target_root} boot:${target_boot} swap:${target_swap}"
609: progress "1.00"
610:
611: self_version_checksum=$( sha512sum "${progdir}/${progname}" )
612: status "self version checksum : ${self_version_checksum}"
613:
614: status "dumping debug info: before any install action"
615: dump_debug_info
616:
617:
618: #############################################################################
619: ## try to allow target disk(s)'s part tables to be reread by kernel
620: #############################################################################
621:
622: ##
623: ## disable existing (autoenabled) swaps
624: ##
625:
626: # disable possibly auto-enabled swap(s) while futzing with partition tables
627: # note: now that I realize lvm may be tying up the drives as well as swap, the
628: # motivation for this is less. The whole 'kernel still uses old table'
629: # seemed in one test, to be quite harmless. ... Though just now with
630: # centos-5.4 under qemu (hd* devices), resizing did not contribute to
631: # the output of blockdev --getsz or fdisk -s until the part table could
632: # be reread by unmounting and swapoffing every partiton on the disk
633: # in question.
634: #
635: status "disabling any auto-enabled swaps"
636: /sbin/swapoff -a
637: progress "1.50"
638:
639: status "attempting to unmount targets, possibly mounted by automounter"
640: try_unmount "${target_root}"
641: try_unmount "${target_boot}"
642: try_unmount "${target_swap}"
643:
644: #############################################################################
645: ## install: modify partition table data as necessary
646: #############################################################################
647:
648: #
649: # This sections sets bootable and type flags in the partition table as
650: # appropriate. That is the current maximum extent of dealing with the
651: # partition table.
652: # (i.e. it is up to the user to resize/repartition/lvm-config as desired).
653: #
654:
655: boot_target_disk_let=$( get_target_disk_let "${target_boot}" )
656: boot_target_disk_type=$( get_target_disk_type "${target_boot}" )
657:
658: # this if should only be false in the esoteric case of a whole-disk /boot choice
659: if ( echo "${target_boot}" | grep -q "^/dev/.d.." ); then
660:
661: boot_target_part_num=$( get_target_part_num "${target_boot}" )
662:
663: current_boot_flag=$( fdisk -l "/dev/${boot_target_disk_type}d${boot_target_disk_let}" | grep "${boot_target_disk_type}d${boot_target_disk_let}${boot_target_part_num}" | awk '{print $2}' )
664: if [ "${current_boot_flag}" == '*' ]; then
665: status "target partition is already bootable"
666: else
667: status "activating target partition"
668: echo -en "a\n${boot_target_part_num}\nw\n" | fdisk "/dev/${boot_target_disk_type}d${boot_target_disk_let}"
669: fi
670: progress "1.75"
671:
672: status "setting ${rootfs_type} partition flag on target boot partition"
673: set_partition_flag \
674: "/dev/${boot_target_disk_type}d${boot_target_disk_let}" \
675: "${boot_target_part_num}" \
676: "83"
677: progress "2.00"
678: fi
679:
680: # this if will be false for wholedisks as well as lvm, either way, no part-table
681: if ( echo "${target_root}" | grep -q "^/dev/.d.." ); then
682: status "setting ${rootfs_type} partition flag on target root partition"
683: root_target_disk_type=$( get_target_disk_type "${target_root}" )
684: root_target_disk_let=$( get_target_disk_let "${target_root}" )
685: root_target_part_num=$( get_target_part_num "${target_root}" )
686: set_partition_flag \
687: "/dev/${root_target_disk_type}d${root_target_disk_let}" \
688: "${root_target_part_num}" \
689: "83"
690: progress "2.25"
691: fi
692:
693:
694: # this if will be false for wholedisks as well as lvm, either way, no part-table
695: if ( echo "${target_swap}" | grep -q "^/dev/.d.." ); then
696: status "setting swap partition flag on target swap partition"
697: swap_target_disk_type=$( get_target_disk_type "${target_swap}" )
698: swap_target_disk_let=$( get_target_disk_let "${target_swap}" )
699: swap_target_part_num=$( get_target_part_num "${target_swap}" )
700: set_partition_flag \
701: "/dev/${swap_target_disk_type}d${swap_target_disk_let}" \
702: "${swap_target_part_num}" \
703: "82"
704: fi
705: progress "3.00"
706:
707: #############################################################################
708: ## install: enable new swap
709: #############################################################################
710:
711: # enable swap ASAP (after fdisk futzing) to avoid low memory issues
712: if [ "${target_swap}" != "none" ]; then
713: status "enabling new swaps"
714: status "formatting swap (${target_swap})..."
715: mkswap "${target_swap}"
716: progress "3.50"
717: /sbin/swapon "${target_swap}"
718: fi
719: progress "4.00"
720:
721:
722: #############################################################################
723: ## install: fight aggressive automounter
724: #############################################################################
725:
726: # race condition, one day I'll control the automounter better...
727: sleep 7
728:
729: status "dumping debug info: just before try_unmounts"
730: dump_debug_info
731:
732: status "attempting to unmount targets, possibly mounted by automounter"
733: try_unmount "${target_root}"
734: try_unmount "${target_boot}"
735: try_unmount "${target_swap}"
736:
737: #############################################################################
738: ## install: live migrate the rootfs
739: #############################################################################
740:
741: # setup dmsetup and dependencies in tmpfs
742: status "preparing non rootfs dmsetup in tmpfs in /dev/shm/zyx-liveinstaller"
743: mkdir -p /dev/shm/zyx-liveinstaller
744: cp -av --dereference \
745: "$( which dmsetup )" \
746: /dev/shm/zyx-liveinstaller/
747: for dep in $( ldd /dev/shm/zyx-liveinstaller/dmsetup ); do
748: if $( echo "${dep}" | grep -q '^/' ); then
749: cp -av --dereference \
750: "${dep}" \
751: /dev/shm/zyx-liveinstaller/
752: fi
753: done
754:
755: status "creating temporary rootfs virtual duplicate initially suspended"
756: liveos_root_size=$( blockdev --getsize "/dev/mapper/${liveos_root_dev}" )
757: dmsetup --noudevrules --noudevsync \
758: create "${liveos_root_dev}-sub" --notable
759: dmsetup --noudevrules --noudevsync \
760: load "${liveos_root_dev}-sub" \
761: --table="0 ${liveos_root_size} snapshot /dev/${liveos_root_base_dev} /dev/${liveos_root_overlay_dev} p 8"
762: # TODO: catch all errors similarly, or create an eval wrapper
763: if [ $? -ne 0 ]; then
764: error "failed to create temporary rootfs virtual duplicate initially suspended"
765: fi
766:
767: status "loading mirror configuration"
768: # note: the hardcoded values here should match what the liveOS creation tool
769: # utilized in the initramfs generation code.
770: dmsetup --noudevrules --noudevsync \
771: load "${liveos_root_dev}" \
772: --table="0 ${liveos_root_size} mirror core 2 32 sync 2 /dev/mapper/${liveos_root_dev}-sub 0 ${target_root} 0"
773: if [ $? -ne 0 ]; then
774: error "failed to load mirror table for rootfs"
775: fi
776:
777: status "dumping debug info: just before initiation of rootfs migration"
778: dump_debug_info
779:
780: status "loading and activating mirror configuration"
781: LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
782: /dev/shm/zyx-liveinstaller/dmsetup \
783: --noudevrules --noudevsync \
784: suspend "${liveos_root_dev}"
785: LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
786: /dev/shm/zyx-liveinstaller/dmsetup \
787: --noudevrules --noudevsync \
788: resume "${liveos_root_dev}-sub"
789: LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
790: /dev/shm/zyx-liveinstaller/dmsetup \
791: --noudevrules --noudevsync \
792: resume "${liveos_root_dev}"
793:
794: status "migrating live root filesystem"
795: done=0
796: while (( ! ${done} )); do
797: percent_done_fraction_string=$( dmsetup status "${liveos_root_dev}" | awk '{print $7}' )
798: percent_done=$( echo "scale=11;${percent_done_fraction_string}" | bc -l )
799: # the mirror is considered as progress from 5 to 5 + 70
800: percent_done_display=$( echo "scale=2;(${percent_done} * 70 + 5) / 1.0" | bc -l )
801: progress "${percent_done_display}"
802:
803: # update progress output every 3 seconds until done
804: if [ "$percent_done" = "1.00000000000" ]; then
805: done=1
806: else
807: sleep 3
808: fi
809: done
810:
811: status "unloading mirror configuration"
812: target_root_size=$( blockdev --getsize "${target_root}" )
813: dmsetup --noudevrules --noudevsync \
814: reload "${liveos_root_dev}" \
815: --table="0 ${target_root_size} linear ${target_root} 0"
816: progress "77.00"
817:
818: status "deactivating mirror configuration"
819: dmsetup --noudevrules --noudevsync \
820: resume "${liveos_root_dev}"
821: progress "78.00"
822:
823: rm -rf /dev/shm/zyx-liveinstaller
824:
825: #############################################################################
826: ## install: dereferencing symlinks to the livemedia before freeing it
827: #############################################################################
828:
829: if [ "${distro_type}" == "zyx" ]; then
830:
831: # ZyX(tm) spiffily saves space by not storing redundant copies of the same
832: # 3MB kernel file on the Live media.
833:
834: # unsymlinkify kernel
835: rm -f "/boot/vmlinuz-${kernelversion}"
836: cp /mnt/.LiveOS/prime_rootfs/boot/vmlinuz.1 \
837: "/boot/vmlinuz-${kernelversion}"
838:
839: # unsymlinkify zyx-live-iso-to-disk
840: cp $( readlink -f /usr/bin/zyx-live-iso-to-disk ) \
841: /usr/bin/zyx-live-iso-to-disk.actual
842: rm -f /usr/bin/zyx-live-iso-to-disk
843: mv /usr/bin/zyx-live-iso-to-disk.actual \
844: /usr/bin/zyx-live-iso-to-disk
845: fi
846: progress "79.00"
847:
848:
849: #############################################################################
850: ## install: free livemedia resources
851: #############################################################################
852:
853: status "freeing livemedia resources: ${liveos_root_dev}-sub"
854: dmsetup remove "${liveos_root_dev}-sub"
855:
856: if [ "${distro_type}" == "zyx" ]; then
857:
858: status "freeing livemedia resources: precow_rootfs mount"
859: umount -l /mnt/.LiveOS/precow_rootfs
860:
861: status "freeing livemedia resources: zyx-liveos-ro"
862: dmsetup remove zyx-liveos-ro
863: fi
864:
865:
866: status "freeing livemedia resources: loopdev-${liveos_root_overlay_dev}"
867: losetup -d "/dev/${liveos_root_overlay_dev}"
868:
869: if [ "${distro_type}" == "zyx" ]; then
870: losetup -d "/dev/${liveos_root_overlay_dev}_readonly"
871:
872: # bug workaround
873: # note: I haven't looked at whether this and other -l's are necessary
874: # in years.
875: # unmount the overlayfs when the image it contains is no longer in use
876: # XXX: need to make this conditional, i.e. not mounted when normal livedvdboot
877: umount -l /mnt/.LiveOS/overlayfs > /dev/null 2>&1
878:
879: elif [ "${distro_type}" == "fedora" ]; then
880:
881: # note: ifs are for now for centos sharing the distrotype
882:
883: # nautilus automounting could use more configuration facilitation
884: if [ -b /dev/mapper/live-osimg-min ]; then
885: try_unmount "/dev/mapper/live-osimg-min"
886:
887: status "freeing unneeded resources: live-osimg-min"
888: dmsetup remove live-osimg-min
889: fi
890:
891: if [ -b "/dev/${liveos_root_min_overlay_dev}" ]; then
892: status "freeing unneeded resources: loopdev-live-osmin"
893: losetup -d "/dev/${liveos_root_min_overlay_dev}"
894: fi
895:
896: if [ -b "/dev/${liveos_root_min_container_dev}" ]; then
897: status "freeing unneeded resources: loopdev-live-squashed-osmin"
898: losetup -d "/dev/${liveos_root_min_container_dev}"
899: fi
900:
901: fi
902:
903: status "freeing livemedia resources: loopdev-${liveos_root_base_dev}"
904: losetup -d "/dev/${liveos_root_base_dev}"
905:
906: if [ "${distro_type}" == "zyx" ]; then
907: # unmount the container_rootfs when the image it contains is no longer in use
908: umount -l /mnt/.LiveOS/container_rootfs
909: fi
910:
911: status "freeing livemedia resources: loopdev-${liveos_root_container_dev}"
912: losetup -d "/dev/${liveos_root_container_dev}"
913:
914: if [ "${distro_type}" == "zyx" ]; then
915: # install music from the LiveMedia as well
916: if [ -d /mnt/.LiveOS/prime_rootfs/music ]; then
917: cp -av /mnt/.LiveOS/prime_rootfs/music /usr/share
918: fi
919: # unmount the prime_rootfs when the image it contains is no longer in use
920: umount -l /mnt/.LiveOS/prime_rootfs
921: # keep user symlinks working
922: mkdir -p /mnt/.LiveOS/prime_rootfs
923: ln -s /usr/share/music \
924: /mnt/.LiveOS/prime_rootfs/music
925:
926: elif [ "${distro_type}" == "fedora" ]; then
927: umount /mnt/live
928: fi
929:
930: # undo fedora's special Live tmpfs usage
931: if [ "${distro_type}" == "fedora" ]; then
932:
933: # migrate as much as possible out of tmpfs /var/cache/yum to rootfs
934: cp -av /var/cache/yum /var/cache/.newyum
935: umount -l /var/cache/yum
936: mv /var/cache/yum /var/cache/.oldyum
937: mv /var/cache/.newyum /var/cache/yum
938:
939: # migrate as much as possible out of tmpfs /var/tmp to rootfs
940: cp -av /var/tmp /var/.newtmp
941:
942: umount -l /var/tmp
943: mv /var/tmp /var/.oldtmp
944: mv /var/.newtmp /var/tmp
945:
946: if ( cat /proc/self/mounts | awk '{print $2}' | grep -q '^/tmp$' ); then
947: # migrate as much as possible out of tmpfs tmp to rootfs
948: # yes, this is sick, in both the good and bad way
949: mkdir /.oldtmp
950: chmod 777 /.oldtmp
951: chmod +t /.oldtmp
952: mkdir /.newtmp
953: chmod 777 /.newtmp
954: chmod +t /.newtmp
955: for file in $( find /tmp -maxdepth 1 -mindepth 1 ); do
956: filename=$( basename "${file}" )
957: ln -s \
958: "/.oldtmp/${filename}" \
959: "/.newtmp/${filename}"
960: chown \
961: --no-dereference \
962: --reference="/.oldtmp/${filename}" \
963: "/.newtmp/${filename}"
964: done
965: mount --bind /tmp /.oldtmp
966: umount -l /tmp
967: mount --bind /.newtmp /tmp
968: fi
969: fi
970:
971: progress "80.00"
972:
973:
974: ## XXX el6, perhaps better fixed via udev config
975: if [ ! -f "/dev/mapper/${liveos_root_dev}" ]; then
976: ln -s "/dev/disk/by-id/dm-name-${liveos_root_dev}" \
977: "/dev/mapper/${liveos_root_dev}"
978: fi
979:
980:
981: #############################################################################
982: ## install: resize rootfs to full installed size
983: #############################################################################
984:
985: status "expanding root filesystem to largest possible size"
986: resize2fs -p "/dev/mapper/${liveos_root_dev}"
987: # give a non-live-os label to the rootfs
988: status "setting root filesystem label to zyx-rootfs"
989: e2label /dev/root zyx-rootfs
990: status "randomizing initial rootfs uuid"
991: tune2fs -U random "/dev/mapper/${liveos_root_dev}"
992: progress "90.00"
993:
994:
995: #############################################################################
996: ## install: configure /dev/root
997: #############################################################################
998:
999: status "configuring /dev/root symlink"
1000: rm -f /dev/root
1001: ln -s "${target_root}" /dev/root
1002: progress "91.00"
1003:
1004: #############################################################################
1005: ## install: configure /etc/fstab
1006: #############################################################################
1007:
1008: status "configuring fstab"
1009: mv /etc/fstab /tmp/zyx-liveinstaller.old.fstab
1010:
1011: # fedora likes the UUIDs, and grubby can't seem to work without them.
1012: if ( blkid -o full "${target_root}" | grep -q UUID ); then
1013: if [ "${distro_string}" != "CentOS" ]; then
1014: # CentOS-5.4 mkinitrd's nash's resolvedevice function
1015: # will prefer an lvm linear mapping to the native partition,
1016: # resulting in an unbootable initrd for such a case
1017: target_root_uuid=$( get_uuid "${target_root}" )
1018: fstab_root_entry="UUID=${target_root_uuid}"
1019: else
1020: fstab_root_entry="${target_root}"
1021: fi
1022: else
1023: fstab_root_entry="${target_root}"
1024: fi
1025:
1026: if ( blkid -o full "${target_swap}" | grep -q UUID ); then
1027: target_swap_uuid=$( get_uuid "${target_swap}" )
1028: fstab_swap_entry="UUID=${target_swap_uuid}"
1029: else
1030: fstab_swap_entry="${target_swap}"
1031: fi
1032:
1033: # generate new fstab
1034: cat<<EOF> /etc/fstab
1035: ${fstab_root_entry} / ${rootfs_type} defaults,noatime 0 0
1036: devpts /dev/pts devpts gid=5,mode=620 0 0
1037: tmpfs /dev/shm tmpfs defaults 0 0
1038: proc /proc proc defaults 0 0
1039: sysfs /sys sysfs defaults 0 0
1040: EOF
1041:
1042: if [ "${target_swap}" != "none" ]; then
1043: cat<<EOF>> /etc/fstab
1044: ${fstab_swap_entry} swap swap swap 0 0
1045: EOF
1046: fi
1047:
1048: progress "92.00"
1049:
1050: #############################################################################
1051: ## install: LiveOS deconfiguration
1052: #############################################################################
1053: status "unconfiguring LiveOS boot environment"
1054: # TODO: need to also undo everything done live initrd
1055: # TODO: need to also undo everything done by init.d/*live*
1056: # (perhaps more than just this)
1057:
1058:
1059: if [ "${distro_type}" == "zyx" ]; then
1060: rm -f /.zyxlive*
1061:
1062: rm -f /etc/rc.d/rc0.d/S01halt
1063: ln -s ../init.d/halt /etc/rc.d/rc0.d/S01halt
1064: # TODO: rc.sysinit... needs about half its differences undone
1065:
1066: elif [ "${distro_type}" == "fedora" ]; then
1067:
1068: # remove entries added to udev by initrd
1069: if [ -f /lib/udev/rules.d/50-udev-default.rules ]; then
1070: mv /lib/udev/rules.d/50-udev-default.rules /tmp
1071: cat /tmp/50-udev-default.rules | \
1072: grep -v "=\"live" > /lib/udev/rules.d/50-udev-default.rules
1073: chmod 644 /lib/udev/rules.d/50-udev-default.rules
1074: restorecon /lib/udev/rules.d/50-udev-default.rules
1075: fi
1076:
1077: rm -f /home/centos/Desktop/liveinst.desktop
1078: rm -f /home/centos/Desktop/zyx-liveinstaller.desktop
1079: rm -f /home/liveuser/Desktop/liveinst.desktop
1080: rm -f /home/liveuser/Desktop/zyx-liveinstaller.desktop
1081: fi
1082:
1083: rm -f /.live*
1084: progress "93.00"
1085:
1086: #############################################################################
1087: ## install: boot volume creation
1088: #############################################################################
1089: if [ "${target_root}" != "${target_boot}" ]; then
1090: status "formatting /boot (${target_boot})..."
1091:
1092: # use same fstype as rootfs, unless f11
1093: if [ "${need_seperate_boot}" == "yes" ]; then
1094: bootfs_type="ext3"
1095: else
1096: bootfs_type="${rootfs_type}"
1097: fi
1098:
1099: "mkfs.${bootfs_type}" "${target_boot}"
1100:
1101: if ( blkid -o full "${target_boot}" | grep -q UUID ); then
1102: target_boot_uuid=$( get_uuid "${target_boot}" )
1103: fstab_boot_entry="UUID=${target_boot_uuid}"
1104: else
1105: fstab_boot_entry="${target_boot}"
1106: fi
1107:
1108: status "adding /boot to fstab..."
1109: cat<<EOF>> /etc/fstab
1110: ${fstab_boot_entry} /boot ${bootfs_type} defaults,noatime 0 0
1111: EOF
1112:
1113: status "setting up /boot"
1114: mv /boot /boot.tmp
1115: mkdir /boot
1116: mount /boot
1117: cp -a /boot.tmp/* /boot
1118: rm -rf /boot.tmp
1119: fi
1120: progress "94.00"
1121:
1122:
1123: #############################################################################
1124: ## install: make initramfs
1125: #############################################################################
1126:
1127: status "making initramfs"
1128:
1129: if [ "${distro_type}" == "zyx" ]; then
1130: # I own an epia10k, and this has been required
1131: ${mkinitramfs} \
1132: --add pata_via \
1133: "/boot/${initramfs_name}-${kernelversion}.img" \
1134: "${kernelversion}"
1135: else
1136: ${mkinitramfs} \
1137: "/boot/${initramfs_name}-${kernelversion}.img" \
1138: "${kernelversion}"
1139: fi
1140:
1141: progress "96.00"
1142:
1143: #############################################################################
1144: ## install: bootloader configuration
1145: #############################################################################
1146:
1147: status "configuring grub"
1148:
1149: # calculate target disk reference values
1150: if ( echo "${target_boot}" | grep -q "^/dev/.d.." ); then
1151: boot_grub_target_part_num=$( get_grub_target_part_num "${target_boot}" )
1152: boot_grub_target_disk_num=$( get_grub_target_disk_num "${target_boot}" )
1153: boot_grub_target_parent_disk_spec="(hd${boot_grub_target_disk_num})"
1154: boot_grub_target_disk_spec="(hd${boot_grub_target_disk_num},${boot_grub_target_part_num})"
1155:
1156: elif ( echo "${target_boot}" | grep -q "^/dev/.d." ); then
1157: # wholedisk corner case
1158: boot_grub_target_disk_num=$( get_grub_target_disk_num "${target_boot}" )
1159: boot_grub_target_parent_disk_spec="(hd${boot_grub_target_disk_num})"
1160: fi
1161:
1162: # if /boot is on an external usb drive, force drive 0 in grub.cfg disk spec,
1163: # e.g. (hd2... with (hd0...
1164: if ( /lib/udev/path_id "/block/${boot_target_disk_type}d${boot_target_disk_let}" | grep -q "\-usb\-" ); then
1165: cfg_boot_target_disk_let="a"
1166: cfg_boot_target_disk_type="s"
1167: cfg_boot_grub_target_disk_spec=$( echo "${boot_grub_target_disk_spec}" | sed -e 's/^(hd./(hd0/' )
1168: else
1169: cfg_boot_target_disk_let="${boot_target_disk_let}"
1170: cfg_boot_target_disk_type="${boot_target_disk_type}"
1171: cfg_boot_grub_target_disk_spec="${boot_grub_target_disk_spec}"
1172: fi
1173:
1174: # detect and collect kernel arguments that should be put in grub.conf
1175: kargs=""
1176: for karg in $( < /proc/cmdline ); do
1177: # strip out ^initrd= ^root= ^rootfstype= ro rw liveimg ^overlay
1178: # ^BOOT_IMAGE=, [1-5], leaving rhgb, quiet, and whatever else
1179: if ( echo "${karg}" | grep -q "^initrd=" ); then
1180: kargs="${kargs}"
1181: elif ( echo "${karg}" | grep -q "^root=" ); then
1182: kargs="${kargs}"
1183: elif ( echo "${karg}" | grep -q "^rootfstype=" ); then
1184: kargs="${kargs}"
1185: elif ( echo "${karg}" | grep -q "^ro" ); then
1186: kargs="${kargs}"
1187: elif ( echo "${karg}" | grep -q "^rw" ); then
1188: kargs="${kargs}"
1189: elif ( echo "${karg}" | grep -q "^liveimg" ); then
1190: kargs="${kargs}"
1191: elif ( echo "${karg}" | grep -q "^[12345]" ); then
1192: kargs="${kargs}"
1193: elif ( echo "${karg}" | grep -q "^overlay" ); then
1194: kargs="${kargs}"
1195: elif ( echo "${karg}" | grep -q "^reset_overlay" ); then
1196: kargs="${kargs}"
1197: elif ( echo "${karg}" | grep -q "^autojam" ); then
1198: kargs="${kargs}"
1199: elif ( echo "${karg}" | grep -q "^BOOT_IMAGE=" ); then
1200: kargs="${kargs}"
1201: else
1202: kargs="${kargs} ${karg}"
1203: fi
1204: done
1205:
1206: # write out new simple grub configuration
1207: cat<<EOF> /boot/grub/grub.conf
1208: # grub.conf generated by anaconda
1209: #
1210: # Note that you do not have to rerun grub after making changes to this file
1211: # NOTICE: You have a /boot partition. This means that
1212: # all kernel and initrd paths are relative to /boot/, eg.
1213: # root ${cfg_boot_grub_target_disk_spec}
1214: # kernel ${path_to_boot}/vmlinuz-version ro root=${fstab_root_entry}${kargs}
1215: # initrd ${path_to_boot}/${initramfs_name}-version.img
1216: #boot=/dev/${cfg_boot_target_disk_type}d${cfg_boot_target_disk_let}
1217: default=0
1218: timeout=0
1219: splashimage=${cfg_boot_grub_target_disk_spec}${path_to_boot}/grub/splash.xpm.gz
1220: hiddenmenu
1221: title ${distro_string} (${kernelversion})
1222: root ${cfg_boot_grub_target_disk_spec}
1223: kernel ${path_to_boot}/vmlinuz-${kernelversion} ro root=${fstab_root_entry}${kargs}
1224: initrd ${path_to_boot}/${initramfs_name}-${kernelversion}.img
1225: EOF
1226:
1227: # in ZyX this is already in place
1228: if [ ! -L /etc/grub.conf ]; then
1229: ln -s ../boot/grub/grub.conf /etc/grub.conf
1230: fi
1231:
1232: status "configuring grubby kernel updates"
1233: cat << EOF > /etc/sysconfig/kernel
1234: # UPDATEDEFAULT specifies if new-kernel-pkg should make
1235: # new kernels the default
1236: UPDATEDEFAULT=yes
1237:
1238: # DEFAULTKERNEL specifies the default kernel package type
1239: DEFAULTKERNEL=kernel
1240: EOF
1241:
1242: progress "98.00"
1243:
1244: #############################################################################
1245: ## install: bootloader installation
1246: #############################################################################
1247:
1248: status "installing grub bootloader"
1249: cp /usr/share/grub/i386-redhat/*stage* /boot/grub/
1250:
1251: echo -en "root ${boot_grub_target_disk_spec}\nsetup ${boot_grub_target_parent_disk_spec}\n" | grub --batch
1252: # grub output doesn't (always) end with a newline
1253: echo -en "\n"
1254:
1255: status "dumping debug info: installer end"
1256: dump_debug_info
1257:
1258: progress "100.00"
1259:
1260:
1261: #############################################################################
1262: ## install: done
1263: #############################################################################
1264:
1265: status "you may now eject or remove the live media"
1266: status "installation complete, enjoy... -dmc"
1267:
1268:
1269: #############################################################################
1270: ## exit: restore stdout and close fd3(logfile), then exit
1271: #############################################################################
1272:
1273: exec 1>&3 3>&-
1274: exec 2>&4 4>&-
1275: exit 0
1276:
1277: #############################################################################
1278: ## done
1279: #############################################################################
1280: ###
1281: ########################################################################
1282: ########################################################################
1283: ########################################################################
1284: ###### Copyright 2009 Douglas McClendon <dmc AT viros DOT org> #######
1285: ########################################################################
1286: ########################################################################
1287: ########################################################################
1288: ###
1289:
1290:
1291: # GNU GENERAL PUBLIC LICENSE
1292: # Version 3, 29 June 2007
1293: #
1294: # Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
1295: # Everyone is permitted to copy and distribute verbatim copies
1296: # of this license document, but changing it is not allowed.
1297: #
1298: # Preamble
1299: #
1300: # The GNU General Public License is a free, copyleft license for
1301: # software and other kinds of works.
1302: #
1303: # The licenses for most software and other practical works are designed
1304: # to take away your freedom to share and change the works. By contrast,
1305: # the GNU General Public License is intended to guarantee your freedom to
1306: # share and change all versions of a program--to make sure it remains free
1307: # software for all its users. We, the Free Software Foundation, use the
1308: # GNU General Public License for most of our software; it applies also to
1309: # any other work released this way by its authors. You can apply it to
1310: # your programs, too.
1311: #
1312: # When we speak of free software, we are referring to freedom, not
1313: # price. Our General Public Licenses are designed to make sure that you
1314: # have the freedom to distribute copies of free software (and charge for
1315: # them if you wish), that you receive source code or can get it if you
1316: # want it, that you can change the software or use pieces of it in new
1317: # free programs, and that you know you can do these things.
1318: #
1319: # To protect your rights, we need to prevent others from denying you
1320: # these rights or asking you to surrender the rights. Therefore, you have
1321: # certain responsibilities if you distribute copies of the software, or if
1322: # you modify it: responsibilities to respect the freedom of others.
1323: #
1324: # For example, if you distribute copies of such a program, whether
1325: # gratis or for a fee, you must pass on to the recipients the same
1326: # freedoms that you received. You must make sure that they, too, receive
1327: # or can get the source code. And you must show them these terms so they
1328: # know their rights.
1329: #
1330: # Developers that use the GNU GPL protect your rights with two steps:
1331: # (1) assert copyright on the software, and (2) offer you this License
1332: # giving you legal permission to copy, distribute and/or modify it.
1333: #
1334: # For the developers' and authors' protection, the GPL clearly explains
1335: # that there is no warranty for this free software. For both users' and
1336: # authors' sake, the GPL requires that modified versions be marked as
1337: # changed, so that their problems will not be attributed erroneously to
1338: # authors of previous versions.
1339: #
1340: # Some devices are designed to deny users access to install or run
1341: # modified versions of the software inside them, although the manufacturer
1342: # can do so. This is fundamentally incompatible with the aim of
1343: # protecting users' freedom to change the software. The systematic
1344: # pattern of such abuse occurs in the area of products for individuals to
1345: # use, which is precisely where it is most unacceptable. Therefore, we
1346: # have designed this version of the GPL to prohibit the practice for those
1347: # products. If such problems arise substantially in other domains, we
1348: # stand ready to extend this provision to those domains in future versions
1349: # of the GPL, as needed to protect the freedom of users.
1350: #
1351: # Finally, every program is threatened constantly by software patents.
1352: # States should not allow patents to restrict development and use of
1353: # software on general-purpose computers, but in those that do, we wish to
1354: # avoid the special danger that patents applied to a free program could
1355: # make it effectively proprietary. To prevent this, the GPL assures that
1356: # patents cannot be used to render the program non-free.
1357: #
1358: # The precise terms and conditions for copying, distribution and
1359: # modification follow.
1360: #
1361: # TERMS AND CONDITIONS
1362: #
1363: # 0. Definitions.
1364: #
1365: # "This License" refers to version 3 of the GNU General Public License.
1366: #
1367: # "Copyright" also means copyright-like laws that apply to other kinds of
1368: # works, such as semiconductor masks.
1369: #
1370: # "The Program" refers to any copyrightable work licensed under this
1371: # License. Each licensee is addressed as "you". "Licensees" and
1372: # "recipients" may be individuals or organizations.
1373: #
1374: # To "modify" a work means to copy from or adapt all or part of the work
1375: # in a fashion requiring copyright permission, other than the making of an
1376: # exact copy. The resulting work is called a "modified version" of the
1377: # earlier work or a work "based on" the earlier work.
1378: #
1379: # A "covered work" means either the unmodified Program or a work based
1380: # on the Program.
1381: #
1382: # To "propagate" a work means to do anything with it that, without
1383: # permission, would make you directly or secondarily liable for
1384: # infringement under applicable copyright law, except executing it on a
1385: # computer or modifying a private copy. Propagation includes copying,
1386: # distribution (with or without modification), making available to the
1387: # public, and in some countries other activities as well.
1388: #
1389: # To "convey" a work means any kind of propagation that enables other
1390: # parties to make or receive copies. Mere interaction with a user through
1391: # a computer network, with no transfer of a copy, is not conveying.
1392: #
1393: # An interactive user interface displays "Appropriate Legal Notices"
1394: # to the extent that it includes a convenient and prominently visible
1395: # feature that (1) displays an appropriate copyright notice, and (2)
1396: # tells the user that there is no warranty for the work (except to the
1397: # extent that warranties are provided), that licensees may convey the
1398: # work under this License, and how to view a copy of this License. If
1399: # the interface presents a list of user commands or options, such as a
1400: # menu, a prominent item in the list meets this criterion.
1401: #
1402: # 1. Source Code.
1403: #
1404: # The "source code" for a work means the preferred form of the work
1405: # for making modifications to it. "Object code" means any non-source
1406: # form of a work.
1407: #
1408: # A "Standard Interface" means an interface that either is an official
1409: # standard defined by a recognized standards body, or, in the case of
1410: # interfaces specified for a particular programming language, one that
1411: # is widely used among developers working in that language.
1412: #
1413: # The "System Libraries" of an executable work include anything, other
1414: # than the work as a whole, that (a) is included in the normal form of
1415: # packaging a Major Component, but which is not part of that Major
1416: # Component, and (b) serves only to enable use of the work with that
1417: # Major Component, or to implement a Standard Interface for which an
1418: # implementation is available to the public in source code form. A
1419: # "Major Component", in this context, means a major essential component
1420: # (kernel, window system, and so on) of the specific operating system
1421: # (if any) on which the executable work runs, or a compiler used to
1422: # produce the work, or an object code interpreter used to run it.
1423: #
1424: # The "Corresponding Source" for a work in object code form means all
1425: # the source code needed to generate, install, and (for an executable
1426: # work) run the object code and to modify the work, including scripts to
1427: # control those activities. However, it does not include the work's
1428: # System Libraries, or general-purpose tools or generally available free
1429: # programs which are used unmodified in performing those activities but
1430: # which are not part of the work. For example, Corresponding Source
1431: # includes interface definition files associated with source files for
1432: # the work, and the source code for shared libraries and dynamically
1433: # linked subprograms that the work is specifically designed to require,
1434: # such as by intimate data communication or control flow between those
1435: # subprograms and other parts of the work.
1436: #
1437: # The Corresponding Source need not include anything that users
1438: # can regenerate automatically from other parts of the Corresponding
1439: # Source.
1440: #
1441: # The Corresponding Source for a work in source code form is that
1442: # same work.
1443: #
1444: # 2. Basic Permissions.
1445: #
1446: # All rights granted under this License are granted for the term of
1447: # copyright on the Program, and are irrevocable provided the stated
1448: # conditions are met. This License explicitly affirms your unlimited
1449: # permission to run the unmodified Program. The output from running a
1450: # covered work is covered by this License only if the output, given its
1451: # content, constitutes a covered work. This License acknowledges your
1452: # rights of fair use or other equivalent, as provided by copyright law.
1453: #
1454: # You may make, run and propagate covered works that you do not
1455: # convey, without conditions so long as your license otherwise remains
1456: # in force. You may convey covered works to others for the sole purpose
1457: # of having them make modifications exclusively for you, or provide you
1458: # with facilities for running those works, provided that you comply with
1459: # the terms of this License in conveying all material for which you do
1460: # not control copyright. Those thus making or running the covered works
1461: # for you must do so exclusively on your behalf, under your direction
1462: # and control, on terms that prohibit them from making any copies of
1463: # your copyrighted material outside their relationship with you.
1464: #
1465: # Conveying under any other circumstances is permitted solely under
1466: # the conditions stated below. Sublicensing is not allowed; section 10
1467: # makes it unnecessary.
1468: #
1469: # 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
1470: #
1471: # No covered work shall be deemed part of an effective technological
1472: # measure under any applicable law fulfilling obligations under article
1473: # 11 of the WIPO copyright treaty adopted on 20 December 1996, or
1474: # similar laws prohibiting or restricting circumvention of such
1475: # measures.
1476: #
1477: # When you convey a covered work, you waive any legal power to forbid
1478: # circumvention of technological measures to the extent such circumvention
1479: # is effected by exercising rights under this License with respect to
1480: # the covered work, and you disclaim any intention to limit operation or
1481: # modification of the work as a means of enforcing, against the work's
1482: # users, your or third parties' legal rights to forbid circumvention of
1483: # technological measures.
1484: #
1485: # 4. Conveying Verbatim Copies.
1486: #
1487: # You may convey verbatim copies of the Program's source code as you
1488: # receive it, in any medium, provided that you conspicuously and
1489: # appropriately publish on each copy an appropriate copyright notice;
1490: # keep intact all notices stating that this License and any
1491: # non-permissive terms added in accord with section 7 apply to the code;
1492: # keep intact all notices of the absence of any warranty; and give all
1493: # recipients a copy of this License along with the Program.
1494: #
1495: # You may charge any price or no price for each copy that you convey,
1496: # and you may offer support or warranty protection for a fee.
1497: #
1498: # 5. Conveying Modified Source Versions.
1499: #
1500: # You may convey a work based on the Program, or the modifications to
1501: # produce it from the Program, in the form of source code under the
1502: # terms of section 4, provided that you also meet all of these conditions:
1503: #
1504: # a) The work must carry prominent notices stating that you modified
1505: # it, and giving a relevant date.
1506: #
1507: # b) The work must carry prominent notices stating that it is
1508: # released under this License and any conditions added under section
1509: # 7. This requirement modifies the requirement in section 4 to
1510: # "keep intact all notices".
1511: #
1512: # c) You must license the entire work, as a whole, under this
1513: # License to anyone who comes into possession of a copy. This
1514: # License will therefore apply, along with any applicable section 7
1515: # additional terms, to the whole of the work, and all its parts,
1516: # regardless of how they are packaged. This License gives no
1517: # permission to license the work in any other way, but it does not
1518: # invalidate such permission if you have separately received it.
1519: #
1520: # d) If the work has interactive user interfaces, each must display
1521: # Appropriate Legal Notices; however, if the Program has interactive
1522: # interfaces that do not display Appropriate Legal Notices, your
1523: # work need not make them do so.
1524: #
1525: # A compilation of a covered work with other separate and independent
1526: # works, which are not by their nature extensions of the covered work,
1527: # and which are not combined with it such as to form a larger program,
1528: # in or on a volume of a storage or distribution medium, is called an
1529: # "aggregate" if the compilation and its resulting copyright are not
1530: # used to limit the access or legal rights of the compilation's users
1531: # beyond what the individual works permit. Inclusion of a covered work
1532: # in an aggregate does not cause this License to apply to the other
1533: # parts of the aggregate.
1534: #
1535: # 6. Conveying Non-Source Forms.
1536: #
1537: # You may convey a covered work in object code form under the terms
1538: # of sections 4 and 5, provided that you also convey the
1539: # machine-readable Corresponding Source under the terms of this License,
1540: # in one of these ways:
1541: #
1542: # a) Convey the object code in, or embodied in, a physical product
1543: # (including a physical distribution medium), accompanied by the
1544: # Corresponding Source fixed on a durable physical medium
1545: # customarily used for software interchange.
1546: #
1547: # b) Convey the object code in, or embodied in, a physical product
1548: # (including a physical distribution medium), accompanied by a
1549: # written offer, valid for at least three years and valid for as
1550: # long as you offer spare parts or customer support for that product
1551: # model, to give anyone who possesses the object code either (1) a
1552: # copy of the Corresponding Source for all the software in the
1553: # product that is covered by this License, on a durable physical
1554: # medium customarily used for software interchange, for a price no
1555: # more than your reasonable cost of physically performing this
1556: # conveying of source, or (2) access to copy the
1557: # Corresponding Source from a network server at no charge.
1558: #
1559: # c) Convey individual copies of the object code with a copy of the
1560: # written offer to provide the Corresponding Source. This
1561: # alternative is allowed only occasionally and noncommercially, and
1562: # only if you received the object code with such an offer, in accord
1563: # with subsection 6b.
1564: #
1565: # d) Convey the object code by offering access from a designated
1566: # place (gratis or for a charge), and offer equivalent access to the
1567: # Corresponding Source in the same way through the same place at no
1568: # further charge. You need not require recipients to copy the
1569: # Corresponding Source along with the object code. If the place to
1570: # copy the object code is a network server, the Corresponding Source
1571: # may be on a different server (operated by you or a third party)
1572: # that supports equivalent copying facilities, provided you maintain
1573: # clear directions next to the object code saying where to find the
1574: # Corresponding Source. Regardless of what server hosts the
1575: # Corresponding Source, you remain obligated to ensure that it is
1576: # available for as long as needed to satisfy these requirements.
1577: #
1578: # e) Convey the object code using peer-to-peer transmission, provided
1579: # you inform other peers where the object code and Corresponding
1580: # Source of the work are being offered to the general public at no
1581: # charge under subsection 6d.
1582: #
1583: # A separable portion of the object code, whose source code is excluded
1584: # from the Corresponding Source as a System Library, need not be
1585: # included in conveying the object code work.
1586: #
1587: # A "User Product" is either (1) a "consumer product", which means any
1588: # tangible personal property which is normally used for personal, family,
1589: # or household purposes, or (2) anything designed or sold for incorporation
1590: # into a dwelling. In determining whether a product is a consumer product,
1591: # doubtful cases shall be resolved in favor of coverage. For a particular
1592: # product received by a particular user, "normally used" refers to a
1593: # typical or common use of that class of product, regardless of the status
1594: # of the particular user or of the way in which the particular user
1595: # actually uses, or expects or is expected to use, the product. A product
1596: # is a consumer product regardless of whether the product has substantial
1597: # commercial, industrial or non-consumer uses, unless such uses represent
1598: # the only significant mode of use of the product.
1599: #
1600: # "Installation Information" for a User Product means any methods,
1601: # procedures, authorization keys, or other information required to install
1602: # and execute modified versions of a covered work in that User Product from
1603: # a modified version of its Corresponding Source. The information must
1604: # suffice to ensure that the continued functioning of the modified object
1605: # code is in no case prevented or interfered with solely because
1606: # modification has been made.
1607: #
1608: # If you convey an object code work under this section in, or with, or
1609: # specifically for use in, a User Product, and the conveying occurs as
1610: # part of a transaction in which the right of possession and use of the
1611: # User Product is transferred to the recipient in perpetuity or for a
1612: # fixed term (regardless of how the transaction is characterized), the
1613: # Corresponding Source conveyed under this section must be accompanied
1614: # by the Installation Information. But this requirement does not apply
1615: # if neither you nor any third party retains the ability to install
1616: # modified object code on the User Product (for example, the work has
1617: # been installed in ROM).
1618: #
1619: # The requirement to provide Installation Information does not include a
1620: # requirement to continue to provide support service, warranty, or updates
1621: # for a work that has been modified or installed by the recipient, or for
1622: # the User Product in which it has been modified or installed. Access to a
1623: # network may be denied when the modification itself materially and
1624: # adversely affects the operation of the network or violates the rules and
1625: # protocols for communication across the network.
1626: #
1627: # Corresponding Source conveyed, and Installation Information provided,
1628: # in accord with this section must be in a format that is publicly
1629: # documented (and with an implementation available to the public in
1630: # source code form), and must require no special password or key for
1631: # unpacking, reading or copying.
1632: #
1633: # 7. Additional Terms.
1634: #
1635: # "Additional permissions" are terms that supplement the terms of this
1636: # License by making exceptions from one or more of its conditions.
1637: # Additional permissions that are applicable to the entire Program shall
1638: # be treated as though they were included in this License, to the extent
1639: # that they are valid under applicable law. If additional permissions
1640: # apply only to part of the Program, that part may be used separately
1641: # under those permissions, but the entire Program remains governed by
1642: # this License without regard to the additional permissions.
1643: #
1644: # When you convey a copy of a covered work, you may at your option
1645: # remove any additional permissions from that copy, or from any part of
1646: # it. (Additional permissions may be written to require their own
1647: # removal in certain cases when you modify the work.) You may place
1648: # additional permissions on material, added by you to a covered work,
1649: # for which you have or can give appropriate copyright permission.
1650: #
1651: # Notwithstanding any other provision of this License, for material you
1652: # add to a covered work, you may (if authorized by the copyright holders of
1653: # that material) supplement the terms of this License with terms:
1654: #
1655: # a) Disclaiming warranty or limiting liability differently from the
1656: # terms of sections 15 and 16 of this License; or
1657: #
1658: # b) Requiring preservation of specified reasonable legal notices or
1659: # author attributions in that material or in the Appropriate Legal
1660: # Notices displayed by works containing it; or
1661: #
1662: # c) Prohibiting misrepresentation of the origin of that material, or
1663: # requiring that modified versions of such material be marked in
1664: # reasonable ways as different from the original version; or
1665: #
1666: # d) Limiting the use for publicity purposes of names of licensors or
1667: # authors of the material; or
1668: #
1669: # e) Declining to grant rights under trademark law for use of some
1670: # trade names, trademarks, or service marks; or
1671: #
1672: # f) Requiring indemnification of licensors and authors of that
1673: # material by anyone who conveys the material (or modified versions of
1674: # it) with contractual assumptions of liability to the recipient, for
1675: # any liability that these contractual assumptions directly impose on
1676: # those licensors and authors.
1677: #
1678: # All other non-permissive additional terms are considered "further
1679: # restrictions" within the meaning of section 10. If the Program as you
1680: # received it, or any part of it, contains a notice stating that it is
1681: # governed by this License along with a term that is a further
1682: # restriction, you may remove that term. If a license document contains
1683: # a further restriction but permits relicensing or conveying under this
1684: # License, you may add to a covered work material governed by the terms
1685: # of that license document, provided that the further restriction does
1686: # not survive such relicensing or conveying.
1687: #
1688: # If you add terms to a covered work in accord with this section, you
1689: # must place, in the relevant source files, a statement of the
1690: # additional terms that apply to those files, or a notice indicating
1691: # where to find the applicable terms.
1692: #
1693: # Additional terms, permissive or non-permissive, may be stated in the
1694: # form of a separately written license, or stated as exceptions;
1695: # the above requirements apply either way.
1696: #
1697: # 8. Termination.
1698: #
1699: # You may not propagate or modify a covered work except as expressly
1700: # provided under this License. Any attempt otherwise to propagate or
1701: # modify it is void, and will automatically terminate your rights under
1702: # this License (including any patent licenses granted under the third
1703: # paragraph of section 11).
1704: #
1705: # However, if you cease all violation of this License, then your
1706: # license from a particular copyright holder is reinstated (a)
1707: # provisionally, unless and until the copyright holder explicitly and
1708: # finally terminates your license, and (b) permanently, if the copyright
1709: # holder fails to notify you of the violation by some reasonable means
1710: # prior to 60 days after the cessation.
1711: #
1712: # Moreover, your license from a particular copyright holder is
1713: # reinstated permanently if the copyright holder notifies you of the
1714: # violation by some reasonable means, this is the first time you have
1715: # received notice of violation of this License (for any work) from that
1716: # copyright holder, and you cure the violation prior to 30 days after
1717: # your receipt of the notice.
1718: #
1719: # Termination of your rights under this section does not terminate the
1720: # licenses of parties who have received copies or rights from you under
1721: # this License. If your rights have been terminated and not permanently
1722: # reinstated, you do not qualify to receive new licenses for the same
1723: # material under section 10.
1724: #
1725: # 9. Acceptance Not Required for Having Copies.
1726: #
1727: # You are not required to accept this License in order to receive or
1728: # run a copy of the Program. Ancillary propagation of a covered work
1729: # occurring solely as a consequence of using peer-to-peer transmission
1730: # to receive a copy likewise does not require acceptance. However,
1731: # nothing other than this License grants you permission to propagate or
1732: # modify any covered work. These actions infringe copyright if you do
1733: # not accept this License. Therefore, by modifying or propagating a
1734: # covered work, you indicate your acceptance of this License to do so.
1735: #
1736: # 10. Automatic Licensing of Downstream Recipients.
1737: #
1738: # Each time you convey a covered work, the recipient automatically
1739: # receives a license from the original licensors, to run, modify and
1740: # propagate that work, subject to this License. You are not responsible
1741: # for enforcing compliance by third parties with this License.
1742: #
1743: # An "entity transaction" is a transaction transferring control of an
1744: # organization, or substantially all assets of one, or subdividing an
1745: # organization, or merging organizations. If propagation of a covered
1746: # work results from an entity transaction, each party to that
1747: # transaction who receives a copy of the work also receives whatever
1748: # licenses to the work the party's predecessor in interest had or could
1749: # give under the previous paragraph, plus a right to possession of the
1750: # Corresponding Source of the work from the predecessor in interest, if
1751: # the predecessor has it or can get it with reasonable efforts.
1752: #
1753: # You may not impose any further restrictions on the exercise of the
1754: # rights granted or affirmed under this License. For example, you may
1755: # not impose a license fee, royalty, or other charge for exercise of
1756: # rights granted under this License, and you may not initiate litigation
1757: # (including a cross-claim or counterclaim in a lawsuit) alleging that
1758: # any patent claim is infringed by making, using, selling, offering for
1759: # sale, or importing the Program or any portion of it.
1760: #
1761: # 11. Patents.
1762: #
1763: # A "contributor" is a copyright holder who authorizes use under this
1764: # License of the Program or a work on which the Program is based. The
1765: # work thus licensed is called the contributor's "contributor version".
1766: #
1767: # A contributor's "essential patent claims" are all patent claims
1768: # owned or controlled by the contributor, whether already acquired or
1769: # hereafter acquired, that would be infringed by some manner, permitted
1770: # by this License, of making, using, or selling its contributor version,
1771: # but do not include claims that would be infringed only as a
1772: # consequence of further modification of the contributor version. For
1773: # purposes of this definition, "control" includes the right to grant
1774: # patent sublicenses in a manner consistent with the requirements of
1775: # this License.
1776: #
1777: # Each contributor grants you a non-exclusive, worldwide, royalty-free
1778: # patent license under the contributor's essential patent claims, to
1779: # make, use, sell, offer for sale, import and otherwise run, modify and
1780: # propagate the contents of its contributor version.
1781: #
1782: # In the following three paragraphs, a "patent license" is any express
1783: # agreement or commitment, however denominated, not to enforce a patent
1784: # (such as an express permission to practice a patent or covenant not to
1785: # sue for patent infringement). To "grant" such a patent license to a
1786: # party means to make such an agreement or commitment not to enforce a
1787: # patent against the party.
1788: #
1789: # If you convey a covered work, knowingly relying on a patent license,
1790: # and the Corresponding Source of the work is not available for anyone
1791: # to copy, free of charge and under the terms of this License, through a
1792: # publicly available network server or other readily accessible means,
1793: # then you must either (1) cause the Corresponding Source to be so
1794: # available, or (2) arrange to deprive yourself of the benefit of the
1795: # patent license for this particular work, or (3) arrange, in a manner
1796: # consistent with the requirements of this License, to extend the patent
1797: # license to downstream recipients. "Knowingly relying" means you have
1798: # actual knowledge that, but for the patent license, your conveying the
1799: # covered work in a country, or your recipient's use of the covered work
1800: # in a country, would infringe one or more identifiable patents in that
1801: # country that you have reason to believe are valid.
1802: #
1803: # If, pursuant to or in connection with a single transaction or
1804: # arrangement, you convey, or propagate by procuring conveyance of, a
1805: # covered work, and grant a patent license to some of the parties
1806: # receiving the covered work authorizing them to use, propagate, modify
1807: # or convey a specific copy of the covered work, then the patent license
1808: # you grant is automatically extended to all recipients of the covered
1809: # work and works based on it.
1810: #
1811: # A patent license is "discriminatory" if it does not include within
1812: # the scope of its coverage, prohibits the exercise of, or is
1813: # conditioned on the non-exercise of one or more of the rights that are
1814: # specifically granted under this License. You may not convey a covered
1815: # work if you are a party to an arrangement with a third party that is
1816: # in the business of distributing software, under which you make payment
1817: # to the third party based on the extent of your activity of conveying
1818: # the work, and under which the third party grants, to any of the
1819: # parties who would receive the covered work from you, a discriminatory
1820: # patent license (a) in connection with copies of the covered work
1821: # conveyed by you (or copies made from those copies), or (b) primarily
1822: # for and in connection with specific products or compilations that
1823: # contain the covered work, unless you entered into that arrangement,
1824: # or that patent license was granted, prior to 28 March 2007.
1825: #
1826: # Nothing in this License shall be construed as excluding or limiting
1827: # any implied license or other defenses to infringement that may
1828: # otherwise be available to you under applicable patent law.
1829: #
1830: # 12. No Surrender of Others' Freedom.
1831: #
1832: # If conditions are imposed on you (whether by court order, agreement or
1833: # otherwise) that contradict the conditions of this License, they do not
1834: # excuse you from the conditions of this License. If you cannot convey a
1835: # covered work so as to satisfy simultaneously your obligations under this
1836: # License and any other pertinent obligations, then as a consequence you may
1837: # not convey it at all. For example, if you agree to terms that obligate you
1838: # to collect a royalty for further conveying from those to whom you convey
1839: # the Program, the only way you could satisfy both those terms and this
1840: # License would be to refrain entirely from conveying the Program.
1841: #
1842: # 13. Use with the GNU Affero General Public License.
1843: #
1844: # Notwithstanding any other provision of this License, you have
1845: # permission to link or combine any covered work with a work licensed
1846: # under version 3 of the GNU Affero General Public License into a single
1847: # combined work, and to convey the resulting work. The terms of this
1848: # License will continue to apply to the part which is the covered work,
1849: # but the special requirements of the GNU Affero General Public License,
1850: # section 13, concerning interaction through a network will apply to the
1851: # combination as such.
1852: #
1853: # 14. Revised Versions of this License.
1854: #
1855: # The Free Software Foundation may publish revised and/or new versions of
1856: # the GNU General Public License from time to time. Such new versions will
1857: # be similar in spirit to the present version, but may differ in detail to
1858: # address new problems or concerns.
1859: #
1860: # Each version is given a distinguishing version number. If the
1861: # Program specifies that a certain numbered version of the GNU General
1862: # Public License "or any later version" applies to it, you have the
1863: # option of following the terms and conditions either of that numbered
1864: # version or of any later version published by the Free Software
1865: # Foundation. If the Program does not specify a version number of the
1866: # GNU General Public License, you may choose any version ever published
1867: # by the Free Software Foundation.
1868: #
1869: # If the Program specifies that a proxy can decide which future
1870: # versions of the GNU General Public License can be used, that proxy's
1871: # public statement of acceptance of a version permanently authorizes you
1872: # to choose that version for the Program.
1873: #
1874: # Later license versions may give you additional or different
1875: # permissions. However, no additional obligations are imposed on any
1876: # author or copyright holder as a result of your choosing to follow a
1877: # later version.
1878: #
1879: # 15. Disclaimer of Warranty.
1880: #
1881: # THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
1882: # APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
1883: # HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
1884: # OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
1885: # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1886: # PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
1887: # IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
1888: # ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
1889: #
1890: # 16. Limitation of Liability.
1891: #
1892: # IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1893: # WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
1894: # THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
1895: # GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
1896: # USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
1897: # DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
1898: # PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
1899: # EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
1900: # SUCH DAMAGES.
1901: #
1902: # 17. Interpretation of Sections 15 and 16.
1903: #
1904: # If the disclaimer of warranty and limitation of liability provided
1905: # above cannot be given local legal effect according to their terms,
1906: # reviewing courts shall apply local law that most closely approximates
1907: # an absolute waiver of all civil liability in connection with the
1908: # Program, unless a warranty or assumption of liability accompanies a
1909: # copy of the Program in return for a fee.
1910: #
1911: # END OF TERMS AND CONDITIONS
1912: #
1913: # How to Apply These Terms to Your New Programs
1914: #
1915: # If you develop a new program, and you want it to be of the greatest
1916: # possible use to the public, the best way to achieve this is to make it
1917: # free software which everyone can redistribute and change under these terms.
1918: #
1919: # To do so, attach the following notices to the program. It is safest
1920: # to attach them to the start of each source file to most effectively
1921: # state the exclusion of warranty; and each file should have at least
1922: # the "copyright" line and a pointer to where the full notice is found.
1923: #
1924: # <one line to give the program's name and a brief idea of what it does.>
1925: # Copyright (C) <year> <name of author>
1926: #
1927: # This program is free software: you can redistribute it and/or modify
1928: # it under the terms of the GNU General Public License as published by
1929: # the Free Software Foundation, either version 3 of the License, or
1930: # (at your option) any later version.
1931: #
1932: # This program is distributed in the hope that it will be useful,
1933: # but WITHOUT ANY WARRANTY; without even the implied warranty of
1934: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1935: # GNU General Public License for more details.
1936: #
1937: # You should have received a copy of the GNU General Public License
1938: # along with this program. If not, see <http://www.gnu.org/licenses/>.
1939: #
1940: # Also add information on how to contact you by electronic and paper mail.
1941: #
1942: # If the program does terminal interaction, make it output a short
1943: # notice like this when it starts in an interactive mode:
1944: #
1945: # <program> Copyright (C) <year> <name of author>
1946: # This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
1947: # This is free software, and you are welcome to redistribute it
1948: # under certain conditions; type `show c' for details.
1949: #
1950: # The hypothetical commands `show w' and `show c' should show the appropriate
1951: # parts of the General Public License. Of course, your program's commands
1952: # might be different; for a GUI interface, you would use an "about box".
1953: #
1954: # You should also get your employer (if you work as a programmer) or school,
1955: # if any, to sign a "copyright disclaimer" for the program, if necessary.
1956: # For more information on this, and how to apply and follow the GNU GPL, see
1957: # <http://www.gnu.org/licenses/>.
1958: #
1959: # The GNU General Public License does not permit incorporating your program
1960: # into proprietary programs. If your program is a subroutine library, you
1961: # may consider it more useful to permit linking proprietary applications with
1962: # the library. If this is what you want to do, use the GNU Lesser General
1963: # Public License instead of this License. But first, please read
1964: # <http://www.gnu.org/philosophy/why-not-lgpl.html>.
1965: #
1966:
1967: #
1968: # historical reference:
1969: #
1970: # gzyx.v0.4.003.2007.07.14.a.iso had a sha1sum of
1971: # db1e6278a09a7251c2e4402ad10974aa0932abf8
1972: #
1973: # -----BEGIN PGP SIGNED MESSAGE-----
1974: #Hash: SHA1
1975: #
1976: #4dfea698dd571b3738cb964a40fe719e5bf6a5a29053075e844e6bbe2ee599aa34e8a23f3f24\
1977: #440b04251f0946b9599ccd60c197b71a7f645d10ff17f7c36cc3 Guitar-ZyX-0.3x.iso
1978: #-----BEGIN PGP SIGNATURE-----
1979: #Version: GnuPG v1.4.9 (GNU/Linux)
1980: #
1981: #iEYEARECAAYFAkp0ugUACgkQVsZU8Xv0mzwmqQCgljsuVKf4DA9NybHLYlwheWDj
1982: #reAAnR4CyrAerz2AwjiUSKbx2jSYCkUH
1983: #=daTj
1984: #-----END PGP SIGNATURE-----
1985: #
1986: # end historical reference
1987: #
1988:
1989: #
1990: # This program is free software; you can redistribute it and/or modify
1991: # it under the terms of the GNU General Public License as published by
1992: # the Free Software Foundation; version 3 of the License.
1993: #
1994: # This program is distributed in the hope that it will be useful,
1995: # but WITHOUT ANY WARRANTY; without even the implied warranty of
1996: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1997: # GNU Library General Public License for more details.
1998: #
1999: # You should have received a copy of the GNU General Public License
2000: # along with this program; if not, write to the Free Software
2001: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2002: #
2003: