From 676782bc3af8d266b67bbc35b7d791cd8c703aee Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 30 Aug 2006 05:32:35 +0000 Subject: Initial import git-svn-id: http://phraktured.net/archiso@1 00a9fe69-e71b-0410-bb23-df0e5024db41 --- default-config/etc/rc.d/archiso | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 default-config/etc/rc.d/archiso (limited to 'default-config/etc/rc.d/archiso') diff --git a/default-config/etc/rc.d/archiso b/default-config/etc/rc.d/archiso new file mode 100644 index 0000000..6acf18a --- /dev/null +++ b/default-config/etc/rc.d/archiso @@ -0,0 +1,66 @@ +# vim: set ft=sh: +cmdline_param () +{ + while param do; + case "${param}" in + $1=*) echo "${param##*=}"; break ;; + *) continue ;; + esac + done < read /proc/cmdline +} +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/archiso/functions # above goes in this file... + +do_mounts () +{ + #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 +} + +do_locale () +{ + #copy from rc.sysinit - use cmdline_param locale (or lang ?) +} + +do_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/arch/" + # break after the first success... + mount --bind "${hdir}" "/home/arch/" && break + done + stat_done +} -- cgit v1.2.3-70-g09d2