]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/scripts/readhash
Load libata prior udev at installer because some SATA doesnt autoload it
[people/pmueller/ipfire-2.x.git] / src / scripts / readhash
CommitLineData
cd1a2927
MT
1#!/bin/sh
2#
3# This script reads in variables from a config file, and produces a list of
4# commands to run to set these as shell environment variables, it is
5# intended to be used as follows:
6#
ee4fdd07 7# eval $(readhash /var/ipfire/main/settings)
cd1a2927
MT
8#
9
10# shell variables must consist of alphanumeric characters and underscores,
11# and begin with an alphabetic character or underscore.
12VARNAME='[A-Za-z_][A-zA-z0-9_]*'
13
14# For the assigned value we only accept a limited number of characters - none
15# of which are shell metachars
16VARCHARS='A-Za-z0-9=/,._@#+-'
17VARVAL="[${VARCHARS}]*"
18
a393e0ba 19sed -ne "s/\(${VARNAME}\)=\(${VARVAL}\)$/\1=\2/p" $1
cd1a2927
MT
20
21# Accept space only if it's quoted
a393e0ba 22sed -ne "s/\(${VARNAME}\)=\('[ ${VARCHARS}]*'\)$/\1=\2/p" $1