diff options
author | Nicolás Reynolds <apoyosis@correo.inta.gob.ar> | 2011-05-18 17:15:13 -0300 |
---|---|---|
committer | Nicolás Reynolds <apoyosis@correo.inta.gob.ar> | 2011-05-18 17:15:13 -0300 |
commit | 3a6288aaf80c172c2559e7623bb314a7e5d96db5 (patch) | |
tree | 8d0c694d0562441555054d4f120fd376d228d754 /overlay | |
parent | 9de4af841974c542bdb519b09633063a64c75391 (diff) |
This is the one (I hope...)
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/etc/archiso/functions | 14 | ||||
-rw-r--r-- | overlay/etc/archiso/getshell | 9 | ||||
-rw-r--r-- | overlay/etc/fstab | 7 | ||||
-rw-r--r-- | overlay/etc/rc.conf | 33 | ||||
-rwxr-xr-x | overlay/etc/rc.d/archiso | 81 |
5 files changed, 56 insertions, 88 deletions
diff --git a/overlay/etc/archiso/functions b/overlay/etc/archiso/functions index fdd48f4..9fffdcb 100644 --- a/overlay/etc/archiso/functions +++ b/overlay/etc/archiso/functions @@ -1,12 +1,20 @@ # vim: set ft=sh: -cmdline_param () +# kernel_cmdline <param> <default> +# Looks for a parameter on the kernel's boot-time command line. +# +# returns: 0 if param was found. Also prints its value if it was a K=V param. +# 1 if it was not. Also prints value passed as <default> +# +kernel_cmdline () { - for param in ${CMDLINE}; do + for param in $(/bin/cat /proc/cmdline); do case "${param}" in - $1=*) echo "${param##*=}"; return ;; + $1=*) echo "${param##*=}"; return 0 ;; + $1) return 0 ;; *) continue ;; esac done [ -n "${2}" ] && echo "${2}" + return 1 } diff --git a/overlay/etc/archiso/getshell b/overlay/etc/archiso/getshell deleted file mode 100644 index a6f8775..0000000 --- a/overlay/etc/archiso/getshell +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -. /etc/archiso/functions - -shell="$(cmdline_param shell)" -[ -n "${shell}" ] && shell="/bin/bash" -[ ! -e "${shell}" ] && shell="/bin/sh" - -exec ${shell} diff --git a/overlay/etc/fstab b/overlay/etc/fstab index 3c43a5e..dd7d9bb 100644 --- a/overlay/etc/fstab +++ b/overlay/etc/fstab @@ -1,7 +1,4 @@ # /etc/fstab: static file system information +# # <file system> <dir> <type> <options> <dump> <pass> -aufs / aufs noauto 0 0 -none /dev/pts devpts defaults 0 0 -none /dev/shm tmpfs defaults 0 0 - -### Auto generated entries get added here: +union / auto noauto 0 0 diff --git a/overlay/etc/rc.conf b/overlay/etc/rc.conf index 3893268..f6fc65e 100644 --- a/overlay/etc/rc.conf +++ b/overlay/etc/rc.conf @@ -4,22 +4,33 @@ . /etc/archiso/functions LOCALE_DEFAULT="en_US.UTF-8" -CLOCK_DEFAULT="" -TIMEZONE_DEFAULT="" +DAEMON_LOCALE_DEFAULT="no" +CLOCK_DEFAULT="UTC" +TIMEZONE_DEFAULT="Canada/Pacific" KEYMAP_DEFAULT="us" +CONSOLEFONT_DEFAULT= +CONSOLEMAP_DEFAULT= +USECOLOR_DEFAULT="yes" +VERBOSE_DEFAULT="3" -LOCALE="$(cmdline_param locale ${LOCALE_DEFAULT})" -HARDWARECLOCK="$(cmdline_param clock ${CLOCK_DEFAULT})" -TIMEZONE="$(cmdline_param timezone ${TIMEZONE_DEFAULT})" -KEYMAP="$(cmdline_param keymap ${KEYMAP_DEFAULT})" -CONSOLEFONT="$(cmdline_param consolefont)" -CONSOLEMAP="$(cmdline_param consolemap)" -USECOLOR="yes" +LOCALE="$(kernel_cmdline locale ${LOCALE_DEFAULT})" +DAEMON_LOCALE="$(kernel_cmdline daemon_locale ${DAEMON_LOCALE_DEFAULT})" +HARDWARECLOCK="$(kernel_cmdline clock ${CLOCK_DEFAULT})" +TIMEZONE="$(kernel_cmdline timezone ${TIMEZONE_DEFAULT})" +KEYMAP="$(kernel_cmdline keymap ${KEYMAP_DEFAULT})" +CONSOLEFONT="$(kernel_cmdline consolefont ${CONSOLEFONT_DEFAULT})" +CONSOLEMAP="$(kernel_cmdline consolemap ${CONSOLEMAP_DEFAULT})" +USECOLOR="$(kernel_cmdline usecolor ${USECOLOR_DEFAULT})" +VERBOSE="$(kernel_cmdline verbose ${VERBOSE_DEFAULT})" MOD_AUTOLOAD="yes" +MODULES=() + +UDEV_TIMEOUT=30 +USEDMRAID="no" +USEBTRFS="no" +USELVM="no" HOSTNAME="libreiso" -#TODO add more auto-daemons here, especially the live-cd specific stuff -DAEMONS=(syslog-ng network archiso) #TODO: auto-network find-disks find-user-home diff --git a/overlay/etc/rc.d/archiso b/overlay/etc/rc.d/archiso index 3355737..1d4443c 100755 --- a/overlay/etc/rc.d/archiso +++ b/overlay/etc/rc.d/archiso @@ -1,66 +1,6 @@ # vim: set ft=sh: . /etc/rc.conf . /etc/rc.d/functions -. /etc/archiso/functions - - -scan_network () -{ - netparam () { echo ${2} | sed "s|.*${1}\([^ ]*\).*|\1|gi"; } - # - netdevs=$(cat /proc/net/dev | grep ':' | cut -d':' -f1) - for net in ${netdev}; do - stats=$(ifconfig ${net} | tr -s "\n" " ") - done -} - -scan_mount_pts () -{ - #iterate over all block devices - stat_busy "Scanning local block devices" - for dev in $(echo /sys/block/*/dev /sys/block/*/*/dev); do - - devname="/dev/$(echo ${dev} | cut -d'/' -f3,4 | cut -d'/' -f1)" - mountpt="/mnt/$(basename '${devname}')" - mkdir -p "${mountpt}" 2>/dev/null - mount ${options} "${devname}" "${mountpt}" >/dev/null 2>&1 - - fstype=$(awk '{ if ($1=="${devname}") { print $3" "$4;q }}' /proc/mounts) - fstype="${fstype%%,*}" - case "${fstype%% *}" in - *fat*|ntfs|*dos) options="user,exec,uid=0,gid=100,umask=00070" ;; - *) options="users,defaults,exec" ;; - #TODO handle 'sync' on usb devices... - esac - - echo "${devname} ${mountpt} ${fstype} ${options} 0 0 #configured by archiso" >>/etc/fstab - done - stat_done -} - -scan_swap () -{ - #Archie finds a pagefile.sys for windows/dos machines... may add later - stat_busy "Finding existing swap partitions" - swapdev="$(fdisk -l 2>/dev/null | grep swap | cut -d' ' -f1)" - if [ -e "${swapdev}" ]; then - swapon ${swapdev} - echo "${swapdev} swap swap defaults 0 0 #configured by archiso" >>/etc/fstab - fi - stat_done -} - -do_homedir () -{ - stat_busy "Scanning for existing HOME directory" - user="$(cmdline_param homeuser)" - for hdir in $(find /mnt -name "home/${user}" 2>/dev/null); do - mkdir -p "/home/libre/" - # break after the first success... - mount --bind "${hdir}" "/home/libre/" && break - done - stat_done -} do_makeuser () { @@ -86,11 +26,32 @@ do_fix_perms () stat_done } +# If an alternate console was specified on the kernel command line, +# start agetty on it too. +do_special_console() +{ + cmdline_console="$(kernel_cmdline console)" + [ $? -ne 0 ] && return + + dev="${cmdline_console%%,*}" + args="${cmdline_console##*,}" + baud="${args%%[neo]*}" && baud="${baud:-"9600"}" + [ "x${args}" != "x${args%%r}" ] && rts="-h" + + + stat_busy "Starting agetty on console: ${cmdline_console}" + echo "${dev}" >> /etc/securetty + echo "z0:2345:respawn:/sbin/agetty ${rts} ${baud} ${dev} linux" >> /etc/inittab + /sbin/telinit q + stat_done +} + case "$1" in start) do_locale_gen do_makeuser do_fix_perms + do_special_console ;; esac exit 0 |