Changeset 475
- Timestamp:
- May 2, 2007 7:13:57 PM (6 years ago)
- Location:
- trunk/debirf
- Files:
-
- 6 added
- 3 edited
- 2 copied
- 1 moved
-
debian/changelog (modified) (1 diff)
-
fs/etc/debirf/disk-rescue (added)
-
fs/etc/debirf/disk-rescue/debirf.conf (moved) (moved from trunk/debirf/fs/etc/debirf/debirf.conf) (1 diff)
-
fs/etc/debirf/disk-rescue/plugins.d (added)
-
fs/etc/debirf/kiosk (added)
-
fs/etc/debirf/kiosk/debirf.conf (copied) (copied from trunk/debirf/fs/etc/debirf/debirf.conf) (1 diff)
-
fs/etc/debirf/kiosk/plugins.d (added)
-
fs/etc/debirf/minimal (added)
-
fs/etc/debirf/minimal/debirf.conf (copied) (copied from trunk/debirf/fs/etc/debirf/debirf.conf) (1 diff)
-
fs/etc/debirf/minimal/plugins.d (added)
-
fs/usr/sbin/make-debirf (modified) (7 diffs)
-
fs/usr/share/debirf/common (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/debirf/debian/changelog
r473 r475 3 3 * added more options when existing DEBIRF_ROOT found 4 4 * fixed bug about where initrd is written (closes CMRG #16) 5 * added new profiles structure 5 6 6 -- Jameson Rollins <jrollins@fifthhorseman.net> Mon, 30 Apr 2007 00:26:21-04007 -- Jameson Rollins <jrollins@fifthhorseman.net> Wed, 2 May 2007 19:10:09 -0400 7 8 8 9 debirf (0.3) unstable; urgency=low -
trunk/debirf/fs/etc/debirf/disk-rescue/debirf.conf
r473 r475 12 12 #DEBIRF_ROOT="$DEBIRF_PATH/root" 13 13 14 # the plugins directory15 #DEBIRF_PLUGINS="/usr/share/debirf/plugins"16 17 14 # debirf boot method 18 15 #DEBIRF_METHOD="stupid_simple" -
trunk/debirf/fs/etc/debirf/kiosk/debirf.conf
r473 r475 12 12 #DEBIRF_ROOT="$DEBIRF_PATH/root" 13 13 14 # the plugins directory15 #DEBIRF_PLUGINS="/usr/share/debirf/plugins"16 17 14 # debirf boot method 18 15 #DEBIRF_METHOD="stupid_simple" -
trunk/debirf/fs/etc/debirf/minimal/debirf.conf
r473 r475 12 12 #DEBIRF_ROOT="$DEBIRF_PATH/root" 13 13 14 # the plugins directory15 #DEBIRF_PLUGINS="/usr/share/debirf/plugins"16 17 14 # debirf boot method 18 15 #DEBIRF_METHOD="stupid_simple" -
trunk/debirf/fs/usr/sbin/make-debirf
r473 r475 16 16 CMD=$(basename $0) 17 17 18 DEBIRF_CONF=${DEBIRF_CONF:-"/etc/debirf/debirf.conf"} 19 [ -f "$DEBIRF_CONF" ] && source "$DEBIRF_CONF" 20 21 ### defaults 22 # debirf label 23 DEBIRF_LABEL=${DEBIRF_LABEL:-"debirf"} 24 # where to build the debirf 25 DEBIRF_PATH=${DEBIRF_PATH:-"/var/lib/debirf"} 26 # the debirf root, used by plugins 27 DEBIRF_ROOT=${DEBIRF_ROOT:-"$DEBIRF_PATH/root"} 28 # the plugins directory 29 DEBIRF_PLUGINS=${DEBIRF_PLUGINS:-"/usr/share/debirf/plugins"} 30 # debirf boot method 31 DEBIRF_METHOD=${DEBIRF_METHOD:-"stupid_simple"} 32 # Debian mirror 33 DEBIRF_MIRROR=${DEBIRF_MIRROR:-"http://mirrors.kernel.org/debian"} 34 # what distribution should debirf be built from? 35 DEBIRF_DISTRO=${DEBIRF_DISTRO:-"lenny"} 36 37 DEBIRF_COMMON="/usr/share/debirf/common" 38 39 DEBIRF_INFO_TARGET="${DEBIRF_ROOT}/etc/debirf/debirf.info" 40 41 # set locale default 42 export LC_CTYPE="C" 43 export LANGUAGE="C" 44 export LANG="C" 18 DEBIRF_COMMON=${DEBIRF_COMMON:-"/usr/share/debirf/common"} 19 source "$DEBIRF_COMMON" 45 20 46 21 ############################################################### … … 48 23 49 24 usage() { 50 cat <<EOF 51 Usage: $CMD kernel-image.deb 52 53 Create a debirf initramfs. 54 55 'man make-debirf' for more information. 25 cat <<EOF 26 Usage: $CMD profile kernel-image.deb 27 $CMD kernel-image.deb 56 28 EOF 29 } 30 31 failure() { 32 echo "$1" >&2 33 exit ${2:-'1'} 57 34 } 58 35 … … 120 97 # umount sys, proc 121 98 umount_proc-sys() { 99 [ "$DEBIRF_ROOT" ] || exit 122 100 if mount | grep -q "$DEBIRF_ROOT/proc" ; then 123 101 msg "umounting proc..." … … 135 113 trap umount_proc-sys EXIT 136 114 137 # check specified kernel package exists, and determine kernel name 138 DEBIRF_KERNEL_PACKAGE="$1" 115 if [ "$1" = '-h' -o "$1" = '--help' ] ; then 116 usage 117 exit 0 118 fi 119 120 case $# in 121 1) 122 DEBIRF_KERNEL_PACKAGE="$1" 123 ;; 124 2) 125 DEBIRF_PROFILE="$1" 126 DEBIRF_KERNEL_PACKAGE="$2" 127 ;; 128 *) 129 echo "Improper number of input arguments." 130 usage 131 exit 1 132 ;; 133 esac 134 135 # check specified kernel package exists 139 136 if [ ! -f "$DEBIRF_KERNEL_PACKAGE" ] ; then 140 echo "Specified kernel package $DEBIRF_KERNEL_PACKAGE not found." 141 echo 142 usage 143 exit 1 144 fi 145 146 # check for common functions 147 [ -f "$DEBIRF_COMMON" ] || failure "debirf function file $DEBIRF_COMMON not found." 148 source "$DEBIRF_COMMON" 149 150 # check plugin directory exists 151 if [ ! -d "$DEBIRF_PLUGINS" ] ; then 152 read -p "Plugin directory $DEBIRF_PLUGINS not found. Continue? [y|N]: " -n 1 OK ; [ -z $OK ] || echo 137 failure "Specified kernel package '$DEBIRF_KERNEL_PACKAGE' not found." 138 fi 139 140 # check for debirf profile 141 if [ -z "$DEBIRF_PROFILE" ] ; then 142 echo "Profile not specified." 143 read -p "Use default profile ('$DEBIRF_PROFILE_DEFAULT')? [Y|n]: " OK 144 if [ -z "$OK" -o "${OK/y/Y}" = 'Y' ] ; then 145 DEBIRF_PROFILE="$DEBIRF_PROFILE_DEFAULT" 146 fi 147 fi 148 if [ "$DEBIRF_PROFILE" ] ; then 149 if [ ! -d "$DEBIRF_PROFILE" ] ; then 150 if [ ! -d "$DEBIRF_PROFILED/$DEBIRF_PROFILE" ] ; then 151 failure "Profile '$DEBIRF_PROFILE' not found." 152 else 153 DEBIRF_PROFILE="$DEBIRF_PROFILED/$DEBIRF_PROFILE" 154 fi 155 fi 156 echo "Using profile '$DEBIRF_PROFILE'." 157 DEBIRF_CONF="$DEBIRF_PROFILE/debirf.conf" 158 DEBIRF_PLUGINS="$DEBIRF_PROFILE/plugins.d" 159 fi 160 161 # find debirf.conf 162 if [ "$DEBIRF_CONF" ] ; then 163 if [ -f "$DEBIRF_CONF" ] ; then 164 source "$DEBIRF_CONF" 165 else 166 failure "Config file '$DEBIRF_CONF' not found." 167 fi 168 fi 169 170 # find plugin directory 171 if [ "$DEBIRF_PLUGINS" ] ; then 172 if [ ! -d "$DEBIRF_PLUGINS" ] ; then 173 failure "Plugin directory '$DEBIRF_PLUGINS' not found." 174 fi 175 else 176 echo "Plugin directory file not specified." 177 read -p "Continue without plugins? [y|N]: " OK 153 178 if [ "${OK/y/Y}" != 'Y' ] ; then 154 179 failure "aborting." … … 156 181 fi 157 182 183 # echo 184 # for var in ${!DEBIRF_*}; do 185 # export $var 186 # done 187 # env | /bin/grep "^DEBIRF_" 188 # exit 189 158 190 # create debootstrap root 159 191 if [ -d "$DEBIRF_ROOT" ] ; then 160 echo "Directory $DEBIRF_ROOT already exists. Select one of the following:" 192 echo "Directory $DEBIRF_ROOT already exists." 193 echo "Select one of the following:" 161 194 select foo in 'rewrite' 'overwrite' 'skip' 'exit' ; do 162 195 case "$foo" in … … 179 212 fi 180 213 181 # if [ -d "$DEBIRF_ROOT" ] ; then182 # read -p "Directory $DEBIRF_ROOT already exists. write over? [y|N]: " -n 1 OK ; [ -z $OK ] || echo183 # if [ "${OK/y/Y}" = 'Y' ] ; then184 # msg "installing new root..."185 # create_debootstrap186 # fi187 # else188 # msg "installing root..."189 # create_debootstrap190 # fi191 192 214 setup_debirf_info 193 215 194 mount_proc-sys 195 196 # update apt 197 debirf_exec apt-get update 198 199 # install plugins 200 msg "installing plugins..." 201 run_plugins 202 203 umount_proc-sys 216 if [ "$DEBIRF_PLUGINS" ] ; then 217 mount_proc-sys 218 219 # update apt 220 debirf_exec apt-get update 221 222 # install plugins 223 msg "installing plugins..." 224 run_plugins 225 226 umount_proc-sys 227 fi 204 228 205 229 # clear mtab … … 212 236 KERNAVAIL=$(ls -1 "$DEBIRF_ROOT/lib/modules" | head -n1) 213 237 DEBIRF_INITRD="${DEBIRF_LABEL}_${DEBIRF_DISTRO}_${KERNAVAIL}.cgz" 214 create_initrd_${DEBIRF_METHOD} "$DEBIRF_ PATH/$DEBIRF_INITRD"238 create_initrd_${DEBIRF_METHOD} "$DEBIRF_BUILDD/$DEBIRF_INITRD" 215 239 216 240 # final output 217 DEBIRF_KERNEL=$(ls "$DEBIRF_ PATH" | grep "vmlinu" | grep "$KERNAVAIL")241 DEBIRF_KERNEL=$(ls "$DEBIRF_BUILDD" | grep "vmlinu" | grep "$KERNAVAIL") 218 242 msg "debirf initrd created." 219 if [ "$DEBIRF_ PATH/$DEBIRF_KERNEL" ] ; then220 msg "kernel: $DEBIRF_ PATH/$DEBIRF_KERNEL"221 fi 222 msg "initrd: $DEBIRF_ PATH/$DEBIRF_INITRD"243 if [ "$DEBIRF_BUILDD/$DEBIRF_KERNEL" ] ; then 244 msg "kernel: $DEBIRF_BUILDD/$DEBIRF_KERNEL" 245 fi 246 msg "initrd: $DEBIRF_BUILDD/$DEBIRF_INITRD" -
trunk/debirf/fs/usr/share/debirf/common
r395 r475 13 13 # or later. 14 14 15 # output debirf message to stdout 16 msg() { 17 echo "debirf: $@" 18 } 19 export -f msg 15 ############################################################### 16 ### VARIABLES 17 18 DEBIRF_PROFILED=${DEBIRF_PROFILED:-"/etc/debirf"} 19 DEBIRF_PROFILE_DEFAULT=${DEBIRF_PROFILE_DEFAULT:-"$DEBIRF_PROFILED/minimal"} 20 21 ### debirf.conf defaults 22 # debirf label 23 DEBIRF_LABEL=${DEBIRF_LABEL:-"debirf"} 24 # where to build the debirf 25 DEBIRF_BUILDD=${DEBIRF_BUILDD:-"/var/lib/debirf"} 26 # the debirf root, used by plugins 27 DEBIRF_ROOT=${DEBIRF_ROOT:-"$DEBIRF_BUILDD/root"} 28 # the plugins directory 29 DEBIRF_PLUGINS=${DEBIRF_PLUGINS:-"/usr/share/debirf/plugins"} 30 # debirf boot method 31 DEBIRF_METHOD=${DEBIRF_METHOD:-"stupid_simple"} 32 # Debian mirror 33 DEBIRF_MIRROR=${DEBIRF_MIRROR:-"http://mirrors.kernel.org/debian"} 34 # what distribution should debirf be built from? 35 DEBIRF_DISTRO=${DEBIRF_DISTRO:-"lenny"} 36 37 # set locale default 38 export LC_CTYPE="C" 39 export LANGUAGE="C" 40 export LANG="C" 41 42 ############################################################### 20 43 21 44 # cause debirf to exit immediately with message and exit code … … 27 50 export -f failure 28 51 52 # output debirf message to stdout 53 msg() { 54 echo "debirf: $@" 55 } 56 export -f msg 57 29 58 # execute command in debirf system using chroot 30 59 debirf_exec() { … … 35 64 # output info to the debirf.info file on the initramfs 36 65 setup_debirf_info() { 37 mkdir -p $(dirname "$ DEBIRF_INFO_TARGET")66 mkdir -p $(dirname "${DEBIRF_ROOT}/etc/debirf/debirf.info") 38 67 39 cat > "$ DEBIRF_INFO_TARGET" <<EOF68 cat > "${DEBIRF_ROOT}/etc/debirf/debirf.info" <<EOF 40 69 # debirf.info 41 70 # … … 49 78 # write comment to debirf.info file 50 79 debirf_info_comment() { 51 echo "$@" | sed 's|^\(.\)|\# \1|' >> "$ DEBIRF_INFO_TARGET"80 echo "$@" | sed 's|^\(.\)|\# \1|' >> "${DEBIRF_ROOT}/etc/debirf/debirf.info" 52 81 } 53 82 export -f debirf_info_comment … … 55 84 # write command to debirf.info file 56 85 debirf_info_sh() { 57 echo "$@" >> "$ DEBIRF_INFO_TARGET"86 echo "$@" >> "${DEBIRF_ROOT}/etc/debirf/debirf.info" 58 87 } 59 88 export -f debirf_info_sh
Note: See TracChangeset
for help on using the changeset viewer.

