From b6d85b04286d30498a11aaac36e75032b1e72801 Mon Sep 17 00:00:00 2001 From: jonas Date: Sat, 10 Jun 2006 18:18:37 +0000 Subject: Added all work so far... git-svn-id: svn+ssh://xayide/home/jonas/private_svn/fleshybrid/trunk@2 8f53b18a-e215-0410-8885-9f593d34873e --- 0_format.sh | 35 ++++ 1_makerootfs.sh | 189 +++++++++++++++++++++ 2_install.sh | 40 +++++ 3_configure.sh | 48 ++++++ 9_resync.sh | 14 ++ TODO | 46 +++++ addons/x11infoscreen/etc/X11/XF86Config-4 | 118 +++++++++++++ addons/x11infoscreen/etc/X11/XF86Config-4-Trident | 118 +++++++++++++ .../etc/X11/XF86Config-4-Trident.orig | 0 addons/x11infoscreen/etc/X11/XF86Config-4.diff | 91 ++++++++++ addons/x11infoscreen/etc/X11/XF86Config-4.orig | 131 ++++++++++++++ addons/x11infoscreen/etc/init.d/flashybrid | 128 ++++++++++++++ addons/x11infoscreen/etc/init.d/flashybrid.diff | 12 ++ addons/x11infoscreen/etc/init.d/flashybrid.orig | 125 ++++++++++++++ addons/x11infoscreen/etc/init.d/local-infoscreen | 106 ++++++++++++ addons/x11infoscreen/etc/rc2.d/S99local-infoscreen | 1 + addons/x11infoscreen/usr/local/bin/launch-feh | 19 +++ addons/x11infoscreen/usr/local/bin/launch-qiv | 19 +++ .../x11infoscreen/usr/local/bin/launch-slideshow | 16 ++ addons/x11infoscreen/usr/local/bin/launch-sync | 18 ++ .../x11infoscreen/usr/local/bin/launch-unclutter | 16 ++ addons/x11infoscreen/usr/local/bin/launch-x11 | 16 ++ addons/x11infoscreen/usr/local/bin/mksshauth | 68 ++++++++ addons/x11infoscreen/usr/local/bin/pickx86config | 13 ++ addons/x11infoscreen/usr/local/bin/savelocaltweaks | 61 +++++++ addons/x11infoscreen/usr/local/bin/slideshow | 33 ++++ addons/x11infoscreen/usr/local/bin/xset | Bin 0 -> 36168 bytes addons/x11phonehome/etc/X11/xorg.conf | 115 +++++++++++++ addons/x11phonehome/etc/X11/xorg.conf-Intel | 115 +++++++++++++ addons/x11phonehome/etc/X11/xorg.conf-Trident | 115 +++++++++++++ addons/x11phonehome/etc/X11/xorg.conf-Trident.orig | 0 addons/x11phonehome/etc/X11/xorg.conf.orig | 129 ++++++++++++++ addons/x11phonehome/etc/init.d/local-phonehome | 102 +++++++++++ addons/x11phonehome/etc/rc2.d/S99local-phonehome | 1 + addons/x11phonehome/usr/local/bin/launch-unclutter | 16 ++ addons/x11phonehome/usr/local/bin/launch-x11 | 16 ++ addons/x11phonehome/usr/local/bin/pickxconfig | 13 ++ addons/x11phonehome/usr/local/bin/xset | Bin 0 -> 26352 bytes chroot.sh | 29 ++++ config-DEFAULTS | 119 +++++++++++++ config-HOST | 34 ++++ config-MANDATED | 159 +++++++++++++++++ config-TARGET | 1 + config-chr | 101 +++++++++++ config-chr.diff | 104 ++++++++++++ config-dgih | 102 +++++++++++ config-dgih.diff | 43 +++++ config-jones | 110 ++++++++++++ config-lasse | 108 ++++++++++++ functions | 125 ++++++++++++++ initrd-tools/initrd.usbinit | 6 + initrd-tools/usbstick | 23 +++ mount.sh | 41 +++++ tweaks/usr/local/sbin/policy-rc.d | 65 +++++++ umount.sh | 35 ++++ usbreset.sh | 7 + 56 files changed, 3315 insertions(+) create mode 100755 0_format.sh create mode 100755 1_makerootfs.sh create mode 100755 2_install.sh create mode 100755 3_configure.sh create mode 100755 9_resync.sh create mode 100644 TODO create mode 100644 addons/x11infoscreen/etc/X11/XF86Config-4 create mode 100644 addons/x11infoscreen/etc/X11/XF86Config-4-Trident create mode 100644 addons/x11infoscreen/etc/X11/XF86Config-4-Trident.orig create mode 100644 addons/x11infoscreen/etc/X11/XF86Config-4.diff create mode 100644 addons/x11infoscreen/etc/X11/XF86Config-4.orig create mode 100755 addons/x11infoscreen/etc/init.d/flashybrid create mode 100644 addons/x11infoscreen/etc/init.d/flashybrid.diff create mode 100755 addons/x11infoscreen/etc/init.d/flashybrid.orig create mode 100755 addons/x11infoscreen/etc/init.d/local-infoscreen create mode 120000 addons/x11infoscreen/etc/rc2.d/S99local-infoscreen create mode 100755 addons/x11infoscreen/usr/local/bin/launch-feh create mode 100755 addons/x11infoscreen/usr/local/bin/launch-qiv create mode 100755 addons/x11infoscreen/usr/local/bin/launch-slideshow create mode 100755 addons/x11infoscreen/usr/local/bin/launch-sync create mode 100755 addons/x11infoscreen/usr/local/bin/launch-unclutter create mode 100755 addons/x11infoscreen/usr/local/bin/launch-x11 create mode 100755 addons/x11infoscreen/usr/local/bin/mksshauth create mode 100755 addons/x11infoscreen/usr/local/bin/pickx86config create mode 100755 addons/x11infoscreen/usr/local/bin/savelocaltweaks create mode 100755 addons/x11infoscreen/usr/local/bin/slideshow create mode 100755 addons/x11infoscreen/usr/local/bin/xset create mode 100644 addons/x11phonehome/etc/X11/xorg.conf create mode 100644 addons/x11phonehome/etc/X11/xorg.conf-Intel create mode 100644 addons/x11phonehome/etc/X11/xorg.conf-Trident create mode 100644 addons/x11phonehome/etc/X11/xorg.conf-Trident.orig create mode 100644 addons/x11phonehome/etc/X11/xorg.conf.orig create mode 100755 addons/x11phonehome/etc/init.d/local-phonehome create mode 120000 addons/x11phonehome/etc/rc2.d/S99local-phonehome create mode 100755 addons/x11phonehome/usr/local/bin/launch-unclutter create mode 100755 addons/x11phonehome/usr/local/bin/launch-x11 create mode 100755 addons/x11phonehome/usr/local/bin/pickxconfig create mode 100755 addons/x11phonehome/usr/local/bin/xset create mode 100755 chroot.sh create mode 100644 config-DEFAULTS create mode 100644 config-HOST create mode 100644 config-MANDATED create mode 120000 config-TARGET create mode 100644 config-chr create mode 100644 config-chr.diff create mode 100644 config-dgih create mode 100644 config-dgih.diff create mode 100644 config-jones create mode 100644 config-lasse create mode 100644 functions create mode 100644 initrd-tools/initrd.usbinit create mode 100755 initrd-tools/usbstick create mode 100755 mount.sh create mode 100755 tweaks/usr/local/sbin/policy-rc.d create mode 100755 umount.sh create mode 100755 usbreset.sh diff --git a/0_format.sh b/0_format.sh new file mode 100755 index 0000000..6004327 --- /dev/null +++ b/0_format.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 +. ./functions || exit 1 + +#sfdisk -l "$usbdev_host" +#TODO: Ask if you really want to erase shown partitions + +# FIXME: Loop and generate partition table dynamically +# (current code assumes alot of stuff about chosen bootloaders) + +# Partition, initialize and mount flash disk +# (Some BIOSes rumored to boot only sticks with specific drive geometry) +# (Some BIOSes, including oldest VIA EPIA mobos, require the -D option) +# (Add "1" in front of first comma if you want room for GRUB stage 1.5) +if [ "$MULTIPLE_BOOTLOADERS" = "yes" ] || [ "$INCOMPATIBLE_FS" = "yes" ]; then +# echo -e ',5,06,*\n,,L' | sfdisk -uM -D -C 125 -H 64 "$usbdev_host" + echo -e ',7,06,*\n,,L' | sfdisk -uM -D "$usbdev_host" + mkdosfs "$bootdev_host" + mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host" +# FIXME: untested if GRUB properly supports vfat... +# mkdir "$mountpoint/boot" +# mount "$bootdev_host" "$mountpoint/boot" +else +# echo ',,L' | sfdisk -D -C 125 -H 64 -D "$usbdev_host" + echo ',,L,*' | sfdisk -D "$usbdev_host" + mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host" +fi + +echo 'Done formatting target device!' diff --git a/1_makerootfs.sh b/1_makerootfs.sh new file mode 100755 index 0000000..0f56607 --- /dev/null +++ b/1_makerootfs.sh @@ -0,0 +1,189 @@ +#!/bin/sh + +set -e + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 +. ./functions || exit 1 + +mkdir "$targettemp" +case "$debootstrap" in + debootstrap) + debootstrap \ + --include=$debootstrap_includes \ + --exclude=$debootstrap_excludes \ + "$suite" "$targettemp" "$aptsource_base_host" + ;; + cdebootstrap) + cdebootstrap \ + --flavour=minimal \ + "$suite" "$targettemp" "$aptsource_base_cdebootstrap" + ;; + *) + echo "ERROR: unknown debootstrap binary defined: \"$debootstrap\"" >&2 + exit 1 +esac + +# Tweak configuration files +preserveandaddlines "$targettemp/etc/fstab" orig 2 "$rootdev_target\t/\t$ROOTFS\tro\t0\t1" "none\t/proc\tproc\tdefaults\t0\t0" +mkdir -p "$targettemp/etc/network/" +preserveandaddlines "$targettemp/etc/network/interfaces" orig 3 "auto lo" +preserveandaddlines "$targettemp/etc/network/interfaces" orig 2 "iface lo inet loopback" +if [ -n "$DHCPCLIENT" ]; then + preserveandaddlines "$targettemp/etc/network/interfaces" orig 3 "auto eth0" + preserveandaddlines "$targettemp/etc/network/interfaces" orig 2 "iface eth0 inet dhcp" +# TODO: Write function to apply multiline entry for static ip +#elif [ -n "$hostdefaultip" ]; then +# enableoraddlines "$targettemp/etc/network/interfaces" 2 "iface eth0 inet static" +fi +preserveandaddlines "$targettemp/etc/hosts" orig 1 "127.0.0.1 localhost" +if [ -n "$hostdefaultip" ]; then + preserveandaddlines "$targettemp/etc/hosts" orig 1 "$hostdefaultip $hostname.$domainname $hostname" +fi +if [ -n "$hostname" ] && [ -n "$domainname" ]; then + preserveandaddlines "$targettemp/etc/hostname" orig 1 "$hostname.$domainname" +fi +if [ ! -d "$targettemp/etc/resolv.conf" ]; then + if [ -n "$dns_server" ]; then + preserveandaddlines "$targettemp/etc/resolv.conf" orig 2 "nameserver $dns_server" + fi + if [ -n "$domainname" ]; then + preserveandaddlines "$targettemp/etc/resolv.conf" orig 2 "search $domainname" + fi +fi +for aptsource in $aptsources; do + eval uri=\"'$'aptsource_${aptsource}_host\" + eval components=\"'$'aptsource_${aptsource}_components\" + preserveandaddlines "$targettemp/etc/apt/sources.list" orig 2 "deb $uri $suite ${components:-main}" +done +if [ -n "$pubdev_target" ] && [ -n "$pubfs" ]; then + mkdir -p "$targettemp/pub" + preserveandaddlines "$targettemp/etc/fstab" orig 2 "$pubdev_target\t/pub\t$pubfs\tdefaults,noauto,ro\t0\t0" +fi +rm -rf "$targettemp/var/log/ksymoops" +ln -f -s /proc/mounts "$targettemp/etc/mtab" +preserveandaddlines "$targettemp/etc/modules" orig 1 $modules_load +if [ -n "$loghost" ]; then + preserveolderfile "$targettemp/etc/syslog.conf" orig + echo "*.* @$loghost" > "$targettemp/etc/syslog.conf" +fi + +# Install/remove additional packages +export DEBIAN_FRONTEND="noninteractive" +case "$debootstrap" in + debootstrap) + ;; + cdebootstrap) + ./chroot.sh temp apt-get update + ./chroot.sh temp apt-get -y --allow-unauthenticated install aptitude + ./chroot.sh temp aptitude -y purge cdebootstrap-helper-diverts + # Hmm - this next one seems like a bug! + rm -rf "$targettemp/var/cache/debootstrap" + ;; +esac +mkdir -p "$targettemp/etc/apt/apt.conf.d" +echo 'Aptitude::CmdLine::Ignore-Trust-Violations "yes";' > "$targettemp/etc/apt/apt.conf.d/99localforcedautoinstall" +./chroot.sh temp aptitude update +# Next command should *not* cause any packages to get uninstalled, so +# questions asked is an error and shouldn't be suppressed +./chroot.sh temp aptitude markauto '~i!~M(~E|~prequired|~sdevel|~sinterpreters|~slibdevel|~slibs|~soldlibs|~sperl|~spython|~sshells)' +./chroot.sh temp aptitude install -y --without-recommends debconf-english policyrcd-script-zg2 +cp -af tweaks/usr/local/sbin/policy-rc.d "$targettemp/usr/local/sbin/" +./chroot.sh temp aptitude install -y --without-recommends $aptitude_install $aptitude_dhcpclient_install + +# Workaround for Debian bug#272257 (see http://bugs.debian.org/281264 ) +#rm -f "$targettemp/etc/resolv.conf" + +# Prepare kernel installation +# TODO: support yaird and mkramfs too +# FIXME: deal with initrd generated while on host +if [ -n "$RAMDISKTOOL" = "initrd-tools" ]; then + preserveolderfile "$targettemp/etc/mkinitrd/mkinitrd.conf" orig + perl -pi -e "sĦ^ROOT=.*ĦROOT=$rootdev_targetĦ" "$targettemp/etc/mkinitrd/mkinitrd.conf" + perl -pi -e "sĦ^MODULES=.*ĦMODULES=depĦ" "$targettemp/etc/mkinitrd/mkinitrd.conf" + preserveandaddlines "$targettemp/etc/mkinitrd/modules" orig 1 $modules_install +fi +preserveandaddlines "$targettemp/etc/kernel-img.conf" orig 1 \ + "do_symlinks = no" \ + "relative_links = yes" \ + "do_bootloader = no" \ + "do_bootfloppy = no" \ + "do_initrd = yes" \ + "link_in_boot = no" \ + "silent_modules = yes" +# FIXME: check if these are actually still any use with latest kernels +cp -af initrd-tools/usbstick "$targettemp/usr/share/initrd-tools/scripts/usbstick" +chmod 0755 "$targettemp/usr/share/initrd-tools/scripts/usbstick" +cp -af initrd-tools/initrd.usbinit "$targettemp/usr/local/share/initrd.usbinit" + +if [ "$FLASHYBRID" = "yes" ]; then + addaddons flashybrid_diskstore flashybrid_diskstore $addons +# preserveandaddlines "$targettemp/etc/flashybrid/config" orig 1 "EMBED_CMDS=\"mount -o remount,ro /; invoke-rc-d mountvirtfs start\"" + preserveandaddlines "$targettemp/etc/flashybrid/ramtmp" orig 1 $flashybrid_ramtmp + preserveandaddlines "$targettemp/etc/flashybrid/ramstore" orig 1 $flashybrid_ramstore + preserveandaddlines "$targettemp/etc/flashybrid/diskstore" orig 1 $flashybrid_diskstore + # Move off flashybrid directories (but leave empty dir behind) + mkdir -p "$targetoffline" "$targettemp/ram" "$targettemp/disk" + preserveandaddlines "$targettemp/etc/fstab" orig 2 "$diskdev_target\t/disk\t$diskfs\tdefaults,noauto,nolock\t0\t0" + # FIXME: Somehow make this step idempotent + for dir in $flashybrid_diskstore; do + if [ -d "${targettemp}${dir}" ]; then + mkdir -p "$(dirname "${targetoffline}${dir}")" + mv "${targettemp}${dir}" "${targetoffline}${dir}" + else + mkdir -p "${targetoffline}${dir}" + fi + mkdir -p "${targettemp}${dir}" + done + preserveolderfile "$targettemp/etc/default/flashybrid" orig + perl -pi -e "sĦ^ENABLED=.*ĦENABLED=yesĦ" "$targettemp/etc/default/flashybrid" +fi + +if [ -n "$grubdev_host" ]; then + # Prepare GRUB install + mkdir -p "$targettemp/boot/grub" + mkgrubdevmap "$usbdev_target" > "$targettemp/boot/grub/device.map" + cp -af "$targettemp/lib/grub/i386-pc/"* "$targettemp/boot/grub" + # FIXME: Invent a hook wrapping both this and other bootloaders + preserveandaddlines "$targettemp/etc/kernel-img.conf" orig 1 "postinst_hook = /sbin/update-grub" "postrm_hook = /sbin/update-grub" +# preserveandaddlines "$targettemp/boot/grub/menu.lst" orig 1 "default 0" "timeout 5" "color cyan/blue white/blue" + # FIXME: Write update-grub wrapper that disables "savedefault" option + ./chroot.sh temp update-grub -y +fi + +# Install kernel(s) +# (must be after GRUB preparation but before SYSLINUX) +./chroot.sh temp aptitude install -y --without-recommends $aptitude_kernel_install +if [ -n "$grubdev_host" ]; then + # FIXME: Write a kernel install hook to always strip + # TODO: Rewrite as single-line perl routine + cp -af "$targettemp/boot/grub/menu.lst" "$targettemp/boot/grub/menu.lst.old" + grep -v -x 'savedefault' "$targettemp/boot/grub/menu.lst.old" > "$targettemp/boot/grub/menu.lst" + rm -f "$targettemp/boot/grub/menu.lst.old" +fi + +if [ -n "$syslinuxdev_host" ]; then + mkdir -p "$targettemp_fat" + cp -af "$targettemp/boot/initrd.img-${kernel_name}" "$targettemp_fat/initrd.img" + cp -af "$targettemp/boot/vmlinuz-${kernel_name}" "$targettemp_fat/vmlinuz" + enableoraddlines "$targettemp_fat/syslinux.cfg" 1 "default vmlinuz" "append initrd=initrd.img ramdisk_size=10240 root=$rootdev_target ro" +fi + +# Install additional packages +export DEBIAN_FRONTEND="noninteractive" +addaddons aptitude_install_custom aptitude_install $addons +if [ -n "$aptitude_install_custom" ]; then + ./chroot.sh temp aptitude install -y --without-recommends $aptitude_install_custom +fi + +# Remove hack to suppress warnings about insecure install +rm -f "$targettemp/etc/apt/apt.conf.d/99localforcedautoinstall" + +# Strip encryption keys (we don't want them distributed!) +for keyfile in ssh_host_key ssh_host_rsa_key ssh_host_dsa_key; do + rm -f "$targettemp/etc/ssh/$keyfile" "$targettemp/etc/ssh/$keyfile.pub" +done + +echo 'Done creating rootfs!' diff --git a/2_install.sh b/2_install.sh new file mode 100755 index 0000000..3d63ba3 --- /dev/null +++ b/2_install.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -e + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 +. ./functions || exit 1 + +# Save specs for debugging later +if [ -f "$baseworkdir/specs" ]; then + echo 'ERROR: specs exists already - use virgin workingdir!' >&2 + echo ' (or duplicate the working dir and remove specs)' >&2 + exit 1 +else +# echo "partition info for actual device:" > "$baseworkdir/specs" + sfdisk -l "$usbdev_host" >> "$baseworkdir/specs" +# echo "Possible devices:" >> "$baseworkdir/specs" + echo >> "$baseworkdir/specs" + find /proc/scsi -type f -name scsi -exec cat '{}' >> "$baseworkdir/specs" ';' + echo >> "$baseworkdir/specs" +# find /proc/scsi -type f -regex '.*/usb-storage-[0-9]+/.*' -exec grep -l 'Attached:.*Yes' '{}' ';' -exec cat '{}' ';' >> "$baseworkdir/specs" + find /proc/scsi -type f -regex '.*/usb-storage.*/[0-9]+' -exec cat '{}' >> "$baseworkdir/specs" ';' +fi + +# Finalize root filesystem +if [ "$ROOTFS" = "isofs" ]; then + mkdir "$targettemp_isofs" + # FIXME: not yet implemented! + echo 'ARRGH - this is not possible (should have failed earlier)!' + exit 1 +else + mount "$rootdev_host" "$mountpoint" + rsync -aH "$targettemp/" "${mountpoint%/}" + umount "$mountpoint" +# [ -n "$bootdev_host" ] && umount "$mountpoint/boot" || true +fi + +echo 'Done installing rootfs!' diff --git a/3_configure.sh b/3_configure.sh new file mode 100755 index 0000000..af63fa2 --- /dev/null +++ b/3_configure.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +set -e + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 +. ./functions || exit 1 + +# Check if already installed +if ! ./chroot.sh grep -q 'root::' "/etc/passwd"; then + echo 'ERROR: rootfd already (halfway?) configured!' >&2 + exit 1 +fi + +# Install MBR, GRUB and SYSLINUX +[ -n "$grubdev_host" ] && mkgrubdevmap "$usbdev_host" >>"$baseworkdir/grub_host_device.map" +if [ "$MBR" = "yes" ]; then + [ "$MBR" = "yes" ] && install-mbr "$usbdev_host" +# [ -n "$syslinuxdev_host" ] && syslinux "$bootdev_host" + [ -n "$syslinuxdev_host" ] && makebootfat -o "$syslinuxdev_host" -X -P -b /usr/lib/syslinux/ldlinux.bss -c /usr/lib/syslinux/ldlinux.sys "$targettemp_fat" + [ -n "$grubdev_host" ] && echo -e "root ($grubdev_grub)\nsetup ($grubdev_grub)" | grub --batch --device-map="$baseworkdir/grub_host_device.map" +elif [ -n "$grubdev_host" ]; then + echo -e "root ($grubdev_grub)\nsetup ($usbdev_grub)" | grub --batch --device-map="$baseworkdir/grub_host_device.map" +elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "ext2fs" ]; then + makebootfat -o "$syslinuxdev_host" -X -P -b /usr/lib/syslinux/ldlinux.bss -c /usr/lib/syslinux/ldlinux.sys "$targettemp_fat" +elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "dosfs" ]; then + # This should make sticks be recognized as both USB-FDD and USB-HDD. + # (VIA EPIA mobos will boot only as USB-ZIP, however :-( ) + makebootfat -o "$usbdev_host" -X -D -b /usr/lib/syslinux/ldlinux.bss -m /usr/lib/makebootfat/mbrfat.bin -F -c /usr/lib/syslinux/ldlinux.sys "$targettemp_isofs" +elif [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" = "isofs" ]; then + # This should make sticks be recognized as both USB-FDD and USB-HDD. + # (VIA EPIA mobos will boot only as USB-ZIP, however :-( ) + makebootfat -o "$usbdev_host" -X -D -b /usr/lib/syslinux/ldlinux.bss -m /usr/lib/makebootfat/mbrfat.bin -F -c /usr/lib/syslinux/ldlinux.sys "$targettemp_isofs" +else + echo "WARNING: Sorry: don't know how to handle this choice of bootloaders." >&2 + exit 1 +fi + +# Tweak /etc/passwd to sanity +./chroot.sh shadowconfig on +./chroot.sh passwd root +echo "Creating SSH2 RSA/DSA keys; this may take some time ..." +./chroot.sh ssh-keygen -q -f "/etc/ssh/ssh_host_rsa_key" -t rsa #-N "" +./chroot.sh ssh-keygen -q -f "/etc/ssh/ssh_host_dsa_key" -t dsa #-N "" + +echo 'Done configuring rootfs!' diff --git a/9_resync.sh b/9_resync.sh new file mode 100755 index 0000000..ed2dd13 --- /dev/null +++ b/9_resync.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 +. ./functions || exit 1 + +mount "$rootdev_host" "$mountpoint" +rsync -av --delete --one-file-system "$mountpoint/"* "$targettemp/" --exclude 'etc/shadow*' --exclude 'etc/gshadow*' --exclude 'etc/ssh/ssh_host_*_key*' --exclude 'root/**' --dry-run +'/root:[^:]*/root:' +umount "$mountpoint" diff --git a/TODO b/TODO new file mode 100644 index 0000000..f9db020 --- /dev/null +++ b/TODO @@ -0,0 +1,46 @@ + * Use custom ramdisk tool in /etc/kernel-img.cfg: + + sync kernels and initrds for both syslinux and GRUB as needed. + + Strip "save-default" lines from GRUB menu.conf. + * Write mount routine as functions. + * Make GRUB booting in dualboot actually work. + + To test, press shift at boot, then "A", and then "2". + * Write trace routines as functions, and improve it: + + If file does not exist already: touch .orig. + + If .orig already exists: use .old. + + After tweaking, if .old exists and is equal: remove. + * Improve bootloader selection: + + If GRUB disabled, use vfat partition as /root. + * Rewrite all configuration file tweaks to be idempotent. + * Make everything (except maybe mounting) work using fakeroot. + * Fix all FIXMEs. + * Install module-init-tools before kernels. + * Add shell snippet for initial run: + + Offer to dpkg-reconfigure all packages. + + Generate yaird initramfs. + + Reset root password. + + Generate SSH host keys (if SSH server installed). + * Avoid daemons starting within chroot: + + syslog-ng + + ssh + + (rpc.statd) + Possible solution: Add /usr/sbin/policy-rc.d exiting errorlevel 101 + when in chroot. + * Fix /dev in chroot not properly unmounted with udev-based host. + (fixed in sid) + * Avoid mkinitrd probing root dev (not requiring USBstick plugged in). + * Always unmount even if failures oocur (some shell woodoo...) + * For flashybrid relying on NFS: Include and load these in initrd: + sunrpc + lockd + nfs_acl + nfs + * Make sure network is up on boot. + + +DGIH: + * If using resolvconf, make sure this is setup: ln -s /dev/shm/resolvconf /etc/resolvconf/run + * Hand-edit infoscreen routines: + * Add /etc/*/local-infoscreen and /usr/local/bin + * Add dir /var/lib/infoscreen + * mksshauth infoscreen@lager + * Accept lager as host (in /root/.ssh/known_hosts ) diff --git a/addons/x11infoscreen/etc/X11/XF86Config-4 b/addons/x11infoscreen/etc/X11/XF86Config-4 new file mode 100644 index 0000000..059147c --- /dev/null +++ b/addons/x11infoscreen/etc/X11/XF86Config-4 @@ -0,0 +1,118 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Module" + Load "GLcore" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "speedo" + Load "type1" + Load "vbe" + Load "xtt" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xfree86" + Option "XkbModel" "pc105" + Option "XkbLayout" "dk" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "vesa" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 30-75 + VertRefresh 50-85 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 16 + SubSection "Display" + Depth 1 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11infoscreen/etc/X11/XF86Config-4-Trident b/addons/x11infoscreen/etc/X11/XF86Config-4-Trident new file mode 100644 index 0000000..b25dd59 --- /dev/null +++ b/addons/x11infoscreen/etc/X11/XF86Config-4-Trident @@ -0,0 +1,118 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Module" + Load "GLcore" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "speedo" + Load "type1" + Load "vbe" + Load "xtt" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xfree86" + Option "XkbModel" "pc105" + Option "XkbLayout" "dk" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "trident" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 30-75 + VertRefresh 50-85 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 16 + SubSection "Display" + Depth 1 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11infoscreen/etc/X11/XF86Config-4-Trident.orig b/addons/x11infoscreen/etc/X11/XF86Config-4-Trident.orig new file mode 100644 index 0000000..e69de29 diff --git a/addons/x11infoscreen/etc/X11/XF86Config-4.diff b/addons/x11infoscreen/etc/X11/XF86Config-4.diff new file mode 100644 index 0000000..87d5a65 --- /dev/null +++ b/addons/x11infoscreen/etc/X11/XF86Config-4.diff @@ -0,0 +1,91 @@ +--- XF86Config-4.orig 2005-01-20 03:41:43.000000000 +0100 ++++ XF86Config-4 2004-11-17 03:25:12.000000000 +0100 +@@ -17,20 +17,6 @@ + # md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum + # dpkg-reconfigure xserver-xfree86 + +-Section "Files" +- FontPath "unix/:7100" # local font server +- # if the local font server has problems, we can fall back on these +- FontPath "/usr/lib/X11/fonts/misc" +- FontPath "/usr/lib/X11/fonts/cyrillic" +- FontPath "/usr/lib/X11/fonts/100dpi/:unscaled" +- FontPath "/usr/lib/X11/fonts/75dpi/:unscaled" +- FontPath "/usr/lib/X11/fonts/Type1" +- FontPath "/usr/lib/X11/fonts/CID" +- FontPath "/usr/lib/X11/fonts/Speedo" +- FontPath "/usr/lib/X11/fonts/100dpi" +- FontPath "/usr/lib/X11/fonts/75dpi" +-EndSection +- + Section "Module" + Load "GLcore" + Load "bitmap" +@@ -45,6 +31,7 @@ + Load "speedo" + Load "type1" + Load "vbe" ++ Load "xtt" + EndSection + + Section "InputDevice" +@@ -52,8 +39,8 @@ + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xfree86" +- Option "XkbModel" "pc104" +- Option "XkbLayout" "us" ++ Option "XkbModel" "pc105" ++ Option "XkbLayout" "dk" + EndSection + + Section "InputDevice" +@@ -82,8 +69,8 @@ + + Section "Monitor" + Identifier "Generic Monitor" +- HorizSync 28-50 +- VertRefresh 43-75 ++ HorizSync 30-75 ++ VertRefresh 50-85 + Option "DPMS" + EndSection + +@@ -91,30 +78,30 @@ + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" +- DefaultDepth 24 ++ DefaultDepth 16 + SubSection "Display" + Depth 1 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 +- Modes "800x600" "640x480" ++ Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + EndSection + diff --git a/addons/x11infoscreen/etc/X11/XF86Config-4.orig b/addons/x11infoscreen/etc/X11/XF86Config-4.orig new file mode 100644 index 0000000..c6c901e --- /dev/null +++ b/addons/x11infoscreen/etc/X11/XF86Config-4.orig @@ -0,0 +1,131 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Files" + FontPath "unix/:7100" # local font server + # if the local font server has problems, we can fall back on these + FontPath "/usr/lib/X11/fonts/misc" + FontPath "/usr/lib/X11/fonts/cyrillic" + FontPath "/usr/lib/X11/fonts/100dpi/:unscaled" + FontPath "/usr/lib/X11/fonts/75dpi/:unscaled" + FontPath "/usr/lib/X11/fonts/Type1" + FontPath "/usr/lib/X11/fonts/CID" + FontPath "/usr/lib/X11/fonts/Speedo" + FontPath "/usr/lib/X11/fonts/100dpi" + FontPath "/usr/lib/X11/fonts/75dpi" +EndSection + +Section "Module" + Load "GLcore" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "speedo" + Load "type1" + Load "vbe" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xfree86" + Option "XkbModel" "pc104" + Option "XkbLayout" "us" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "vesa" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 28-50 + VertRefresh 43-75 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 24 + SubSection "Display" + Depth 1 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11infoscreen/etc/init.d/flashybrid b/addons/x11infoscreen/etc/init.d/flashybrid new file mode 100755 index 0000000..5ab4037 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid @@ -0,0 +1,128 @@ +#!/bin/sh +# Set up/shutdown the flashybrid system, including the ramdisk and partial +# directory bind mounts. This needs to run at the part of system bootup that +# mounts all the disks. It should also run at shutdown right before +# filesystems are unmounted. + +CONFDIR=/etc/flashybrid +if [ -e $CONFDIR/config ]; then + . $CONFDIR/config +fi + +ENABLED=no +if [ -e /etc/default/flashybrid ]; then + . /etc/default/flashybrid +fi + +if [ -z "$RAMMOUNT" ]; then + exit 0 +fi + +is_mounted () { + grep -q " $1 " /proc/mounts +} + +case "$1" in +start) + if [ "$ENABLED" != yes ]; then + echo "Not setting up flashybrid system: disabled." + exit + fi + + printf "Setting up flashybrid system..." + + # Set up partial directories and so on, make sure disk is + # unmounted. + fh-embed >/dev/null + + # Set up ram disk to hold variable data. + if ! is_mounted $RAMMOUNT; then + mount tmpfs -t tmpfs $RAMMOUNT + fi + + # Temporary directories on ram disk. + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + mkdir -p -m 1777 $RAMMOUNT/$dir + if is_mounted $dir; then + umount $dir + fi + mount --bind $RAMMOUNT/$dir $dir + done + + # Copy data from flash to ram disk for these directories. + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + # Skip dirs that are not present. + if [ -d $dir ]; then + ramdir=$RAMMOUNT$dir + if is_mounted $dir; then + umount $dir + fi + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if [ ! -d $ramdir ]; then + mkdir -p ${ramdir%/*} # dirname + cp -a $dir $ramdir + fi + mkdir -p $ramdir.flash + mount --bind $dir $ramdir.flash + mount --bind $ramdir $dir + fi + done + + # Make sure virtual filesystems are properly mounted + invoke-rc.d mountvirtfs start || /bin/true + + echo "done." +;; +stop) + if [ "$ENABLED" != yes ]; then + echo "Not shutting down flashybrid system: disabled." + exit + fi + + printf "Shutting down flashybrid system..." + + # Copy data to flash. + # Remount the flash read-write so the copies to it will work. + mount -o remount,rw / + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + if [ -d $RAMMOUNT/$dir ] && [ -d $RAMMOUNT/$dir.flash ]; then + # rsync is used to avoid churning the flash + # unnecessarily. The trailing slashes are very + # important.. + rsync --delete -a $RAMMOUNT/$dir/ $RAMMOUNT/$dir.flash/ + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + if is_mounted $dir; then + umount $dir + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + ramdir=$RAMMOUNT$dir + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if is_mounted $dir; then + umount $dir + fi + done + + if is_mounted $RAMMOUNT; then + umount $RAMMOUNT + fi + + echo "done." +;; +restart|force-reload) + $0 stop + $0 start +;; +*) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 +;; +esac diff --git a/addons/x11infoscreen/etc/init.d/flashybrid.diff b/addons/x11infoscreen/etc/init.d/flashybrid.diff new file mode 100644 index 0000000..34c0fda --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid.diff @@ -0,0 +1,12 @@ +--- flashybrid.orig 2003-11-25 21:26:14.000000000 +0000 ++++ flashybrid 2004-11-17 02:05:22.000000000 +0000 +@@ -70,6 +70,9 @@ + fi + done + ++ # Make sure virtual filesystems are properly mounted ++ invoke-rc.d mountvirtfs start || /bin/true ++ + echo "done." + ;; + stop) diff --git a/addons/x11infoscreen/etc/init.d/flashybrid.orig b/addons/x11infoscreen/etc/init.d/flashybrid.orig new file mode 100755 index 0000000..9ea31d7 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid.orig @@ -0,0 +1,125 @@ +#!/bin/sh +# Set up/shutdown the flashybrid system, including the ramdisk and partial +# directory bind mounts. This needs to run at the part of system bootup that +# mounts all the disks. It should also run at shutdown right before +# filesystems are unmounted. + +CONFDIR=/etc/flashybrid +if [ -e $CONFDIR/config ]; then + . $CONFDIR/config +fi + +ENABLED=no +if [ -e /etc/default/flashybrid ]; then + . /etc/default/flashybrid +fi + +if [ -z "$RAMMOUNT" ]; then + exit 0 +fi + +is_mounted () { + grep -q " $1 " /proc/mounts +} + +case "$1" in +start) + if [ "$ENABLED" != yes ]; then + echo "Not setting up flashybrid system: disabled." + exit + fi + + printf "Setting up flashybrid system..." + + # Set up partial directories and so on, make sure disk is + # unmounted. + fh-embed >/dev/null + + # Set up ram disk to hold variable data. + if ! is_mounted $RAMMOUNT; then + mount tmpfs -t tmpfs $RAMMOUNT + fi + + # Temporary directories on ram disk. + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + mkdir -p -m 1777 $RAMMOUNT/$dir + if is_mounted $dir; then + umount $dir + fi + mount --bind $RAMMOUNT/$dir $dir + done + + # Copy data from flash to ram disk for these directories. + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + # Skip dirs that are not present. + if [ -d $dir ]; then + ramdir=$RAMMOUNT$dir + if is_mounted $dir; then + umount $dir + fi + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if [ ! -d $ramdir ]; then + mkdir -p ${ramdir%/*} # dirname + cp -a $dir $ramdir + fi + mkdir -p $ramdir.flash + mount --bind $dir $ramdir.flash + mount --bind $ramdir $dir + fi + done + + echo "done." +;; +stop) + if [ "$ENABLED" != yes ]; then + echo "Not shutting down flashybrid system: disabled." + exit + fi + + printf "Shutting down flashybrid system..." + + # Copy data to flash. + # Remount the flash read-write so the copies to it will work. + mount -o remount,rw / + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + if [ -d $RAMMOUNT/$dir ] && [ -d $RAMMOUNT/$dir.flash ]; then + # rsync is used to avoid churning the flash + # unnecessarily. The trailing slashes are very + # important.. + rsync --delete -a $RAMMOUNT/$dir/ $RAMMOUNT/$dir.flash/ + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + if is_mounted $dir; then + umount $dir + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + ramdir=$RAMMOUNT$dir + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if is_mounted $dir; then + umount $dir + fi + done + + if is_mounted $RAMMOUNT; then + umount $RAMMOUNT + fi + + echo "done." +;; +restart|force-reload) + $0 stop + $0 start +;; +*) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 +;; +esac diff --git a/addons/x11infoscreen/etc/init.d/local-infoscreen b/addons/x11infoscreen/etc/init.d/local-infoscreen new file mode 100755 index 0000000..c9ef034 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/local-infoscreen @@ -0,0 +1,106 @@ +#! /bin/sh +# +# local-infoscreen +# +# Author: Jonas Smedegaard +# + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="infoscreen daemons" +NAME=infoscreen +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Gracefully exit if the package has been removed. +#test -x $DAEMON || exit 0 + +# Read config file if it is present. +#if [ -r /etc/default/$NAME ] +#then +# . /etc/default/$NAME +#fi + +# +# Function that starts the daemon/service. +# +d_start() { +# start-stop-daemon --start --quiet --pidfile $PIDFILE \ +# --exec $DAEMON + killall XFree86 -wq || /bin/true + /usr/local/bin/launch-x11 + /usr/local/bin/launch-sync + sleep 5 + /usr/local/bin/launch-unclutter +# /usr/local/bin/launch-feh + /usr/local/bin/launch-qiv +} + +# +# Function that stops the daemon/service. +# +d_stop() { +# start-stop-daemon --stop --quiet --pidfile $PIDFILE \ +# --name $NAME + /usr/local/bin/launch-qiv -k || /bin/true +# /usr/local/bin/launch-feh -k || /bin/true + /usr/local/bin/launch-unclutter -k || /bin/true + /usr/local/bin/launch-sync -k || /bin/true + /usr/local/bin/launch-x11 -k || /bin/true + killall XFree86 -wq || /bin/true +} + +# +# Function that sends a SIGHUP to the daemon/service. +# +d_reload() { + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --name $NAME --signal 1 +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + #reload) + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this an "exit 0". + # + # echo -n "Reloading $DESC configuration..." + # d_reload + # echo "done." + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/addons/x11infoscreen/etc/rc2.d/S99local-infoscreen b/addons/x11infoscreen/etc/rc2.d/S99local-infoscreen new file mode 120000 index 0000000..d1cdbc0 --- /dev/null +++ b/addons/x11infoscreen/etc/rc2.d/S99local-infoscreen @@ -0,0 +1 @@ +../init.d/local-infoscreen \ No newline at end of file diff --git a/addons/x11infoscreen/usr/local/bin/launch-feh b/addons/x11infoscreen/usr/local/bin/launch-feh new file mode 100755 index 0000000..7e2126a --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-feh @@ -0,0 +1,19 @@ +#!/usr/bin/launchtool -C + +tag = feh +#command = DISPLAY=:0 feh --full-screen --slideshow-delay 15 /var/lib/infoscreen/*.png; exit 0 +command = export DISPLAY=:0; /usr/local/bin/xset s reset; /usr/local/bin/xset s off; for file in `find /var/lib/infoscreen -name '*.png'`; do feh --rcfile /dev/null --bg-scale $file; sleep 15; done; exit 0 +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:feh,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:feh,LOG_DAEMON,LOG_ERR +command output = syslog:feh,LOG_DAEMON,LOG_INFO +command errors = syslog:feh,LOG_DAEMON,LOG_ERR +silent restart time = 5 +silent restart status = 0 diff --git a/addons/x11infoscreen/usr/local/bin/launch-qiv b/addons/x11infoscreen/usr/local/bin/launch-qiv new file mode 100755 index 0000000..347fa84 --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-qiv @@ -0,0 +1,19 @@ +#!/usr/bin/launchtool -C + +tag = qiv +#command = DISPLAY=:0 qiv --full-screen --slideshow-delay 15 /var/lib/infoscreen/*.png; exit 0 +command = export DISPLAY=:0; /usr/local/bin/xset s reset; /usr/local/bin/xset s off; for file in `find /var/lib/infoscreen -name '*.png'`; do qiv -m --root $file; sleep 15; done; exit 0 +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:qiv,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:qiv,LOG_DAEMON,LOG_ERR +command output = syslog:qiv,LOG_DAEMON,LOG_INFO +command errors = syslog:qiv,LOG_DAEMON,LOG_ERR +silent restart time = 5 +silent restart status = 0 diff --git a/addons/x11infoscreen/usr/local/bin/launch-slideshow b/addons/x11infoscreen/usr/local/bin/launch-slideshow new file mode 100755 index 0000000..da4cc8c --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-slideshow @@ -0,0 +1,16 @@ +#!/usr/bin/launchtool -C + +tag = slideshow +command = /usr/local/bin/slideshow +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:slideshow,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:slideshow,LOG_DAEMON,LOG_ERR +command output = syslog:slideshow,LOG_DAEMON,LOG_INFO +command errors = syslog:slideshow,LOG_DAEMON,LOG_ERR diff --git a/addons/x11infoscreen/usr/local/bin/launch-sync b/addons/x11infoscreen/usr/local/bin/launch-sync new file mode 100755 index 0000000..f52aa8a --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-sync @@ -0,0 +1,18 @@ +#!/usr/bin/launchtool -C + +tag = sync +command = rsync -ar --delete infoscreen@lager:/home/jonas/websites/info.dgi-huset.dk/img/ /var/lib/infoscreen/; exit 0 +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:sync,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:sync,LOG_DAEMON,LOG_ERR +command output = syslog:sync,LOG_DAEMON,LOG_INFO +command errors = syslog:sync,LOG_DAEMON,LOG_ERR +silent restart time = 300 +silent restart status = 0 diff --git a/addons/x11infoscreen/usr/local/bin/launch-unclutter b/addons/x11infoscreen/usr/local/bin/launch-unclutter new file mode 100755 index 0000000..1995126 --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-unclutter @@ -0,0 +1,16 @@ +#!/usr/bin/launchtool -C + +tag = unclutter +command = unclutter -idle 1 -root -display ':0' +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:unclutter,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:unclutter,LOG_DAEMON,LOG_ERR +command output = syslog:unclutter,LOG_DAEMON,LOG_INFO +command errors = syslog:unclutter,LOG_DAEMON,LOG_ERR diff --git a/addons/x11infoscreen/usr/local/bin/launch-x11 b/addons/x11infoscreen/usr/local/bin/launch-x11 new file mode 100755 index 0000000..8acff80 --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/launch-x11 @@ -0,0 +1,16 @@ +#!/usr/bin/launchtool -C + +tag = x11 +command = /usr/bin/X11/XFree86 -allowMouseOpenFail -br -dpms -xf86config `/usr/local/bin/pickx86config` +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:x11,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:x11,LOG_DAEMON,LOG_ERR +command output = syslog:x11,LOG_DAEMON,LOG_INFO +command errors = syslog:x11,LOG_DAEMON,LOG_ERR diff --git a/addons/x11infoscreen/usr/local/bin/mksshauth b/addons/x11infoscreen/usr/local/bin/mksshauth new file mode 100755 index 0000000..9d7c44c --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/mksshauth @@ -0,0 +1,68 @@ +#!/bin/sh +# +# /usr/local/bin/mksshauth +# Copyright 2000-2001 Juri Jensen +# Copyright 2002 Juri Jensen & Jonas Smedegaard +# +# $Id: mksshauth,v 1.5 2003/03/24 12:08:47 jonas Exp $ +# +# Setup local and remote SSH for non-interactive authorization +# + +set -e + +prg=`basename $0` + +if [ $# \< 1 ]; then + echo "ERROR: Wrong arguments! (Use '$prg --help' for help)" + exit 1 +fi +keytype=$1 +shift + +case "$keytype" in + --help|-h) + echo "$prg: Setup local and remote SSH for non-interactive authorization." + echo + echo "Usage: $prg keytype [user@]host [options]" + echo + echo "Options:" + echo " keytype: SSH key type, either rsa1, rsa, dsa, 1 or 2." + echo " rsa1 is for SSHv1, rsa and dsa is for SSHv2. 1 and 2 are" + echo " aliases for rsa1 and dsa. dsa (or 2) is recommended." + echo " user: User id on remote host. Default is same as local user." + echo " host: Hostname of remote host." + echo " options: Options to prepend the authorization key (read 'man sshd')." + exit 0 + ;; + 1|rsa1) + keytype=rsa1 + id_file=identity.pub + auth_file=authorized_keys + ;; + 2|dsa) + keytype=dsa + id_file=id_dsa.pub + auth_file=authorized_keys2 + ;; + rsa) + keytype=rsa + id_file=id_rsa.pub + auth_file=authorized_keys2 + ;; + *) + echo "ERROR: Wrong keytype! (Use '$prg --help' for help)" + exit 1 + ;; +esac + +host=$1 +shift +options=$@ + +if [ -n "$options" ]; then + options="$options " +fi + +[ -f ~/.ssh/$id_file ] || ssh-keygen -t $keytype +ssh $host "mkdir -p ~/.ssh && echo '$options'`cat ~/.ssh/$id_file` >> ~/.ssh/$auth_file" diff --git a/addons/x11infoscreen/usr/local/bin/pickx86config b/addons/x11infoscreen/usr/local/bin/pickx86config new file mode 100755 index 0000000..52dbdc9 --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/pickx86config @@ -0,0 +1,13 @@ +#!/bin/sh + +# FIXME: Why won't this work? +#cfgmaybe=`lspci | perl -n -e 'sĦ^.* VGA .*:\W(\w*).*Ħ/etc/X11/XF86Config-4-$1Ħi && print if -f'` + +cfgbase="/etc/X11/XF86Config-4" + +cfgmaybe="$cfgbase-`lspci | perl -n -e 'sĦ^.* VGA .*:\W(\w*).*Ħ$1Ħi && print'`" +if [ -r "$cfgmaybe" ]; then + echo "$cfgmaybe" +else + echo "$cfgbase" +fi diff --git a/addons/x11infoscreen/usr/local/bin/savelocaltweaks b/addons/x11infoscreen/usr/local/bin/savelocaltweaks new file mode 100755 index 0000000..b303cda --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/savelocaltweaks @@ -0,0 +1,61 @@ +#!/bin/sh + +#set -e + +basedir="/etc" +targetdir="/tmp/localtweaks" +includefile="/etc/local/localtweaks.include" +excludefile="/etc/local/localtweaks.exclude" +extensions=".orig .old" + +for ext in $extensions; do + extfiles="`find $basedir -name \*$ext`" + for extfile in $extfiles; do + xextfile="${extfile%$ext}" + files="$files ${xextfile#$basedir}" + done +done + +includes="" +if [ -d "`dirname $includefile`" ] && [ -r $includefile ]; then + includes="`cat $includefile`" + for include in $includes; do + files="$files ${include#$basedir}" + done +fi + +excludes="" +if [ -d "`dirname $excludefile`" ] && [ -r $excludefile ]; then + xexcludes="`cat $excludefile`" + for exclude in $xexcludes; do + excludes="$excludes ${exclude#$basedir}" + done +fi + +# process all files once each +for file in `for x in $files; do echo $x; done | uniq | sort`; do + + for exclude in $excludes; do + [ "$file" = "$exclude" ] && continue 2 + done + + ext="" + for xext in $extensions; do + if [ -e $basedir/$file$xext ]; then + ext="$xext" + continue + fi + done + + newdir="$targetdir/$basedir/`dirname $file`" + mkdir -p $newdir + cp -af $basedir/$file $newdir + + # Only diff against existing and non-empty files. + if [ -n "$ext" ] && [ -s $basedir/$file$ext ]; then + diff -ruN $basedir/$file$ext $basedir/$file > $targetdir/$basedir/$file.diff + chown --reference=$basedir/$file $targetdir/$basedir/$file.diff + chmod --reference=$basedir/$file $targetdir/$basedir/$file.diff + chmod a-x $targetdir/$basedir/$file.diff + fi +done diff --git a/addons/x11infoscreen/usr/local/bin/slideshow b/addons/x11infoscreen/usr/local/bin/slideshow new file mode 100755 index 0000000..f0c3915 --- /dev/null +++ b/addons/x11infoscreen/usr/local/bin/slideshow @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +if [ -z "$DISPLAY" ]; then + export DISPLAY=:0 +fi + +# Make sure display is alive and awake +/usr/local/bin/xset s reset +/usr/local/bin/xset s off + +# Clean out stale directories (hoping noone else use same name!) +rm -rf /tmp/xslideshow.?????? + +workdir="`mktemp -d /tmp/xslideshow.XXXXXX`" +remotehost="lager" +remoteuser="infoscreen" +remotedir="/home/jonas/websites/info.dgi-huset.dk/img" + +#cd "$workdir" + +while true; do + rsync -a "$remoteuser@$remotehost":"$remotedir"/*.png "$workdir/" + files="`find $workdir -name '*.png' | sort`" + for file in $files; do +# timeslices=`echo $file | sed 's/.*_([0-9]+)s\.png/\1/'` +# for i in `seq 1 $timeslices`; do + qiv -m --root $file + sleep 5 + done +done +# qiv -m --slide --delay=5 $files diff --git a/addons/x11infoscreen/usr/local/bin/xset b/addons/x11infoscreen/usr/local/bin/xset new file mode 100755 index 0000000..daf82f7 Binary files /dev/null and b/addons/x11infoscreen/usr/local/bin/xset differ diff --git a/addons/x11phonehome/etc/X11/xorg.conf b/addons/x11phonehome/etc/X11/xorg.conf new file mode 100644 index 0000000..3c5aed2 --- /dev/null +++ b/addons/x11phonehome/etc/X11/xorg.conf @@ -0,0 +1,115 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Module" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "type1" + Load "vbe" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xorg" + Option "XkbModel" "pc105" + Option "XkbLayout" "dk" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "vesa" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 30-75 + VertRefresh 50-85 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 16 + SubSection "Display" + Depth 1 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11phonehome/etc/X11/xorg.conf-Intel b/addons/x11phonehome/etc/X11/xorg.conf-Intel new file mode 100644 index 0000000..ae0023a --- /dev/null +++ b/addons/x11phonehome/etc/X11/xorg.conf-Intel @@ -0,0 +1,115 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Module" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "type1" + Load "vbe" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xorg" + Option "XkbModel" "pc105" + Option "XkbLayout" "dk" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "i810" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 30-75 + VertRefresh 50-85 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 16 + SubSection "Display" + Depth 1 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11phonehome/etc/X11/xorg.conf-Trident b/addons/x11phonehome/etc/X11/xorg.conf-Trident new file mode 100644 index 0000000..99266d1 --- /dev/null +++ b/addons/x11phonehome/etc/X11/xorg.conf-Trident @@ -0,0 +1,115 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Module" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "type1" + Load "vbe" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xfree86" + Option "XkbModel" "pc105" + Option "XkbLayout" "dk" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "trident" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 30-75 + VertRefresh 50-85 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 16 + SubSection "Display" + Depth 1 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11phonehome/etc/X11/xorg.conf-Trident.orig b/addons/x11phonehome/etc/X11/xorg.conf-Trident.orig new file mode 100644 index 0000000..e69de29 diff --git a/addons/x11phonehome/etc/X11/xorg.conf.orig b/addons/x11phonehome/etc/X11/xorg.conf.orig new file mode 100644 index 0000000..33bbb23 --- /dev/null +++ b/addons/x11phonehome/etc/X11/xorg.conf.orig @@ -0,0 +1,129 @@ +# XF86Config-4 (XFree86 X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the XF86Config-4 manual page. +# (Type "man XF86Config-4" at the shell prompt.) +# +# This file is automatically updated on xserver-xfree86 package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xfree86 +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following commands as root: +# +# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom +# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum +# dpkg-reconfigure xserver-xfree86 + +Section "Files" + FontPath "unix/:7100" # local font server + # if the local font server has problems, we can fall back on these + FontPath "/usr/lib/X11/fonts/misc" + FontPath "/usr/lib/X11/fonts/cyrillic" + FontPath "/usr/lib/X11/fonts/100dpi/:unscaled" + FontPath "/usr/lib/X11/fonts/75dpi/:unscaled" + FontPath "/usr/lib/X11/fonts/Type1" + FontPath "/usr/lib/X11/fonts/CID" + FontPath "/usr/lib/X11/fonts/Speedo" + FontPath "/usr/lib/X11/fonts/100dpi" + FontPath "/usr/lib/X11/fonts/75dpi" +EndSection + +Section "Module" + Load "bitmap" + Load "dbe" + Load "ddc" + Load "dri" + Load "extmod" + Load "freetype" + Load "glx" + Load "int10" + Load "record" + Load "type1" + Load "vbe" +EndSection + +Section "InputDevice" + Identifier "Generic Keyboard" + Driver "keyboard" + Option "CoreKeyboard" + Option "XkbRules" "xorg" + Option "XkbModel" "pc104" + Option "XkbLayout" "us" +EndSection + +Section "InputDevice" + Identifier "Configured Mouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/psaux" + Option "Protocol" "PS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection +Section "InputDevice" + Identifier "Generic Mouse" + Driver "mouse" + Option "SendCoreEvents" "true" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "Emulate3Buttons" "true" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Device" + Identifier "Generic Video Card" + Driver "vesa" +EndSection + +Section "Monitor" + Identifier "Generic Monitor" + HorizSync 28-50 + VertRefresh 43-75 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Generic Video Card" + Monitor "Generic Monitor" + DefaultDepth 24 + SubSection "Display" + Depth 1 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 4 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 8 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 15 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 16 + Modes "800x600" "640x480" + EndSubSection + SubSection "Display" + Depth 24 + Modes "800x600" "640x480" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "Default Layout" + Screen "Default Screen" + InputDevice "Generic Keyboard" + InputDevice "Configured Mouse" + InputDevice "Generic Mouse" +EndSection + +Section "DRI" + Mode 0666 +EndSection diff --git a/addons/x11phonehome/etc/init.d/local-phonehome b/addons/x11phonehome/etc/init.d/local-phonehome new file mode 100755 index 0000000..4b8ebfa --- /dev/null +++ b/addons/x11phonehome/etc/init.d/local-phonehome @@ -0,0 +1,102 @@ +#! /bin/sh +# +# local-phonehome +# +# Author: Jonas Smedegaard +# + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="PhoneHome daemons" +NAME=phonehome +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Gracefully exit if the package has been removed. +#test -x $DAEMON || exit 0 + +# Read config file if it is present. +#if [ -r /etc/default/$NAME ] +#then +# . /etc/default/$NAME +#fi + +# +# Function that starts the daemon/service. +# +d_start() { +# start-stop-daemon --start --quiet --pidfile $PIDFILE \ +# --exec $DAEMON + killall Xorg -wq || /bin/true + /usr/local/bin/launch-x11 + sleep 5 + /usr/local/bin/launch-unclutter + /usr/bin/motion +} + +# +# Function that stops the daemon/service. +# +d_stop() { +# start-stop-daemon --stop --quiet --pidfile $PIDFILE \ +# --name $NAME + /usr/bin/killall TERM motion || /bin/true + /usr/local/bin/launch-unclutter -k || /bin/true + /usr/local/bin/launch-x11 -k || /bin/true + killall Xorg -wq || /bin/true +} + +# +# Function that sends a SIGHUP to the daemon/service. +# +#d_reload() { +# start-stop-daemon --stop --quiet --pidfile $PIDFILE \ +# --name $NAME --signal 1 +#} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + #reload) + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this an "exit 0". + # + # echo -n "Reloading $DESC configuration..." + # d_reload + # echo "done." + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/addons/x11phonehome/etc/rc2.d/S99local-phonehome b/addons/x11phonehome/etc/rc2.d/S99local-phonehome new file mode 120000 index 0000000..3914b9e --- /dev/null +++ b/addons/x11phonehome/etc/rc2.d/S99local-phonehome @@ -0,0 +1 @@ +../init.d/local-phonehome \ No newline at end of file diff --git a/addons/x11phonehome/usr/local/bin/launch-unclutter b/addons/x11phonehome/usr/local/bin/launch-unclutter new file mode 100755 index 0000000..1995126 --- /dev/null +++ b/addons/x11phonehome/usr/local/bin/launch-unclutter @@ -0,0 +1,16 @@ +#!/usr/bin/launchtool -C + +tag = unclutter +command = unclutter -idle 1 -root -display ':0' +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:unclutter,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:unclutter,LOG_DAEMON,LOG_ERR +command output = syslog:unclutter,LOG_DAEMON,LOG_INFO +command errors = syslog:unclutter,LOG_DAEMON,LOG_ERR diff --git a/addons/x11phonehome/usr/local/bin/launch-x11 b/addons/x11phonehome/usr/local/bin/launch-x11 new file mode 100755 index 0000000..67c0d95 --- /dev/null +++ b/addons/x11phonehome/usr/local/bin/launch-x11 @@ -0,0 +1,16 @@ +#!/usr/bin/launchtool -C + +tag = x11 +command = /usr/bin/Xorg -allowMouseOpenFail -br -dpms -config `/usr/local/bin/pickxconfig` +daemon = yes +stats = yes +#user = myserver +#root dir = /tmp +#process count limit = 5 +#open files limit = 10 +wait times = 1,1,1,3,3,3,10,10,10 +infinite runs = yes +launchtool output = syslog:x11,LOG_DAEMON,LOG_INFO +launchtool errors = syslog:x11,LOG_DAEMON,LOG_ERR +command output = syslog:x11,LOG_DAEMON,LOG_INFO +command errors = syslog:x11,LOG_DAEMON,LOG_ERR diff --git a/addons/x11phonehome/usr/local/bin/pickxconfig b/addons/x11phonehome/usr/local/bin/pickxconfig new file mode 100755 index 0000000..51b8f41 --- /dev/null +++ b/addons/x11phonehome/usr/local/bin/pickxconfig @@ -0,0 +1,13 @@ +#!/bin/sh + +# FIXME: Why won't this work? +#cfgmaybe=`lspci | perl -n -e 'sĦ^.* VGA .*:\W(\w*).*Ħ/etc/X11/XF86Config-4-$1Ħi && print if -f'` + +cfgbase="/etc/X11/xorg.conf" + +cfgmaybe="$cfgbase-`lspci | perl -n -e 'sĦ^.* VGA .*:\W(\w*).*Ħ$1Ħi && print'`" +if [ -r "$cfgmaybe" ]; then + echo "$cfgmaybe" +else + echo "$cfgbase" +fi diff --git a/addons/x11phonehome/usr/local/bin/xset b/addons/x11phonehome/usr/local/bin/xset new file mode 100755 index 0000000..6ffc56f Binary files /dev/null and b/addons/x11phonehome/usr/local/bin/xset differ diff --git a/chroot.sh b/chroot.sh new file mode 100755 index 0000000..76db488 --- /dev/null +++ b/chroot.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 + +if [ "$1" = "temp" ]; then + shift + ./mount.sh temp || exit 1 + + export debian_chroot="flashybrid" + #chroot "$target" /bin/bash -l $@ + chroot "$targettemp" $@ + exitcode=$? + + ./umount.sh temp +else + ./mount.sh || exit 1 + + export debian_chroot="flashybrid" + #chroot "$target" /bin/bash -l $@ + chroot "$mountpoint" $@ + exitcode=$? + + ./umount.sh +fi + +exit $exitcode diff --git a/config-DEFAULTS b/config-DEFAULTS new file mode 100644 index 0000000..ae8a955 --- /dev/null +++ b/config-DEFAULTS @@ -0,0 +1,119 @@ +#!/bin/sh + +# Use the classic debootstrap or the newer cdebootstrap +debootstrap="cdebootstrap" + +# Default ordered list of all APT sources +aptsources="base security" + +# Default URI of base APT repository used for initial setup +aptsource_base_host="http://ftp.debian.org/debian/" + +# cdebootstrap seems to only support http URIs (unlike chroot'et aptitude) +aptsource_base_cdebootstrap="http://ftp.debian.org/debian/" + +# Tweaks at http://debian.jones.dk (disabled by default) +aptsource_jones_host="http://debian.jones.dk/" +aptsource_jones_components="kernels misc" +#aptsource_jones_components="kernels boot filesystems filesharing fileviewers php mediastreaming voip admin mailservers misc" + +# Default list of components (if not just "main") +#aptsource_base_components="main contrib non-free" + +# Default URI and components of additional APT sources +aptsource_security_host="http://security.debian.org/" +aptsource_security_components="updates/main" + +# Directories unavailable when not in maintainance mode +flashybrid_diskstore=" + /usr/doc + /usr/share/doc + /usr/share/info + /usr/share/locale + /usr/share/man + /var/cache/apt + /var/cache/debconf + /var/lib/apt + /var/lib/aptitude + /var/lib/dpkg + /usr/lib/gconv + /usr/share/aptitude +" + +# Directories stored in memory when not in maintainance mode +flashybrid_ramstore=" + /var/lib/dhcp3 + /var/lib/shorewall + /var/lib/nfs +" +# Directories always stored in memory (never preserved across boot) +flashybrid_ramtmp=" +" + +DHCPCLIENT="dhcp3" + +debootstrap_excludes="lilo,ipchains,pcmcia-cs,ppp,pppoe,pppoeconf,pppconfig,syslinux,logrotate,mailx,at,makedev,wget" +debootstrap_excludes="$debootstrap_excludes,nvi,base-config,cron,ed,fdutils,gettext-base,groff-base,info,iptables,man-db,manpages,nano,tasksel,telnet,apt-utils" +debootstrap_excludes="$debootstrap_excludes,bsdmainutils" +#debootstrap_excludes="$debootstrap_excludes,klogd,sysklogd" +debootstrap_excludes="$debootstrap_excludes,libpcap0.7" +debootstrap_excludes="$debootstrap_excludes,libtextwrap1,libdb4.2,console-common" +debootstrap_excludes="$debootstrap_excludes,console-data,console-tools,libconsole" + +# Save space by dropping MTA +debootstrap_excludes="$debootstrap_excludes,exim,exim4-base,exim4,exim4-config,exim4-daemon-light,libopencdk8,libpcre3,libtasn1-2,libgcrypt11,libgcrypt7,libgdbm3,libgnutls10,libgnutls11,libgpg-error0,liblockfile1,liblzo1" + +# Save space by dropping debconf i18n support +# (also allows to avoid logrotate - nasty to configure for r/o systems!) +#debootstrap_excludes="$debootstrap_excludes,debconf-i18n,liblocale-gettext-perl,libtext-charwidth-perl,libtext-iconv-perl,libtext-wrapi18n-perl" +#debootstrap_includes="debconf-english" +## FIXME: debootstrap currently broken and cannot include debconf-english, +## so do that as regular aptitude run within 1_makerootfs.sh. +debootstrap_excludes="$debootstrap_excludes,liblocale-gettext-perl,libtext-charwidth-perl,libtext-iconv-perl,libtext-wrapi18n-perl" +#debootstrap_excludes="$debootstrap_excludes,debconf-i18n" +#debootstrap_includes="debconf-english" + +# We want a different DHCP client - if at all +debootstrap_excludes="$debootstrap_excludes,dhcp-client" + +# Package groups depending on enabled features +aptitude_install_dhcpclient="dhcp3-client" +#aptitude_install_dhcpclient="udhcpc" +aptitude_install_grub="grub" +aptitude_install_flashybrid="flashybrid" +aptitude_install_nfs="nfs-common" + +# Kernel modules to install into the initrd +modules_install="usb-storage sd_mod scsi_mod uhci uhci-hcd ehci-hcd usbcore" +#modules_install="$modules_install vfat nls_cp437 msdos fat" + +# Boot helper apps +aptitude_install_boot="memtest86+ udev usbutils resolvconf module-init-tools" + +# Stuff semi-required for networking +aptitude_install_net="openssh-client openssh-server syslog-ng ifupdown" + +# Admin helper apps (mime-support is needed to read gzip'ed files through mc) +#aptitude_install_admin="mc mime-support file" +aptitude_install_admin="less mc mime-support" + +# Framebuffer-based infoscreen +#aptitude_install_fbinfoscreen="ppmtofb netpbm python" + +# X11-based infoscreen +# (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +#aptitude_install_x11infoscreen="xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" +#flashybrid_diskstore_x11infoscreen="/usr/X11R6/man" + +# X11-based PhoneHome +# (X11 core modules installed first to avoid -all packages pulled in) +aptitude_install_x11phonehome="xfonts-base xserver-xorg-input-kbd xserver-xorg-input-mouse xserver-xorg-video-i810" +aptitude_install_x11phonehome="$aptitude_install_x11phonehome xserver-xorg-core" +# (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +aptitude_install_x11phonehome="$aptitude_install_x11phonehome libxmuu1 launchtool unclutter" +aptitude_install_x11phonehome="$aptitude_install_x11phonehome motion simpleopal alsa-base" +flashybrid_diskstore_x11phonehome="/usr/X11R6/man" + +# Shorewall firewall +#aptitude_install_shorewall="shorewall wget wipl-daemon dhcp3-server iptstate" +#aptitude_install_shorewall="$aptitude_install_shorewall tcpd shorewall wget dhcp3-server iptstate br2684ctl" diff --git a/config-HOST b/config-HOST new file mode 100644 index 0000000..26edb54 --- /dev/null +++ b/config-HOST @@ -0,0 +1,34 @@ +#!/bin/sh + +mountpoint="/mnt/usbstick" + +# This may change each time you switch USB stick on the host +usbdev_host="/dev/sda" + +# These usually do not change +usbdev_target="/dev/sda" +usbdev_grub="hd0" + +# Ordered list of all APT sources (if different from DEFAULT) +#aptsources="base security jones" +aptsources="base security" + +# URI of base APT repository (if different from DEFAULT) +# TODO: Check if cdebootstrap (like debootstrap) can somehow use file:/ URI +aptsource_base_host="file:/pub/mirrors/debian/" + +# cdebootstrap seem to only support http URI (unlike chroot'et aptitude) +aptsource_base_cdebootstrap="http://mirrors.jones.dk/debian/" + +# Default list of components (if not just "main") +#aptsource_base_components="main contrib non-free" + +# URI and components of additional APT sources (if different from DEFAULT) +#aptsource_security_host="file:/pub/mirrors/debian-security/" +#aptsource_jones_host="http://debian.jones.dk/" +#aptsource_jones_components="kernels misc" + +# Device name (or NFS share) to mount to "/pub" +pubdev_host="192.168.102.252:/pub" +# Device type for "/pub" +pubfs="nfs" diff --git a/config-MANDATED b/config-MANDATED new file mode 100644 index 0000000..8d78323 --- /dev/null +++ b/config-MANDATED @@ -0,0 +1,159 @@ +#!/bin/sh + +# FIXME: Rewrite all config_MANDATED options as functions + +# Resolve bootloaders and install targets +syslinuxdev_host='' +isolinuxdev_host='' +grubdev_host='' +lilodev_host='' +partno=0 +for bootloader in $bootloaders; do + let partno=$partno+1 + if [ $partno -gt 4 ]; then + echo 'ERROR: No more than 4 bootloaders supported!' >&2 + exit 1 + fi + case $bootloader in + SYSLINUX) + [ -n "$syslinuxdev_host" ] && continue + syslinuxdev_host="$usbdev_host$partno" + thisfs='' + for fs in $selectable_filesystems; do + case $fs in + vfat|msdos) + thisfs=$fs + continue 2 + ;; + esac + done + if [ -z "$thisfs" ]; then + echo "ERROR: None of the selectable filesystems suitable for $bootloader"'!' >&2 + exit 1 + fi + eval fs$partno=$thisfs + ;; + GRUB) + [ -n "$grubdev_host" ] && continue + grubdev_host="$usbdev_host$partno" + let partno_grub=$partno-1 || partno_grub=0 + grubdev_grub="$usbdev_grub,$partno_grub" + thisfs='' + for fs in $selectable_filesystems; do + case $fs in + ext2|ext3|e2fs|e3fs|ext2fs|ext3fs) + thisfs=e2fs + continue 2 + ;; + fat|vfat|dos) + thisfs=fat + continue 2 + ;; + isofs) + # FIXME: Do we need a specific 1st stage bootloader defined here as well? + thisfs=$fs + continue 2 + ;; + jfs|reiserfs|xfs|minix) + thisfs=$fs + continue 2 + ;; + esac + done + if [ -z "$thisfs" ]; then + echo "ERROR: None of the selectable filesystems suitable for $bootloader"'!' >&2 + exit 1 + fi + eval fs$partno=$thisfs + ;; + LILO|ISOLINUX) + echo "ERROR: bootloader \"$bootloader\" not yet implemented"'!' >&2 + exit 1 + ;; + *) + echo "ERROR: Unknown bootloader \"$bootloader\""'!' >&2 + exit 1 + ;; + esac +done +# TODO: Loop through all possible bootloaders instead of checking only these two +if [ -n "$grubdev_host" ] && [ -n "$syslinuxdev_host" ]; then + MULTIPLE_BOOTLOADERS="yes" +fi +if [ "$MULTIPLE_BOOTLOADERS" = "yes" ]; then + MBR="yes" +fi +if [ -z "$grubdev_host$syslinuxdev_host$isolinuxdev_host$lilodev_host" ]; then + echo 'ERROR: No bootloader defined!' >&2 + exit 1 +fi +if [ -n "$syslinuxdev_host" ] && [ "$ROOTFS" != "isofs" ]; then + INCOMPATIBLE_FS="yes" +fi +bootdev_host="${usbdev_host}1" +# FIXME: Set rootdev to dev of highest priority bootloader matching ROOTFS +if [ "$MULTIPLE_BOOTLOADERS" = "yes" ] || [ "$INCOMPATIBLE_FS" = "yes" ]; then + rootdev_host="${usbdev_host}2" + rootdev_target="${usbdev_target}2" +else + rootdev_host="${usbdev_host}1" + rootdev_target="${usbdev_target}1" +fi +if [ "$FLASHYBRID" = "yes" ] && [ "$ROOTFS" = "isofs" ]; then + echo 'ERROR: FLASHYBRID requires a writable root filesystem!' >&2 + exit 1 +fi +# FIXME: Support rolling the prepared system into a read-only ISO +# filesystem instead of using flashybrid +if [ "$ROOTFS" = "isofs" ]; then + echo 'ERROR: isofs root filesystem is not yet supported!' >&2 + exit 1 +fi + +debootstrap_excludes="lilo,ipchains,pcmcia-cs,ppp,pppoe,pppoeconf,pppconfig,syslinux,logrotate,mailx,at,makedev,wget" +debootstrap_excludes="$debootstrap_excludes,nvi,base-config,cron,ed,fdutils,gettext-base,groff-base,info,iptables,man-db,manpages,nano,tasksel,telnet,apt-utils" +debootstrap_excludes="$debootstrap_excludes,bsdmainutils" +#debootstrap_excludes="$debootstrap_excludes,klogd,sysklogd" +debootstrap_excludes="$debootstrap_excludes,libpcap0.7" +debootstrap_excludes="$debootstrap_excludes,libtextwrap1,libdb4.2,console-common" +debootstrap_excludes="$debootstrap_excludes,console-data,console-tools,libconsole" + +# Save space by dropping MTA +debootstrap_excludes="$debootstrap_excludes,exim,exim4-base,exim4,exim4-config,exim4-daemon-light,libopencdk8,libpcre3,libtasn1-2,libgcrypt11,libgcrypt7,libgdbm3,libgnutls10,libgnutls11,libgpg-error0,liblockfile1,liblzo1" + +# Save space by dropping debconf i18n support +# (also allows to avoid logrotate - nasty to configure for r/o systems!) +#debootstrap_excludes="$debootstrap_excludes,debconf-i18n,liblocale-gettext-perl,libtext-charwidth-perl,libtext-iconv-perl,libtext-wrapi18n-perl" +#debootstrap_includes="debconf-english" +## FIXME: debootstrap currently broken and cannot include debconf-english, +## so do that as regular aptitude run within 1_makerootfs.sh. +debootstrap_excludes="$debootstrap_excludes,liblocale-gettext-perl,libtext-charwidth-perl,libtext-iconv-perl,libtext-wrapi18n-perl" +#debootstrap_excludes="$debootstrap_excludes,debconf-i18n" +#debootstrap_includes="debconf-english" + +# Alternative DHCP client implementations +debootstrap_excludes="$debootstrap_excludes,dhcp-client" + +case $DHCPCLIENT in + dhcp3) + aptitude_dhcpclient_install="dhcp3-client" + ;; + udhcpc) + aptitude_dhcpclient_install="udhcpc" + ;; + *) + echo "ERROR: Unknown dhcp client \"$DHCPCLIENT\""'!' >&2 + exit 1 + ;; +esac + +[ -n "$grubdev_host" ] && aptitude_install="$aptitude_install grub" +[ "$FLASHYBRID" = "yes" ] && aptitude_install="$aptitude_install flashybrid" + +if [ "$diskfs" = "nfs" ] || [ "$pubfs" = "nfs" ]; then + aptitude_install="$aptitude_install nfs-common" +fi + +# Kernel modules to install into the initrd +modules_install="usb-storage sd_mod scsi_mod uhci uhci-hcd ehci-hcd usbcore" +#modules_install="$modules_install vfat nls_cp437 msdos fat" diff --git a/config-TARGET b/config-TARGET new file mode 120000 index 0000000..49a5f3c --- /dev/null +++ b/config-TARGET @@ -0,0 +1 @@ +config-lasse \ No newline at end of file diff --git a/config-chr b/config-chr new file mode 100644 index 0000000..0d66ca4 --- /dev/null +++ b/config-chr @@ -0,0 +1,101 @@ +#!/bin/sh + +# Name and (if wanted) default IP address of system +hostname="usbstick" +#domainname="example.tld" +domainname="jones.dk" +#hostdefaultip="192.168.133.133" + +suite="sarge" + +baseworkdir="/home/CHR" + +diskhost="hykrion.jones.dk" +loghost="192.168.102.252" + +targettemp="$baseworkdir/tmproot" +targettemp_fat="$baseworkdir/tmpfatroot" +targettemp_isofs="$baseworkdir/tmpisoroot" +targetoffline="$baseworkdir/flashybrid-off" + +# Set to one or more (space-delimited, max 4) of these: +# SYSLINUX +# ISOLINUX (not yet implemented) +# GRUB (installs, but fails to load 2nd stage - please help! ) +# LILO (not yet implemented) +# First one will be used by default (hit "a" at MBR promt to select) +# FIXME: fdisk code unfinished: leave it as "SYSLINUX GRUB" for now! +#bootloaders="SYSLINUX GRUB" +bootloaders="GRUB" + +# Uncomment one or more of these +# (DFSBUILD, MKINITRD_CD and MKINITRD_NETBOOT not yet implemented) +FLASHYBRID="yes" +#DFSBUILD="yes" +#MKINITRD_CD="yes" +#MKINITRD_NETBOOT="yes" + +# Set to one of the following: +# ext2 (recommended!) +# ext3 +# isofs (not yet supported) +ROOTFS="ext2" + +# Set to prioritized list of filesystems you want used on the stick +# (USB sticks have limited write count: avoid journalling filesystems) +# (SYSLINUX use only 8.3 filenames, so msdos might be better than vfat) +selectable_filesystems="ext2 vfat" + +# If enabled, this will get get attached to /disk (needed by FLASHYBRID) +diskdev_host="${diskhost:+$diskhost:$baseworkdir/flashybrid-off}" +diskdev_target="$diskdev_host" +diskfs="nfs" + +# APT repository for initial setup (and possibly more) +# (use file:/pub/... and enable nfs - sppedy and works in chroot too) +#mirror="http://192.168.102.252/mirrors/debian/" +mirror="file:/pub/mirrors/debian/" + +mirror_addon="http://debian.jones.dk/" +mirror_addon_target="kernels misc" + +# If enabled, this will get attached to /pub +#pubdev_host="${diskhost:+$diskhost:/pub}" +pubdev_host="192.168.102.252:/pub" +pubdev_target="$pubdev_host" +pubfs="nfs" + +# Define this to redirect all log output to another host +loghost="$loghost" + +# Packages to install beyond the bare minimum +aptitude_install="initrd-tools yaird" +#aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" +aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" +aptitude_install_custom="mc less ssh syslog-ng console-log" + +#This one needs to be installed separately from daemons +#aptitude_install_custom="$aptitude_install_custom file-rc" + +# Boot helper apps +aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils ifplugd ifrename resolvconf module-init-tools" + +# Admin helper apps (e.g. for reading gzip'ed files through mc) +aptitude_install_custom="$aptitude_install_custom mime-support file" + +# You probably won't need this (needed for framebuffer-based infoscreen) +#aptitude_install_custom="$aptitude_install ppmtofb netpbm python" + +# You probably won't need this (needed for X11-based infoscreen) +# (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +#aptitude_install_custom="$aptitude_install xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" +#diskstore="$flashybrid_diskstore /usr/X11R6/man" + +# Shorewall firewall +aptitude_install_custom="$aptitude_install_custom shorewall wget wipl-daemon dhcp3-server" + +# Kernel modules to load at boot time +modules_load="via-rhine" + +# Uncomment this to ease tracing configuration tweaks +trace="yes" diff --git a/config-chr.diff b/config-chr.diff new file mode 100644 index 0000000..3546565 --- /dev/null +++ b/config-chr.diff @@ -0,0 +1,104 @@ +--- config-dgih 2005-09-29 11:56:48.000000000 +0200 ++++ config-chr 2005-09-29 10:43:44.000000000 +0200 +@@ -1,19 +1,17 @@ + #!/bin/sh + + # Name and (if wanted) default IP address of system +-hostname="vagabonden" +-domainname="dgi-huset.dk" ++hostname="usbstick" ++#domainname="example.tld" ++domainname="jones.dk" + #hostdefaultip="192.168.133.133" + + suite="sarge" + +-baseworkdir="/home/VAGABONDEN" ++baseworkdir="/home/CHR" + +-# Hosts used for several services like syslog and network filesystems +-diskhost="lager" +-loghost="log" +- +-dns_server="192.168.101.2" ++diskhost="hykrion.jones.dk" ++loghost="192.168.102.252" + + targettemp="$baseworkdir/tmproot" + targettemp_fat="$baseworkdir/tmpfatroot" +@@ -37,10 +35,6 @@ + #MKINITRD_CD="yes" + #MKINITRD_NETBOOT="yes" + +-# Set this empty to avoid dhcp client altogether +-DHCPCLIENT="dhcp3" +-#DHCPCLIENT="udhcpc" +- + # Set to one of the following: + # ext2 (recommended!) + # ext3 +@@ -57,32 +51,34 @@ + diskdev_target="$diskdev_host" + diskfs="nfs" + +-# Ordered list of all APT sources (if different from DEFAULT and HOST) +-#aptsources="base security jones" +- +-# URI and components of base APT repository as seen on target (if different from host setup) +-# (remember to enable nfs if using "file:/pub/...") +-aptsource_base_target="http://ftp.debian.org/debian/" +-#aptsource_base_target="file:/pub/mirrors/debian/" +- +-aptsource_security_target="http://security.debian.org/" +- +-# Device name (or NFS share) to mount to "/pub" (if different from HOST) +-pubdev_target="$diskhost:/pub" ++# APT repository for initial setup (and possibly more) ++# (use file:/pub/... and enable nfs - sppedy and works in chroot too) ++#mirror="http://192.168.102.252/mirrors/debian/" ++mirror="file:/pub/mirrors/debian/" ++ ++mirror_addon="http://debian.jones.dk/" ++mirror_addon_target="kernels misc" ++ ++# If enabled, this will get attached to /pub ++#pubdev_host="${diskhost:+$diskhost:/pub}" ++pubdev_host="192.168.102.252:/pub" ++pubdev_target="$pubdev_host" ++pubfs="nfs" + + # Define this to redirect all log output to another host + loghost="$loghost" + + # Packages to install beyond the bare minimum +-aptitude_install="initrd-tools" +-aptitude_kernel_install="kernel-image-2.4-386" +-aptitude_install_custom="mc less ssh syslog-ng" ++aptitude_install="initrd-tools yaird" ++#aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" ++aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" ++aptitude_install_custom="mc less ssh syslog-ng console-log" + + #This one needs to be installed separately from daemons + #aptitude_install_custom="$aptitude_install_custom file-rc" + + # Boot helper apps +-aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils resolvconf module-init-tools" ++aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils ifplugd ifrename resolvconf module-init-tools" + + # Admin helper apps (e.g. for reading gzip'ed files through mc) + aptitude_install_custom="$aptitude_install_custom mime-support file" +@@ -92,8 +88,11 @@ + + # You probably won't need this (needed for X11-based infoscreen) + # (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +-aptitude_install_custom="$aptitude_install_custom xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" +-diskstore="$flashybrid_diskstore /usr/X11R6/man" ++#aptitude_install_custom="$aptitude_install xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" ++#diskstore="$flashybrid_diskstore /usr/X11R6/man" ++ ++# Shorewall firewall ++aptitude_install_custom="$aptitude_install_custom shorewall wget wipl-daemon dhcp3-server" + + # Kernel modules to load at boot time + modules_load="via-rhine" diff --git a/config-dgih b/config-dgih new file mode 100644 index 0000000..5daa648 --- /dev/null +++ b/config-dgih @@ -0,0 +1,102 @@ +#!/bin/sh + +# Name and (if wanted) default IP address of system +hostname="vagabonden" +domainname="dgi-huset.dk" +#hostdefaultip="192.168.133.133" + +suite="sarge" + +baseworkdir="/home/VAGABONDEN" + +# Hosts used for several services like syslog and network filesystems +diskhost="lager" +loghost="log" + +dns_server="192.168.101.2" + +targettemp="$baseworkdir/tmproot" +targettemp_fat="$baseworkdir/tmpfatroot" +targettemp_isofs="$baseworkdir/tmpisoroot" +targetoffline="$baseworkdir/flashybrid-off" + +# Set to one or more (space-delimited, max 4) of these: +# SYSLINUX +# ISOLINUX (not yet implemented) +# GRUB (installs, but fails to load 2nd stage - please help! ) +# LILO (not yet implemented) +# First one will be used by default (hit "a" at MBR promt to select) +# FIXME: fdisk code unfinished: leave it as "SYSLINUX GRUB" for now! +#bootloaders="SYSLINUX GRUB" +bootloaders="GRUB" + +# Uncomment one or more of these +# (DFSBUILD, MKINITRD_CD and MKINITRD_NETBOOT not yet implemented) +FLASHYBRID="yes" +#DFSBUILD="yes" +#MKINITRD_CD="yes" +#MKINITRD_NETBOOT="yes" + +# Set this empty to avoid dhcp client altogether +DHCPCLIENT="dhcp3" +#DHCPCLIENT="udhcpc" + +# Set to one of the following: +# ext2 (recommended!) +# ext3 +# isofs (not yet supported) +ROOTFS="ext2" + +# Set to prioritized list of filesystems you want used on the stick +# (USB sticks have limited write count: avoid journalling filesystems) +# (SYSLINUX use only 8.3 filenames, so msdos might be better than vfat) +selectable_filesystems="ext2 vfat" + +# If enabled, this will get get attached to /disk (needed by FLASHYBRID) +diskdev_host="${diskhost:+$diskhost:$baseworkdir/flashybrid-off}" +diskdev_target="$diskdev_host" +diskfs="nfs" + +# Ordered list of all APT sources (if different from DEFAULT and HOST) +#aptsources="base security jones" + +# URI and components of base APT repository as seen on target (if different from host setup) +# (remember to enable nfs if using "file:/pub/...") +aptsource_base_target="http://ftp.debian.org/debian/" +#aptsource_base_target="file:/pub/mirrors/debian/" + +aptsource_security_target="http://security.debian.org/" + +# Device name (or NFS share) to mount to "/pub" (if different from HOST) +pubdev_target="$diskhost:/pub" + +# Define this to redirect all log output to another host +loghost="$loghost" + +# Packages to install beyond the bare minimum +aptitude_install="initrd-tools" +aptitude_kernel_install="kernel-image-2.4-386" +aptitude_install_custom="mc less ssh syslog-ng" + +#This one needs to be installed separately from daemons +#aptitude_install_custom="$aptitude_install_custom file-rc" + +# Boot helper apps +aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils resolvconf module-init-tools" + +# Admin helper apps (e.g. for reading gzip'ed files through mc) +aptitude_install_custom="$aptitude_install_custom mime-support file" + +# You probably won't need this (needed for framebuffer-based infoscreen) +#aptitude_install_custom="$aptitude_install ppmtofb netpbm python" + +# You probably won't need this (needed for X11-based infoscreen) +# (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +aptitude_install_custom="$aptitude_install_custom xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" +diskstore="$flashybrid_diskstore /usr/X11R6/man" + +# Kernel modules to load at boot time +modules_load="via-rhine" + +# Uncomment this to ease tracing configuration tweaks +trace="yes" diff --git a/config-dgih.diff b/config-dgih.diff new file mode 100644 index 0000000..dc4dd5d --- /dev/null +++ b/config-dgih.diff @@ -0,0 +1,43 @@ +--- config-dgih 2005-01-23 13:32:41.000000000 +0100 ++++ config-chr.tmp 2005-08-17 20:47:27.000000000 +0200 +@@ -1,28 +1,23 @@ + targettemp_fat="$baseworkdir/tmpfatroot" + targettemp_isofs="$baseworkdir/tmpisoroot" + targetoffline="$baseworkdir/flashybrid-off" + +-# Uncomment these to work on actual drive (instead of dir) +-mountpoint="/mnt/usbstick" +-# FIXME: Handle device here being different from target system +-usbdevice="/dev/sda" +-usbdevice_grub="hd0" +- + # Set to one or more (space-delimited, max 4) of these: + # SYSLINUX + # ISOLINUX (not yet implemented) +@@ -57,22 +52,31 @@ + + # APT repository for initial setup (and possibly more) + # (use file:/pub/... and enable nfs - sppedy and works in chroot too) +-mirror="http://ftp.debian.org/debian/" ++#mirror="http://192.168.102.252/mirrors/debian/" ++mirror="file:/pub/mirrors/debian/" + + loghost="$loghost" + + # Packages to install beyond the bare minimum +-aptitude_install="initrd-tools" +-aptitude_kernel_install="kernel-image-2.4-386" +-aptitude_install_custom="mc less ssh" ++aptitude_install="initrd-tools yaird" ++#aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" ++aptitude_kernel_install="kernel-image-2.6.12+debianlogo+squashfs+wrr" ++aptitude_install_custom="mc less ssh syslog-ng console-log" ++ ++#This one needs to be installed separately from daemons ++#aptitude_install_custom="$aptitude_install_custom file-rc" + + # Boot helper apps +-aptitude_install_custom="$aptitude_install_custom discover memtest86+" ++aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils ifplugd ifrename resolvconf module-init-tools" + + # Admin helper apps (e.g. for reading gzip'ed files through mc) diff --git a/config-jones b/config-jones new file mode 100644 index 0000000..ff18f24 --- /dev/null +++ b/config-jones @@ -0,0 +1,110 @@ +#!/bin/sh + +# Name and (if wanted) default IP address of system +hostname="perilin" +domainname="jones.dk" +#hostdefaultip="192.168.133.133" + +suite="sid" +# Suppress non-existing sid security updates +aptsources="base" + +baseworkdir="/home/PERILIN" + +# Hosts used for several services like syslog and network filesystems +diskhost="hykrion" +loghost="hysbald" + +dns_server="192.168.222.252" + +targettemp="$baseworkdir/tmproot" +targettemp_fat="$baseworkdir/tmpfatroot" +targettemp_isofs="$baseworkdir/tmpisoroot" +targetoffline="$baseworkdir/flashybrid-off" + +# Set to one or more (space-delimited, max 4) of these: +# SYSLINUX +# ISOLINUX (not yet implemented) +# GRUB (installs, but fails to load 2nd stage - please help! ) +# LILO (not yet implemented) +# First one will be used by default (hit "a" at MBR promt to select) +# FIXME: fdisk code unfinished: leave it as "SYSLINUX GRUB" for now! +#bootloaders="SYSLINUX GRUB" +bootloaders="GRUB" + +# Uncomment one or more of these +# (DFSBUILD, MKINITRD_CD and MKINITRD_NETBOOT not yet implemented) +FLASHYBRID="yes" +#DFSBUILD="yes" +#MKINITRD_CD="yes" +#MKINITRD_NETBOOT="yes" + +# Set this empty to avoid dhcp client altogether +DHCPCLIENT="dhcp3" +#DHCPCLIENT="udhcpc" + +# Set to one of the following: +# ext2 (recommended!) +# ext3 +# isofs (not yet supported) +ROOTFS="ext2" + +# Set to prioritized list of filesystems you want used on the stick +# (USB sticks have limited write count: avoid journalling filesystems) +# (SYSLINUX use only 8.3 filenames, so msdos might be better than vfat) +selectable_filesystems="ext2 vfat" + +# If enabled, this will get get attached to /disk (needed by FLASHYBRID) +diskdev_host="${diskhost:+$diskhost:$baseworkdir/flashybrid-off}" +diskdev_target="$diskdev_host" +diskfs="nfs" + +# Ordered list of all APT sources (if different from DEFAULT and HOST) +#aptsources="base security jones" + +# URI and components of base APT repository as seen on target (if different from host setup) +# (remember to enable nfs if using "file:/pub/...") +#aptsource_base_target="http://ftp.debian.org/debian/" +aptsource_base_target="file:/pub/mirrors/debian/" + +aptsource_security_target="http://security.debian.org/" + +# Device name (or NFS share) to mount to "/pub" (if different from HOST) +pubdev_target="$diskhost:/pub" + +# Define this to redirect all log output to another host +loghost="$loghost" + +# Packages to install beyond the bare minimum +aptitude_install="initramfs-tools" +#aptitude_kernel_install="kernel-image-2.4-386" +aptitude_kernel_install="kernel-image-2.6-386" +aptitude_install_custom="mc less openssh-client openssh-server syslog-ng ifupdown" + +#This one needs to be installed separately from daemons +#aptitude_install_custom="$aptitude_install_custom file-rc" + +# Boot helper apps +aptitude_install_custom="$aptitude_install_custom memtest86+ udev usbutils resolvconf module-init-tools" + +# Admin helper apps (e.g. for reading gzip'ed files through mc) +#aptitude_install_custom="$aptitude_install_custom mime-support file" +aptitude_install_custom="$aptitude_install_custom mime-support" + +# You probably won't need this (needed for framebuffer-based infoscreen) +#aptitude_install_custom="$aptitude_install ppmtofb netpbm python" + +# You probably won't need this (needed for X11-based infoscreen) +# (libxmuu1 is for locally added "xset" binary taken from xbase-clients) +#aptitude_install_custom="$aptitude_install_custom xfonts-base xserver-xfree86 libxmuu1 launchtool unclutter qiv" +#diskstore="$flashybrid_diskstore /usr/X11R6/man" + +# Shorewall firewall +#aptitude_install_custom="$aptitude_install_custom shorewall wget wipl-daemon dhcp3-server iptstate" +aptitude_install_custom="$aptitude_install_custom tcpd shorewall wget dhcp3-server iptstate br2684ctl" + +# Kernel modules to load at boot time +modules_load="via-rhine" + +# Uncomment this to ease tracing configuration tweaks +trace="yes" diff --git a/config-lasse b/config-lasse new file mode 100644 index 0000000..841978e --- /dev/null +++ b/config-lasse @@ -0,0 +1,108 @@ +#!/bin/sh + +# Name and (if wanted) default IP address of system +hostname="georg" +domainname="jones.dk" +#hostdefaultip="192.168.133.133" + +suite="sid" +# Suppress non-existing sid security updates +aptsources="base" + +baseworkdir="/home/GEORG" + +# Hosts used for several services like syslog and network filesystems +diskhost="192.168.102.159" +loghost="hysbald" + +dns_server="192.168.102.252" + +targettemp="$baseworkdir/tmproot" +targettemp_fat="$baseworkdir/tmpfatroot" +targettemp_isofs="$baseworkdir/tmpisoroot" +targetoffline="$baseworkdir/flashybrid-off" + +# We have plenty of room, so use flashybrid only for ramstore +#flashybrid_diskstore=" +#" + +# Set to one or more (space-delimited, max 4) of these: +# SYSLINUX +# ISOLINUX (not yet implemented) +# GRUB (installs, but fails to load 2nd stage - please help! ) +# LILO (not yet implemented) +# First one will be used by default (hit "a" at MBR promt to select) +# FIXME: fdisk code unfinished: leave it as "SYSLINUX GRUB" for now! +#bootloaders="SYSLINUX GRUB" +bootloaders="GRUB" +#bootloaders="SYSLINUX" + +# Uncomment one or more of these +# (DFSBUILD, MKINITRD_CD and MKINITRD_NETBOOT not yet implemented) +FLASHYBRID="yes" +#DFSBUILD="yes" +#MKINITRD_CD="yes" +#MKINITRD_NETBOOT="yes" + +# Set this empty to avoid dhcp client altogether +DHCPCLIENT="dhcp3" +#DHCPCLIENT="udhcpc" + +# Set to one of the following: +# ext2 (recommended!) +# ext3 +# isofs (not yet supported) +ROOTFS="ext2" + +# Set to prioritized list of filesystems you want used on the stick +# (USB sticks have limited write count: avoid journalling filesystems) +# (SYSLINUX use only 8.3 filenames, so msdos might be better than vfat) +selectable_filesystems="ext2 vfat" + +# If enabled, this will get get attached to /disk (needed by FLASHYBRID) +diskdev_host="${diskhost:+$diskhost:$baseworkdir/flashybrid-off}" +diskdev_target="$diskdev_host" +diskfs="nfs" + +# Ordered list of all APT sources (if different from DEFAULT and HOST) +#aptsources="base security jones" + +# URI and components of base APT repository as seen on target (if different from host setup) +# (remember to enable nfs if using "file:/pub/...") +#aptsource_base_target="http://ftp.debian.org/debian/" +aptsource_base_target="file:/pub/mirrors/debian/" + +aptsource_security_target="http://security.debian.org/" + +# Device name (or NFS share) to mount to "/pub" (if different from HOST) +pubdev_target="$diskhost:/pub" + +# Define this to redirect all log output to another host +loghost="$loghost" + +# Packages to install beyond the bare minimum +aptitude_install="initramfs-tools" +#aptitude_kernel_install="kernel-image-2.4-386" +kernel_majorver="2.6" +kernel_minorver="16" +kernel_abi="2" +kernel_subarch="486" +#FIXME: Resolve name automagically +kernel_name="${kernel_majorver}.${kernel_minorver}-${kernel_abi}-${kernel_subarch}" +aptitude_kernel_install="linux-image-${kernel_majorver}-${kernel_subarch}" + +#This one needs to be installed separately from daemons +#aptitude_install_custom="$aptitude_install_custom file-rc" + +aptsources="$aptsources jones" +aptsource_jones_components="kernels boot voip" + +addons="boot net admin x11phonehome" + +aptitude_install_custom="pwc-modules-${kernel_name} spca5xx-modules-${kernel_name}" + +# Kernel modules to load at boot time +modules_load="8139too" + +# Uncomment this to ease tracing configuration tweaks +trace="yes" diff --git a/functions b/functions new file mode 100644 index 0000000..7420f31 --- /dev/null +++ b/functions @@ -0,0 +1,125 @@ +#!/bin/sh + +# Comments on coding style: +# * shift mandatory function arguments: Provokes error if missing +# * quote variables: We want to support oddities like spaces in paths + +function preserveolderfile() { + ## DESC: Preserve copy of file, unless one exists already + # File to tweak + file="$1"; shift + # Extension used for new backup + newext="$1" + # Space-delimited list of possible extensions, default last + extensions="orig old" + for ext in $extensions; do + backupfile="$file.$ext" + [ "$ext" = "$newext" ] && newext_valid="yes" + if [ -f "$backupfile" ]; then + [ -n "$DEBUG" ] && echo "DEBUG: Backup file \"$backupfile\" not found - continuing." >&2 + continue + elif [ -e "$backupfile" ]; then + echo "ERROR: Backup file \"$backupfile\" is not a regular file." >&2 + return 1 + else + [ -n "$DEBUG" ] && echo "DEBUG: Backup file \"$backupfile\" found - exit silently." >&2 + return 0 + fi + done + if [ -n "$newext" ];then + if [ "$newext_valid" = "yes" ]; then + backupfile="$file.$newext" + else + echo "WARNING: Backup extension \"$newext\" is invalid - using default instead" >&2 + fi + fi + if [ -f "$file" ]; then + cp -p "file" "$backupfile" + elif [ -e "$file" ]; then + echo "ERROR: Backup of file \"$file\" failed - not a regular file." >&2 + return 1 + else + touch "$backupfile" + fi + return 0 +} + +function enableoraddlines() { + ## DESC: Add lines to file, or replace if similar exist already + # File to tweak + file="$1"; shift + # Word number in line to search for and replace if found + wordno="$1"; shift + [ -e "$file" ] || touch "$file" + for line; do + [ -z "$line" ] && continue + firstword=$(echo "$line" | awk "{print \$$wordno}") + # FIXME: Why doesn't it work to print ARGVOUT in END block? + linemissing=$(perl -i -pe "END { print \"$line\\n\" unless \$seen } sĦ^[#;\s]*($firstword)\s.*Ħ$line\\nĦ and \$seen++" "$file") +#"This stray quote is only to please buggy mc (cooledit) code hiliting + [ -n "$linemissing" ] && echo $linemissing >> "$file" + done + # FIXME: Figure out what exits non-zero above + return 0 +} + +function preserveandaddlines() { + ## DESC: Backup older file and add lines to it + # File to tweak + file="$1"; shift + # Extension of backup file + ext="$1"; shift + # Word number in line to search for and replace if found + wordno="$1"; shift + preserveolderfile "$file" "$ext" +# enableoraddlines "$file" "$wordno" $@ + # FIXME: Somehow avoid expansion, to avoid having to duplicate the whole enableoraddlines() + [ -e "$file" ] || touch "$file" + for line; do + [ -z "$line" ] && continue + firstword=$(echo "$line" | awk "{print \$$wordno}") + # FIXME: Why doesn't it work to print ARGVOUT in END block? + linemissing=$(perl -i -pe "END { print \"$line\\n\" unless \$seen } sĦ^[#;\s]*($firstword)\s.*Ħ$line\\nĦ and \$seen++" "$file") +#"This stray quote is only to please buggy mc (cooledit) code hiliting + [ -n "$linemissing" ] && echo $linemissing >> "$file" + done + # FIXME: Figure out what exits non-zero above + return 0 +} + +function perlrelines() { + ## DESC: Apply perl regex to lines of a single file + # File to tweak + file=$1; shift + backupfile="`savebackupfile "$file"`" + for regexp; do + perl -pi -e "$regexp" "$file" + done + cleanbackupfile "$file" "$backupfile" + + # FIXME: Figure out what exits non-zero above + return 0 +} + +function mkgrubdevmap() { + ## DESC: Spit out GRUB config used for /boot/grub/devices.map + device="$1"; shift + cat <&2 + fi + done + else + echo "WARNING: offline target $targetoffline does not exist." >&2 + fi +fi diff --git a/tweaks/usr/local/sbin/policy-rc.d b/tweaks/usr/local/sbin/policy-rc.d new file mode 100755 index 0000000..b89a676 --- /dev/null +++ b/tweaks/usr/local/sbin/policy-rc.d @@ -0,0 +1,65 @@ +#!/bin/sh + +# $Id: policy-rc.d,v 1.3 2006/04/22 16:04:55 jonas Exp $ +# +# Copyright Âİ 2006 Jonas Smedegaard +# Description: Suppress system V scripts if invoked within a chroot. +# +# 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, 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. + +# Policy-rc.d is mentioned in manpage invoke-rc.d(8) and documented at +# http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt + +set -e + +PRG=`basename $0` + +TEMP=`getopt -s sh --long list,quiet -n "$PRG" -- "$@"` +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +eval set -- "$TEMP" + +quiet="" +list="" +while true ; do + case "$1" in + --quiet) quiet="1" ; shift ;; + --list) list="1" ; shift ;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + esac +done +initscript="$1" +actions="$2" +runlevel="$3" + +if [ "$list" ]; then + cat <&2 "Chroot environment detected, suppressing sysV script." + fi + exit 101 +fi + +exit 0 diff --git a/umount.sh b/umount.sh new file mode 100755 index 0000000..9fc1a5b --- /dev/null +++ b/umount.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +. ./config-DEFAULTS || exit 1 +. ./config-HOST || exit 1 +. ./config-TARGET || exit 1 +. ./config-MANDATED || exit 1 + +if [ "$1" = "temp" ]; then + target="$targettemp" +else + target="$mountpoint" +fi + +if [ "$FLASHYBRID" = "yes" ]; then + if [ -d "$targetoffline" ]; then + for dir in $flashybrid_diskstore; do + umount $target$dir || true + done + else + echo "WARNING: offline target $targetoffline does not exist." >&2 + fi +fi +[ -n "$pubdev_host" ] && umount "$target/pub" || true +#umount proc-flashybrid || true +if [ -d /sys ]; then + umount "$target/sys" || true +fi +#if [ -d /dev/.udevdb ] || [ -f /dev/.devfsd ]; then +# umount "$target/dev" || true +#fi + +if [ ! "$1" = "temp" ]; then +# [ -n "$bootdev_host" ] && umount "$target/boot" || true + [ -n "$rootdev_host" ] && umount "$target" || true +fi diff --git a/usbreset.sh b/usbreset.sh new file mode 100755 index 0000000..b481513 --- /dev/null +++ b/usbreset.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +invoke-rc.d hotplug stop +for mod in sd_mod usb-storage scsi_mod uhci ehci-hcd usbcore; do + modprobe -r $mod +done +invoke-rc.d hotplug start -- cgit v1.2.3