summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/linhes-live/bin
diff options
context:
space:
mode:
authorJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
committerJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
commit0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch)
treec0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core-testing/linhes-live/bin
downloadlinhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2
initial import
Diffstat (limited to 'abs/core-testing/linhes-live/bin')
-rwxr-xr-xabs/core-testing/linhes-live/bin/gen_fstab122
-rwxr-xr-xabs/core-testing/linhes-live/bin/km76
2 files changed, 198 insertions, 0 deletions
diff --git a/abs/core-testing/linhes-live/bin/gen_fstab b/abs/core-testing/linhes-live/bin/gen_fstab
new file mode 100755
index 0000000..db36546
--- /dev/null
+++ b/abs/core-testing/linhes-live/bin/gen_fstab
@@ -0,0 +1,122 @@
+#! /bin/sh
+#
+# gen_fstab - make new fstab for larch live system based on detected devices
+#
+# Author: Michael Towers <gradgrind[at]online[dot]de>
+#
+# This file is part of the larch project.
+#
+# larch is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# larch is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with larch; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#----------------------------------------------------------------------------
+# 2007.12.17
+
+# Note that the results are, by default, not copied into place
+# They end up here:
+DEST="/tmp/fstab"
+MNT="/tmp/mnt"
+
+# However, passing '-l' as command-line option will install them.
+# The old fstab will then be backed up to fstab~.
+LOAD=""
+if [ "$1" = "-l" ]; then LOAD="-l"; fi
+
+if [ -n "$( df | grep " ${MNT}" )" ]; then
+ echo "ERROR: Mounted filesystem at/within ${MNT}"
+ exit 1
+fi
+mkdir -p ${MNT}
+rm -rf ${MNT}/*
+
+tmpfile="/tmp/fstab2"
+: >${tmpfile}
+
+echo "# fstab generated by gen_fstab" >${DEST}
+echo "#<file system> <dir> <type> <options> <dump> <pass>" >>${DEST}
+echo >>${DEST}
+
+echo "none /dev/pts devpts defaults 0 0" >>${DEST}
+echo "none /dev/shm tmpfs defaults 0 0" >>${DEST}
+echo >>${DEST}
+
+# Get all other partitions
+sfdisk -d | grep "^/dev/" | sed "s|\(.*\):.*Id=\(..\).*|\1 \2|" | \
+ while read dev id; do
+ # Ignore if id is "Extended" or "LVM", these are not usable partitions
+ if [ "${id}" = "5" -o "${id}" = "8e" ]; then continue; fi
+ # See if swap
+ if [ "${id}" = "82" ]; then
+ printf "%-12s %-12s %-8s defaults,noatime 0 0\n" \
+ ${dev} swap swap >>${DEST}
+ continue
+ fi
+ removable=""
+ part=$( basename ${dev} )
+ if [ $( cat /sys/block/${part:0:3}/removable 2>/dev/null ) -ne 0 ]; then
+ removable="_rmv"
+ fi
+ mountdir=${part}${removable}
+ printf "%-12s %-12s %-8s user,noauto,noatime 0 0\n" \
+ ${dev} /mnt/${mountdir} auto >>${tmpfile}
+ mkdir -p ${MNT}/${mountdir}
+ done
+
+# LVM
+for lvmd in $( ls /dev/mapper 2>/dev/null | grep -v control ); do
+ printf "%-30s %-22s %-8s user,noauto,noatime 0 0\n" \
+ /dev/mapper/${lvmd} /mnt/${lvmd} auto >>${tmpfile}
+ mkdir -p ${MNT}/${lvmd}
+done
+
+echo >>${DEST}
+cat ${tmpfile} >>${DEST}
+rm ${tmpfile}
+echo >>${DEST}
+
+# CD devices
+for dev in $( cat /proc/sys/dev/cdrom/info 2>/dev/null | head -n 3 | \
+ tail -n 1 | cut -d ":" -f 2 ); do
+ mountdir="${dev}_cd"
+ mkdir ${MNT}/${mountdir}
+ printf "%-12s %-12s %-8s user,noauto,exec,unhide 0 0\n" \
+ /dev/${dev} /mnt/${mountdir} auto >>${DEST}
+done
+
+echo >>${DEST}
+echo "# This would do for a floppy" >>${DEST}
+echo "#/dev/fd0 /mnt/floppy vfat,ext2 rw,user,noauto 0 0" >>${DEST}
+echo "# + mkdir /mnt/floppy" >>${DEST}
+echo >>${DEST}
+echo "# E.g. for USB storage:" >>${DEST}
+echo "#/dev/sdb1 /mnt/usb auto rw,user,noauto 0 0" >>${DEST}
+echo "# + mkdir /mnt/usb" >>${DEST}
+
+if [ -n "${LOAD}" ]; then
+ # test if the script is started by root user. If not, exit
+ if [ $UID -ne 0 ]; then
+ echo "Only root can run ${APP}"; exit 1
+ fi
+
+ cp -b ${DEST} /etc/fstab
+ # Delete removeable mount points which are not currently mounted
+ for m in $( ls /mnt | grep ^[hs]d ); do
+ if [ -z "$( df | grep " /mnt/${m}$" )" ]; then
+ rmdir /mnt/${m}
+ fi
+ done
+ for m in $( ls ${MNT} ); do
+ mkdir -p /mnt/${m}
+ done
+fi
diff --git a/abs/core-testing/linhes-live/bin/km b/abs/core-testing/linhes-live/bin/km
new file mode 100755
index 0000000..386d966
--- /dev/null
+++ b/abs/core-testing/linhes-live/bin/km
@@ -0,0 +1,76 @@
+#!/bin/sh
+# $Id: km,v 1.2 2005/12/13 04:14:53 judd Exp $
+# Modified by gradgrind to deal only with i386 keymaps
+# and BASEDIR changed
+# - also saves results to /etc/rc.conf
+
+# test if the script is started by root user. If not, exit
+if [ $UID -ne 0 ]; then
+ echo "This should be run as root"; exit 1
+fi
+
+ANSWER="/tmp/.km"
+BASEDIR="/usr/share/kbd"
+
+domenu()
+{
+ menutype=$1 ; shift
+ text=$1 ; shift
+ height=$1 ; shift
+ width=$1 ; shift
+ mheight=$1 ; shift
+
+ dialog --cancel-label "Skip" --$menutype "$text" $height $width $mheight $*
+}
+
+if [ ! -d $BASEDIR/keymaps ]; then
+ echo "Cannot load keymaps, as none were found in $BASEDIR/keymaps" >&2
+ exit 1
+else
+ echo "Scanning for keymaps..."
+ KEYMAPS=
+ for t in qwerty qwertz azerty dvorak; do
+ for i in `find $BASEDIR/keymaps/i386/$t -follow -name "*.gz"`; do
+ fn=`echo $i | sed "s|$BASEDIR/keymaps/i386/||"`
+ KEYMAPS="$KEYMAPS $fn -"
+ done
+ done
+ domenu menu "Select A Keymap" 22 60 16 $KEYMAPS 2>$ANSWER
+ keymap=`cat $ANSWER`
+fi
+
+if [ ! -d $BASEDIR/consolefonts ]; then
+ echo "Cannot load consolefonts, as none were found in $BASEDIR/consolefonts" >&2
+else
+ echo "Scanning for fonts..."
+ FONTS=
+ for i in `find $BASEDIR/consolefonts -follow -name "*.gz"`; do
+ fn=`echo $i | sed "s|$BASEDIR/consolefonts/||"`
+ FONTS="$FONTS $fn -"
+ done
+ domenu menu "Select A Console Font" 22 60 16 $FONTS 2>$ANSWER
+ font=`cat $ANSWER`
+fi
+
+if [ "$keymap" ]; then
+ echo "Loading keymap: $keymap"
+ loadkeys -q $BASEDIR/keymaps/i386/$keymap
+ sed -i "s|^KEYMAP=.*|KEYMAP=\"$( echo $keymap | \
+ cut -d'.' -f1 )\"|" /etc/rc.conf
+fi
+
+if [ "$font" ]; then
+ echo "Loading font: $font"
+ for i in `seq 1 4`; do
+ if [ -d /dev/vc ]; then
+ setfont $BASEDIR/consolefonts/$font -C /dev/vc/${i}
+ else
+ setfont $BASEDIR/consolefonts/$font -C /dev/tty${i}
+ fi
+ done
+ sed -i "s|^CONSOLEFONT=.*|CONSOLEFONT=\"$( echo $font | \
+ cut -d'.' -f1 )\"|" /etc/rc.conf
+fi
+
+exit 0
+