source: hybrid/branches/releng-9.0/nanobsd/tools/package-build.inc.sh@ 10828

Last change on this file since 10828 was 10828, checked in by rick, 13 years ago

Use an seperate /tmp var disk to provide an more robust system. A full /tmp is
not and issue while an full /var could cause all kind of weird and wonderfull
magic, as PID administration if for example done at /var/run, etc...

Done by undoing the stuff to make it happen by nanobsd.sh, as their is no
direct flag to control it.

As late_customize is an hook never used, make sure it does not break our
package build sub-system.

Related-To: nodefactory:ticket:162

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 1.6 KB
Line 
1# Used to store profile data
2TIME_FILE=$(dirname $0)/eta-times.txt
3
4p_list () {
5echo "$*" | sed -e 's/ /|## /g' -e 's/^/## /g'
6}
7
8p_info () {
9 echo "$*" | tr '|' '\n' | sed 's/^/# /'
10}
11
12p_warn () {
13 echo "$*" | tr '|' '\n' | sed 's/^/#WARN: /'
14}
15
16p_err () {
17 echo "$*" | tr '|' '\n' | sed 's/^/#ERR: /'
18}
19
20p_sleep() {
21 SLEEP=${1-5}
22 while [ "${SLEEP}" -gt 0 ]; do
23 printf '.'
24 sleep 1
25 SLEEP=`expr ${SLEEP} - 1`
26 done
27 printf '\n'
28}
29
30# Print estimation on how long it normally if going to take
31f_time() {
32 COMMAND="$*"
33 ETA_TIME=` grep "${COMMAND}$" ${TIME_FILE} 2>/dev/null | awk '{print $1}'`
34 if [ -z "${ETA_TIME}" ]; then
35 ETA_TIME="NaN"
36 fi
37
38 p_info Last run of "'${COMMAND}'" took ${ETA_TIME}
39 p_info Start time: `date`
40
41 # Execute command
42 START_TIME=`date "+%s"`
43 $COMMAND
44 RETVAL=$?
45 STOP_TIME=`date "+%s"`
46
47 p_info End time: `date`
48 # Calculate time it took
49 TOTAL_TIME=`expr ${STOP_TIME} - ${START_TIME}`
50 HUMAN_FMT=`date -ur ${TOTAL_TIME} "+%H:%M:%S"`
51
52 # Store new time if command is succesfull
53 if [ "${RETVAL}" -eq 0 ]; then
54 grep -v "${COMMAND}$" ${TIME_FILE} > ${TIME_FILE}.tmp 2>/dev/null
55 echo "${HUMAN_FMT} ${COMMAND}" >> ${TIME_FILE}.tmp
56 mv ${TIME_FILE}.tmp ${TIME_FILE}
57 fi
58
59 # Return the command it's output
60 return ${RETVAL}
61}
62
63f_check_root() {
64 # No Root, no fun
65 if [ `id -u` -ne 0 ]; then
66 print_err Root only
67 exit 1
68 fi
69}
70
71# Find object directory
72BASEDIR=`dirname $0`
73
74# Load the NanoBSD Configuration entries
75NANO_CFG_FILE="${BASEDIR}/../cfg/nanobsd.wleiden"
76customize_cmd() { return; }
77late_customize_cmd() { return; }
78. $NANO_CFG_FILE
79
80OBJDIR="/usr/obj/nanobsd.${NANO_NAME}"
81
Note: See TracBrowser for help on using the repository browser.