+++ /dev/null
-#!/usr/bin/python
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-# Author: 08-2008 - Heiner Schmeling #
-###############################################################################
-
-### define variables
-HEADER='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>Beschreibung der Seite</title>
-<style type="text/css">
-* {
- font-size:14px;
- }
-
-.black{color:#000000;}
-.red{color:#ff0000;}
-.green{color:#00ff00;}
-.yellow{color:#ff0000;}
-.blue{color:#0000ff;}
-.magenta{color:#ff0000;}
-.cyan{color:#ff0000;}
-.white{color:#ffffff;}
-.ul {text-decoration:underline}
-.b {font-weight:bold}
-
-.bggray {background-color:#eeeeee;}
-
-.tal {text-align:left;}
-.tar {text-align:right;}
-.tac {text-align:center;}
-</style>
-</head>
-<body>
-<TABLE BORDER="0" cellspacing="0">
-'''
-
-FOOTER='''</TABLE>
-</body>
-</html>
-'''
-
-sESC='\x1b['
-sBEL='\x07'
-sSpace='\x20'
-lineNr = 0 # Counter for readed lines
-hg_colStr='' # define variable for Backgroundcolor
-
-### definition for lots of variable 'linelist'
-## linelist=[[pos,fgcolor,hgcolor,bold,text]]
-# pos = current Cursorposition
-# fgcolor = Vordergrund Farbe
-# hgcolor = Hintergrund Farbe
-# bold = ist Bold aktiv (0/1)
-# text = Text
-
-
-print HEADER
-
-### beginning
-while 1:
- try:
- line = raw_input() # read from standard device
- lineNr += 1 # increment linecounter
- except EOFError:
- break # break/exit is "End Of File"
-
-
- if len(line)>0 and line[-1]=='\x0d' : # evtl. vorhandenen '/r' entfernen
- line=line[:-1]
- line=line.replace(sBEL,sSpace).strip()
-
- isBoldOn = 0 # is Bold active ?
- linelist = [] # define emty list
-
- new_String = ''
- new_line_split = []
- colStr = ""
- BoldOn=""
- pos = 0
-
- line_split = line.split(sESC) # Split readed line with sESC separator
- cnt_line_split = len(line_split) # len/count of line_split
-
-### decode escape sequences
- for splitNr in range(0,cnt_line_split):
-
- lsStr = line_split[splitNr] # string of array (line split string)
-
- num_cnt = 0 # count for numbers
-
- if splitNr == 0 : # split nr 0 have not EscapeSequences
- new_String=line_split[0]
- if len(lsStr)>0:
- test_ = [pos,colStr,hg_colStr,BoldOn,lsStr]
- linelist.append(test_)
- pos +=len(lsStr)
- else:
- lsStr_len = len(lsStr) # Ueberpruefung der Teilstring-Laenge
- if lsStr_len > 5 :
- lsStr_len = 5
-
- for x1 in range(0,lsStr_len):
- found=''
- zeichen=lsStr[x1]
- if zeichen == ";" :
- if num_cnt == 1 :
- if lsStr[x1-1] == '0' and isBoldOn == 1:
- isBoldOn = 0
- BoldOn=""
- elif lsStr[x1-1] == '1' and isBoldOn == 0:
- isBoldOn = 1
- BoldOn=" b"
- else:
- print 'ERROR: BOLD nicht 0 oder 1'
- else:
- print 'ERROR: >2 Zahlen in fuer BOLD'
- num_cnt = 0 # reset count for numbers
- continue
- elif zeichen.isdigit() :
- num_cnt += 1
- continue
- elif zeichen == 'J' :
- found='J'
- break
- elif zeichen == 'H' :
- found='H'
- break
- elif zeichen == 'G' :
- found='G'
- pos = int(lsStr[x1-num_cnt:x1])
- break
- elif zeichen == 'm' :
- found='m'
- color = lsStr[x1-1]
- if color == '0' :
- colStr='white'
- elif color == '1' :
- colStr='red'
- elif color == '2' :
- colStr='green'
- elif color == '3' :
- colStr='yellow'
- elif color == '4' :
- colStr='blue'
- elif color == '5' :
- colStr='magenta'
- elif color == '6' :
- colStr='cyan'
- elif color == '7' :
- colStr='black'
- elif color == '8' :
- colStr='888'
- elif color == '9' :
- colStr='' # reset Color
- break
-
- if found <> '' :
- if colStr<>'' or BoldOn<>'' :
- new_String +='<span class="%s%s">%s</span>' % (colStr,BoldOn,lsStr[x1+1:])
- else:
- new_String +=lsStr[x1+1:]
-
- _lsStr=lsStr[x1+1:]
- if _lsStr<>'' :
- if not _lsStr.isspace() :
- test_ = [pos,colStr,hg_colStr,BoldOn,_lsStr]
- linelist.append(test_)
- pos +=len(_lsStr)
- new_line_split.append(_lsStr)
-
-### begin table <tr>
- if lineNr % 2 != 0 :
- print '<tr class="bggray">'
- else :
- print '<tr>'
-
-### first table entry 'linecounter'
- print '\t<td class="tar">%d: </td>' % (lineNr)
-
-### other table entrys
- linelist_cnt=len(linelist)
- if linelist_cnt > 0 :
-
- cnt_bracket=0 # Count string '[' for Tab's
- for cnt in range(0,linelist_cnt):
- cnt_bracket+=linelist[cnt][4].count('[')
-
- if linelist[0][4].count('*') == 3 and linelist_cnt == 5 : # Find 3 x '*'
- for cnt in range(0,13):
- if cnt == 0 : print '\t<td class="b">%s</td>' % (linelist[0][4])
- elif cnt == 2 : print '\t<td class="tac b">%s</td>' % (linelist[1][4])
- elif cnt == 5 : print '\t<td class="tac b">%s</td>' % (linelist[2][4])
- elif cnt == 8 : print '\t<td class="tac b">%s</td>' % (linelist[3][4])
- elif cnt == 11 : print '\t<td class="tac b">%s</td>' % (linelist[4][4])
- else : print '\t<td></td>'
- else :
- cnt_tabs = linelist_cnt-(cnt_bracket*3)
- for cnt in range(0,cnt_tabs) :
- if cnt == 0 :
- if linelist[cnt][1] or linelist[cnt][2] :
- print '\t<td class="'+linelist[cnt][1]+linelist[cnt][2]+'">',
- else :
- print '\t<td>',
- if linelist[cnt][3] :
- print '<b>'+linelist[cnt][4]+'</b>',
- else :
- print linelist[cnt][4],
- print '</td>'
-
- if linelist[0][0] == 0 :
- start = 1
- else :
- start = 0
- for cnt in range(start, 13-cnt_bracket*3 ) : # Fill empty tabs
- print '\t<td></td>'
-
- for cnt in range(cnt_tabs,linelist_cnt) :
- try:
- if linelist[cnt][1] or linelist[cnt][2] or linelist[cnt][3] :
- print '\t<td class="tar '+linelist[cnt][1]+linelist[cnt][2]+linelist[cnt][3]+'">',
- else :
- print '\t<td>',
- print linelist[cnt][4]+'</td>'
- except IndexError:
- print '<p class="red b">traceerror line %s in modul alog2html : <span class="blue">%s</span></p>' % (lineNr, line)
- break
-
- else :
- for cnt in range(0, 13) : # Fill empty tabs
- print '\t<td></td>'
-
-### close table </tr>
- print '</tr>'
-
-print FOOTER
+++ /dev/null
-#! /usr/bin/python
-
-import base64
-import sys
-
-print base64.b64encode(sys.stdin.read())
+++ /dev/null
-#!/usr/bin/python
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008, 2009 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-import os
-import sys
-
-from urlgrabber.grabber import URLGrabber
-
-URL="http://build.ipfire.org/rpc.py"
-
-data="&".join(sys.argv)
-
-g = URLGrabber(data=data)
-print g.urlread(URL)
+++ /dev/null
-#! /usr/bin/python
-
-"""code-saner [-d][-r][-v] [ path ... ]
-
--d (--dryrun) Dry run. Analyze, but don't make any changes to, files.
--r (--recurse) Recurse. Search for all .py files in subdirectories too.
--b (--backup) Keep backups of files.
--v (--verbose) Verbose. Print informative msgs; else no output.
--h (--help) Help. Print this usage information and exit.
-"""
-
-__version__ = "1"
-
-import tokenize
-import os
-import sys
-
-verbose = 0
-recurse = 0
-dryrun = 0
-backup = 0
-
-def usage(msg=None):
- if msg is not None:
- print >> sys.stderr, msg
- print >> sys.stderr, __doc__
-
-def errprint(*args):
- sep = ""
- for arg in args:
- sys.stderr.write(sep + str(arg))
- sep = " "
- sys.stderr.write("\n")
-
-def main():
- import getopt
- global verbose, recurse, dryrun, backup
- try:
- opts, args = getopt.getopt(sys.argv[1:], "drbvh",
- ["dryrun", "recurse", "backup" "verbose", "help"])
- except getopt.error, msg:
- usage(msg)
- return
- for o, a in opts:
- if o in ('-d', '--dryrun'):
- dryrun += 1
- elif o in ('-r', '--recurse'):
- recurse += 1
- elif o in ('-b', '--backup'):
- backup += 1
- elif o in ('-v', '--verbose'):
- verbose += 1
- elif o in ('-h', '--help'):
- usage()
- return
- if not args:
- r = Reindenter(sys.stdin)
- r.run()
- r.write(sys.stdout)
- return
- for arg in args:
- check(arg)
-
-endings = {
- 'images' : (".png", ".gif", ".jpg", ".jpeg",),
- 'styles' : (".css",),
- 'config' : (".conf", ".cnf", ".cf", ".cfg", ".config",),
- 'python' : (".py",),
- 'script' : (".pl", ".c", ".h", ".sh", ".txt",),
-}
-
-def FileObject(file):
- object = None
- try:
- f = open(file)
- except IOError, msg:
- errprint("%s: I/O Error: %s" % (file, str(msg)))
- raise
-
- # Python
- for ending in endings['python']:
- if file.endswith(ending):
- object = PythonFile(f=f, file=file)
-
- # Configs
- for ending in endings['config']:
- if file.endswith(ending):
- object = ConfigFile(f=f, file=file)
-
- # Perl
- for ending in endings['script']:
- if file.endswith(ending):
- object = ScriptFile(f=f, file=file)
-
- # Styles
- for ending in endings['styles']:
- if file.endswith(ending):
- object = StyleFile(f=f, file=file)
-
- # Images
- for ending in endings['images']:
- if file.endswith(ending):
- object = ImageFile(f=f, file=file)
-
- f.close()
- return object or UnknownFile(f=f, file=file)
-
-def check(file):
- if os.path.isdir(file) and not os.path.islink(file):
- if verbose:
- print "listing directory", file
- names = os.listdir(file)
- for name in names:
- fullname = os.path.join(file, name)
- if ((recurse and not os.path.islink(fullname))):
- check(fullname)
- return
-
- if verbose:
- print "checking", file, "...",
- try:
- r = FileObject(file)
- except IOError:
- return
-
- if r.run():
- if verbose:
- print "changed."
- if dryrun:
- print "But this is a dry run, so leaving it alone."
- if not dryrun:
- if backup:
- bak = file + ".bak"
- if os.path.exists(bak):
- os.remove(bak)
- os.rename(file, bak)
- if verbose:
- print "renamed", file, "to", bak
- f = open(file, "w")
- r.write(f)
- f.close()
- if verbose:
- print "wrote new", file
- else:
- if verbose:
- print "unchanged."
-
-def _rstrip(line, junk='\n \t'):
- """Return line stripped of trailing spaces, tabs, newlines.
-
- Note that line.rstrip() instead also strips sundry control characters,
- but at least one known Emacs user expects to keep junk like that, not
- mentioning Barry by name or anything <wink>.
- """
-
- i = len(line)
- while i > 0 and line[i-1] in junk:
- i -= 1
- return line[:i]
-
-# Count number of leading blanks.
-def getlspace(line):
- i, n = 0, len(line)
- while i < n and line[i] == " ":
- i += 1
- return i
-
-class DefaultFile:
- def __init__(self, f, file=None):
- self.file = file
-
- def run(self):
- pass
- #if verbose:
- # errprint("Can't guess filetype of given file %s" % self.file)
-
- def rm_trailing_lines(self, lines):
- # Remove trailing empty lines.
- while lines and lines[-1] == "\n":
- lines.pop()
- return lines
-
- def expand_tabs(self, lines):
- return [_rstrip(line).expandtabs() + "\n" for line in lines]
-
-class TextFile(DefaultFile):
- def __init__(self, f, file=None):
- self.file = file # Save filename.
- self.raw = f.readlines() # Raw file lines.
-
- # File lines, rstripped. Dummy at start is so
- # that we can use tokenize's 1-based line numbering easily.
- # Note that a line is all-blank iff it's "\n".
- self.lines = [_rstrip(line) + "\n" for line in self.raw]
-
- def run(self):
- self.after = self.lines
- return self.raw != self.after
-
- def write(self, f):
- f.writelines(self.after)
-
-class PythonFile(TextFile):
- def __init__(self, f, file=None):
- TextFile.__init__(self, f, file)
- self.find_stmt = 1 # next token begins a fresh stmt?
- self.level = 0 # current indent level
-
- self.lines = self.expand_tabs(self.lines)
- self.lines.insert(0, None)
- self.index = 1 # index into self.lines of next line
-
- # List of (lineno, indentlevel) pairs, one for each stmt and
- # comment line. indentlevel is -1 for comment lines, as a
- # signal that tokenize doesn't know what to do about them;
- # indeed, they're our headache!
- self.stats = []
-
- def run(self):
- tokenize.tokenize(self.getline, self.tokeneater)
- # Remove trailing empty lines.
- lines = self.rm_trailing_lines(self.lines)
- # Sentinel.
- stats = self.stats
- stats.append((len(lines), 0))
- # Map count of leading spaces to # we want.
- have2want = {}
- # Program after transformation.
- after = self.after = []
- # Copy over initial empty lines -- there's nothing to do until
- # we see a line with *something* on it.
- i = stats[0][0]
- after.extend(lines[1:i])
- for i in range(len(stats)-1):
- thisstmt, thislevel = stats[i]
- nextstmt = stats[i+1][0]
- have = getlspace(lines[thisstmt])
- want = thislevel * 4
- if want < 0:
- # A comment line.
- if have:
- # An indented comment line. If we saw the same
- # indentation before, reuse what it most recently
- # mapped to.
- want = have2want.get(have, -1)
- if want < 0:
- # Then it probably belongs to the next real stmt.
- for j in xrange(i+1, len(stats)-1):
- jline, jlevel = stats[j]
- if jlevel >= 0:
- if have == getlspace(lines[jline]):
- want = jlevel * 4
- break
- if want < 0: # Maybe it's a hanging
- # comment like this one,
- # in which case we should shift it like its base
- # line got shifted.
- for j in xrange(i-1, -1, -1):
- jline, jlevel = stats[j]
- if jlevel >= 0:
- want = have + getlspace(after[jline-1]) - \
- getlspace(lines[jline])
- break
- if want < 0:
- # Still no luck -- leave it alone.
- want = have
- else:
- want = 0
- assert want >= 0
- have2want[have] = want
- diff = want - have
- if diff == 0 or have == 0:
- after.extend(lines[thisstmt:nextstmt])
- else:
- for line in lines[thisstmt:nextstmt]:
- if diff > 0:
- if line == "\n":
- after.append(line)
- else:
- after.append(" " * diff + line)
- else:
- remove = min(getlspace(line), -diff)
- after.append(line[remove:])
- return self.raw != self.after
-
- # Line-getter for tokenize.
- def getline(self):
- if self.index >= len(self.lines):
- line = ""
- else:
- line = self.lines[self.index]
- self.index += 1
- return line
-
- # Line-eater for tokenize.
- def tokeneater(self, type, token, (sline, scol), end, line,
- INDENT=tokenize.INDENT,
- DEDENT=tokenize.DEDENT,
- NEWLINE=tokenize.NEWLINE,
- COMMENT=tokenize.COMMENT,
- NL=tokenize.NL):
-
- if type == NEWLINE:
- # A program statement, or ENDMARKER, will eventually follow,
- # after some (possibly empty) run of tokens of the form
- # (NL | COMMENT)* (INDENT | DEDENT+)?
- self.find_stmt = 1
-
- elif type == INDENT:
- self.find_stmt = 1
- self.level += 1
-
- elif type == DEDENT:
- self.find_stmt = 1
- self.level -= 1
-
- elif type == COMMENT:
- if self.find_stmt:
- self.stats.append((sline, -1))
- # but we're still looking for a new stmt, so leave
- # find_stmt alone
-
- elif type == NL:
- pass
-
- elif self.find_stmt:
- # This is the first "real token" following a NEWLINE, so it
- # must be the first token of the next program statement, or an
- # ENDMARKER.
- self.find_stmt = 0
- if line: # not endmarker
- self.stats.append((sline, self.level))
-
-UnknownFile = ImageFile = DefaultFile # just the empty file object, do nothing
-ConfigFile = ScriptFile = StyleFile = TextFile # simple textfiles
-
-if __name__ == '__main__':
- main()
+++ /dev/null
-
-
-BASEDIR=/ipfire-3.x
-
-DEBUG=1 ## XXX currently always on
-
-DISTRO_NAME=IPFire
-DISTRO_SNAME=ipfire
-DISTRO_EPOCH=3
-DISTRO_VERSION=${DISTRO_EPOCH}.0-prealpha2
-DISTRO_SLOGAN="Gluttony"
-
-# Machine's infotmation
-HOSTNAME=$(</proc/sys/kernel/hostname)
-MACHINE=$(uname -m)
-
-NAOKI=${BASEDIR}/tools/naoki
-DOWNLOADER=${BASEDIR}/tools/downloader
-
-DIR_CACHE=${BASEDIR}/cache
-DIR_LOGS=${BASEDIR}/logs
-DIR_PACKAGES=${BASEDIR}/build/packages
-DIR_PACKAGES_TOOLCHAIN=${DIR_PACKAGES}_toolchain
-DIR_PATCHES=${DIR_CACHE}/patches
-DIR_PKGS=${BASEDIR}/pkgs
-DIR_TARBALLS=${DIR_CACHE}/tarballs
-
-PACKAGES_CACHE=${DIR_CACHE}/.naoki.packages
-[ -e "${PACKAGES_CACHE}" ] || touch ${PACKAGES_CACHE}
+++ /dev/null
-#!/bin/bash
-
-if [ -z "${BASEDIR}" ]; then
- echo "${0##*/}: ERROR: BASEDIR is not set." >&2
- exit 1
-fi
-
-. ${BASEDIR}/tools/common-constants
-. ${BASEDIR}/tools/common-package-functions
-. ${BASEDIR}/tools/common-ui-functions
-
-# Read in .config
-if [ -e "${BASEDIR}/.config" ]; then
- log DEBUG "Loading .config..."
- source ${BASEDIR}/.config
-fi
+++ /dev/null
-#!/bin/bash
-
-function listmatch() {
- local arg=${1}
- shift
-
- grep -q "<${arg}>" <<<$@
-}
-
-function listremove() {
- local arg=${1}
- shift
-
- local value
- for value in $@; do
- if [ "${arg}" != "${value}" ]; then
- echo "${value}"
- fi
- done | tr "\n" " "
-}
-
-function listsort() {
- local value
- for value in $@; do
- echo "${value}"
- done | sort -u | tr "\n" " "
-}
-
-function is_package() {
- local package=${1}
-
- if [ -e "${DIR_PKGS}/${package}/${package##*/}.nm" ]; then
- return 0
- else
- log ERROR "Package ${package} is not known."
- return 1
- fi
-}
-
-function find_package() {
- local package=${1}
- local i
-
- #log DEBUG "Searching for package \"${package}\"."
-
- if [ -e "${DIR_PKGS}/${package}" ]; then
- echo "${package}"
- return 0
- fi
-
- for i in $(package_list); do
- if [ "${i##*/}" = "${package}" ]; then
- echo "${i}"
- return 0
- fi
- done
- return 1
-}
-
-function find_packages() {
- local p
- for p in $@; do
- find_package ${p}
- done | tr "\n" " "
-}
-
-function package_repos() {
- local repo
-
- for repo in ${DIR_PKGS}/*; do
- if [ ! -d "${repo}" ]; then
- continue
- fi
-
- if [ "${TOOLCHAIN}" = "1" ]; then
- if [ "${repo##*/}" != "toolchain" ]; then
- continue
- fi
- else
- if [ "${repo##*/}" = "toolchain" ]; then
- continue
- fi
- fi
- echo "${repo##*/}"
- done
-}
-
-## Needs to be cached...
-# Causes massive speed impact
-function __package_list() {
- local package
- local repo
-
- for repo in $(package_repos); do
- for package in ${DIR_PKGS}/${repo}/*; do
- if [ ! -d "${package}" ]; then
- continue
- fi
-
- package=${package#${DIR_PKGS}/}
-
- # Skip if package does not fullfill our criteria
- is_package ${package} || continue
-
- echo "${package}"
- done
- done
-}
-
-function package_list() {
- if [ -z "${__PACKAGE_LIST}" ]; then
- log CACHE "Building packages_list."
- export __PACKAGE_LIST=$(__package_list)
- fi
-
- echo "${__PACKAGE_LIST}"
-}
-
-function package_profile() {
- if [ "${1}" = "--wiki" ]; then
- echo "TODO: WIKI OUTPUT"
- else
- # XXX to be formatted
- local package_name=${1}
- printf "# ${BOLD}%-12s${NORMAL}: ${CLR_BOLD_GRN}%s${NORMAL}\n" "Name" "${package_name}"
- printf "# ${BOLD}%-12s${NORMAL}: %s\n" "Version" "$(package_version ${package_name})"
- printf "# ${BOLD}%-12s${NORMAL}: %s\n" "Release" "$(package_release ${package_name})"
- printf "# ${BOLD}%-12s${NORMAL}: %s\n" "Group" "$(package_group ${package_name})"
- echo "#"
- format $(package_summary ${package_name})
- echo "#"
- echo -e "# ${BOLD}Description${NORMAL} :"
- format $(package_description ${package_name})
- echo "#"
- printf "# ${BOLD}%-12s${NORMAL}: %s\n" "Maintainer" "$(package_maintainer ${package_name})"
- printf "# ${BOLD}%-12s${NORMAL}: %s\n" "License" "$(package_license ${package_name})"
- echo "#"
- fi
-}
-
-function package_info() {
- local p=${1}
-
- log DEBUG "Fetching package information from ${DIR_PKGS}/${p}..."
-
- is_package ${p} || return 1
-
- if [ "${NAOKI_INCLUDE}" = "1" ]; then
- CHROOT=0 naoki_make ${p} --without-chroot info
- else
- ${NAOKI} info ${p}
- fi
-}
-
-function package_cache_update() {
- local p=${1}
-
- local fingerprint=$(__package_cache_get "${p}" "FINGERPRINT")
- if [ -n "${fingerprint}" ]; then
- if [ "$(package_fingerprint ${p})" = "${fingerprint}" ]; then
- return
- fi
- fi
-
- log DEBUG "Cache information of ${p} needs update."
-
- local line object data
-
- local cache_data=$(<${PACKAGES_CACHE})
- grep -v "^${1}.${2}" <<<"${cache_data}" > ${PACKAGES_CACHE}
-
- package_info ${p} | \
- while read line; do
- object=${line%%=*}
- data=${line##*=}
-
- __package_cache_set "${p}" "${object}" "$(tr -d '"' <<<${data})"
- done
- __package_cache_set "${p}" "FINGERPRINT" "$(package_fingerprint ${p})"
-}
-
-function __package_cache_set() {
- echo -e "${1}\t${2}\t${3}" >> ${PACKAGES_CACHE}
-}
-
-function __package_cache_get() {
- grep -e "^${1}.${2}" ${PACKAGES_CACHE} | cut -c $(( ${#1} + ${#2} + 3 ))-
-}
-
-function package_get() {
- local p=${1}
-
- # Check if cache data is up2date
- package_cache_update ${p}
-
- __package_cache_get "${p}" "${2}"
-}
-
-
-function package_name() {
- package_get ${1} PKG_NAME
-}
-
-function package_version() {
- package_get ${1} PKG_VER
-}
-
-function package_release() {
- package_get ${1} PKG_REL
-}
-
-function package_description() {
- package_get ${1} PKG_DESCRIPTION
-}
-
-function package_summary() {
- package_get ${1} PKG_SUMMARY
-}
-
-function __deps() {
- local info=${1}
- local recursive=${2}
- local package=${3}
-
- local deps=$(find_packages $(package_get ${package} ${info}))
-
- if [ "${recursive}" = "1" ]; then
- local dep
- local size
- while true; do
- size=${#deps}
-
- for dep in ${deps}; do
- deps="${deps} $(package_get ${dep} ${info}) $(package_runtime_dependencies ${dep})"
- done
-
- deps=$(listsort ${deps})
-
- [ ${#deps} -eq ${size} ] && break
- done
- fi
- echo $(listsort ${deps})
-}
-
-function package_runtime_dependencies() {
- __deps PKG_DEPENDENCIES 0 $@
-}
-
-function package_runtime_dependencies_recursive() {
- __deps PKG_DEPENDENCIES 1 $@
-}
-
-function package_build_dependencies() {
- __deps PKG_BUILD_DEPENDENCIES 0 $@
-}
-
-function package_build_dependencies_recursive() {
- __deps PKG_BUILD_DEPENDENCIES 1 $@
-}
-
-function package_toolchain_dependencies() {
- __deps PKG_TOOLCHAIN_DEPENDENCIES 0 $@
-}
-
-function package_toolchain_dependencies_recursive() {
- __deps PKG_TOOLCHAIN_DEPENDENCIES 1 $@
-}
-
-function package_dependencies() {
- if [ "${TOOLCHAIN}" = "1" ]; then
- package_toolchain_dependencies $@
- else
- package_runtime_dependencies $@
- package_build_dependencies $@
- fi
-}
-
-function package_dependencies_recursive() {
- if [ "${TOOLCHAIN}" = "1" ]; then
- package_toolchain_dependencies_recursive $@
- else
- listsort $(package_runtime_dependencies_recursive $@) \
- $(package_build_dependencies_recursive $@)
- fi
-}
-
-function package_packages() {
- package_get ${1} PKG_PACKAGES_FILES
-}
-
-function package_maintainer() {
- package_get ${1} PKG_MAINTAINER
-}
-
-function package_group() {
- package_get ${1} PKG_GROUP
-}
-
-function package_license() {
- package_get ${1} PKG_LICENSE
-}
-
-function package_objects() {
- package_get ${1} PKG_OBJECTS
-}
-
-function package_is_built() {
- local package=${1}
-
- local file
- for file in $(package_packages ${package}); do
- if [ ! -e "${DIR_PACKAGES}/${file}" ]; then
- return 1
- fi
- done
- return 0
-}
-
-function package_sort() {
- local pkg
- for pkg in $@; do
- echo "${pkg}"
- done | sort -u | tr '\n' ' '
-}
-
-function __random() {
- local date=$(date "+%N")
- while [ "${date:0:1}" = "0" ]; do
- if [ "${#date}" = "0" ]; then
- echo "0"
- return
- fi
- date=${date:1}
- done
- echo $(( ${date} % 2 ))
-}
-
-function package_random() {
- local package
- local ret
-
- for package in $@; do
- if [ "$(__random)" = "0" ]; then
- ret="${ret} ${package}"
- else
- ret="${package} ${ret}"
- fi
- done
- if [ "$(__random)" = "0" ]; then
- ret=$(package_random ${ret})
- fi
- echo ${ret}
-}
-
-function package_tree() {
- local package
- local package2
- local packages
- local deps
-
- log INFO "Making package tree..."
-
- ret[0]=$@
- local i=0
- while true; do
- packages=${ret[i]}
- deps=
- for package in ${packages}; do
- deps="${deps} $(package_dependencies ${package})"
- done
- deps=$(package_sort ${deps})
- if [ -n "${deps}" ]; then
- ret[$(( ${i} + 1 ))]=${deps}
- else
- break
- fi
- i=$(( ${i} + 1 ))
- done
-
- local drop
- local j
- i=0
- while [ ${i} -lt ${#ret[@]} ]; do
- for package in ${ret[i]}; do
- drop=0
- j=$(( ${#ret[@]} - 1 ))
- while [ ${j} -gt ${i} ]; do
- for package2 in ${ret[j]}; do
- if [ "${package}" == "${package2}" ]; then
- drop=1
- break
- fi
- done
- if [ "${drop}" = "1" ]; then
- break
- fi
- j=$(( ${j} - 1 ))
- done
- if [ "${drop}" = "1" ]; then
- packages=
- for package2 in ${ret[i]}; do
- if [ "${package}" != "${package2}" ]; then
- packages="${packages} ${package2}"
- fi
- done
- ret[${i}]=$(listsort ${packages})
- fi
- done
- i=$(( ${i} + 1 ))
- done
-
- i=$(( ${#ret[@]} - 1 ))
- while [ ${i} -ge 0 ]; do
- log INFO " ${i}: ${ret[i]}"
- echo "$(package_random ${ret[i]})"
- i=$(( ${i} - 1 ))
- done
-}
-
-function require_toolchain() {
- local package
- for package in ${PACKAGES_TO_EXTRACT}; do
- package=${package}
- if ! package_is_built ${package}; then
- return 0
- fi
- done
- return 1
-}
-
-function package_id() {
- local p=${1}
- local hash=$(sha1sum <<<${p})
-
- echo ${hash:0:6}
-}
-
-function package_decompress() {
- local file
- local pkg
- for pkg in $@; do
- if ! package_is_built ${pkg}; then
- log WARNING "Cannot extract package \"${pkg}\". It has not been built, yet."
- continue
- fi
- for file in $(package_packages ${pkg}); do
- PATH=${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin:${PATH} \
- ${BASEDIR}/src/pakfire/decompressor --root=${BUILD_DIR} \
- ${DIR_PACKAGES}/${file}
- done
- done
-}
-
-function package_mandatory() {
- local package
- local packages=$(find_packages ${PACKAGES_MANDATORY})
-
- for package in ${packages}; do
- if ! package_is_built ${package}; then
- log DEBUG "Mandatory package \"${package}\" has not been built, yet."
- continue
- fi
- echo "${package} $(package_runtime_dependencies_recursive ${package})"
- done
-}
-
-function package_download() {
- local package=${1}
-
- local object
- local to_download
- for object in $(package_objects ${package}); do
- if [ -e "${DIR_TARBALLS}/${object}" ] || \
- [ -e "${DIR_PATCHES}/${object}" ]; then
- continue
- fi
- to_download="${to_download} ${object}"
- done
- if [ -n "${to_download}" ]; then
- log DEBUG "Going to get file(s): ${to_download}"
- ${DOWNLOADER} --tarballs="${DIR_TARBALLS}" \
- --patches="${DIR_PATCHES}" ${to_download}
- if [ "$?" != "0" ]; then
- return 1
- fi
- fi
-}
-
-function package_fingerprint() {
- local p=${1}
- # time of modification in seconds since Epoch
- stat --printf="%Y" ${DIR_PKGS}/${p}/${p##*/}.nm
-}
+++ /dev/null
-#!/bin/bash
-
-## Screen Dimentions
-# Find current screen size
-if [ -z "${COLUMNS}" ]; then
- COLUMNS=$(stty size 2>/dev/null)
- COLUMNS=${COLUMNS##* }
-fi
-
-# When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then
- COLUMNS=80
-fi
-
-## Set Cursur Position Commands, used via echo -e
-SET_RESULT_COL="\\033[${RESULT_COL}G"
-SET_TIME_COL="\\033[${TIME_COL}G"
-SET_VER_COL="\\033[${VER_COL}G"
-SET_OPT_COL="\\033[${OPT_COL}G"
-
-# Normal colors
-CLR_NORM_BLK="\\033[0;30m" # black
-CLR_NORM_RED="\\033[0;31m" # red
-CLR_NORM_GRN="\\033[0;32m" # green
-CLR_NORM_YEL="\\033[0;33m" # yellow
-CLR_NORM_BLU="\\033[0;34m" # blue
-CLR_NORM_MAG="\\033[0;35m" # magenta
-CLR_NORM_CYN="\\033[0;36m" # cyan
-CLR_NORM_WHT="\\033[0;37m" # white
-CLR_NORM_GRY="\\033[0;39m" # grey
-
-# Emphased colors
-CLR_BOLD_BLK="\\033[1;30m" # black
-CLR_BOLD_RED="\\033[1;31m" # red
-CLR_BOLD_GRN="\\033[1;32m" # green
-CLR_BOLD_YEL="\\033[1;33m" # yellow
-CLR_BOLD_BLU="\\033[1;34m" # blue
-CLR_BOLD_MAG="\\033[1;35m" # magenta
-CLR_BOLD_CYN="\\033[1;36m" # cyan
-CLR_BOLD_WHT="\\033[1;37m" # white
-CLR_BOLD_GRY="\\033[1;39m" # grey
-
-# Background colors
-CLR_BACK_BLK="\\033[40m" # black
-CLR_BACK_RED="\\033[41m" # red
-CLR_BACK_GRN="\\033[42m" # green
-CLR_BACK_YEL="\\033[43m" # yellow
-CLR_BACK_BLU="\\033[44m" # blue
-CLR_BACK_MAG="\\033[45m" # magenta
-CLR_BACK_CYN="\\033[46m" # cyan
-CLR_BACK_WHT="\\033[47m" # white
-
-# Action colors
-BOLD=$CLR_BOLD_GRY
-DONE=$CLR_BOLD_GRN
-SKIP=$CLR_BOLD_BLU
-WARN=$CLR_BOLD_YEL
-FAIL=$CLR_BOLD_RED
-NORMAL=$CLR_NORM_GRY
-ERROR=$CLR_BOLD_RED
-
-# Color hooks
-BRACKET_L="${CLR_BOLD_BLU}[${NORMAL}"
-BRACKET_R="${CLR_BOLD_BLU}]${NORMAL}"
-
-function log() {
- if [ -z "${LOGFILE}" ]; then
- return 0
- fi
-
- local facility=${1}
- shift
-
- if [ "${facility}" == "DEBUG" -a "${DEBUG}" != "1" ]; then
- return 0
- fi
-
- printf "%s naoki[%5d] %8s %s\n" "$(date -u)" "$$" "${facility}" "$@" >> ${LOGFILE}
-}
-
-function msg() {
- log MESSAGE "$@"
- echo -e "$@"
-}
-
-function error() {
- log ERROR "$@"
- echo -e "${ERROR}ERROR${NORMAL} : $@" >&2
-}
-
-function warning() {
- log WARNING "$@"
- echo -e "${WARN}WARNING${NORMAL}: $@" >&2
-}
-
-function exiterror() {
- ERROR=1
- error $@
-}
-
-function format() {
- local max_length=50
- local line="# "
- local length=0
-
- for word in $@; do
- length=$(expr ${length} + ${#word})
- if [ "${length}" -ge "${max_length}" ]; then
- printf "${line}\n"
- line="# ${word} "
- length=${#word}
- else
- line="${line}${word} "
- fi
- #echo "-- ($word) $LINE"
- done
- printf "${line}\n"
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-# #
-# This is a very simple script for downloading our files from the server. #
-# It is keep that simple because we plan to rewrite this anytime or move #
-# away from wget. #
-# #
-###############################################################################
-
-URL="http://source.ipfire.org/source-3.x"
-
-objects=
-
-while [ $# -gt 0 ]; do
- case "${1}" in
- --tarballs=*)
- DIR_TARBALLS=${1#--tarballs=}
- ;;
- --patches=*)
- DIR_PATCHES=${1#--patches=}
- ;;
- *)
- objects="${objects} ${1}"
- ;;
- esac
- shift
-done
-
-for object in ${objects}; do
- echo object: $object
- target=
- if [[ ${object} =~ .patch$ ]]; then
- target="${DIR_PATCHES}/${object}"
- else
- target="${DIR_TARBALLS}/${object}"
- fi
-
- wget ${URL}/${object} -O ${target}
-done
--- /dev/null
+#!/bin/bash
+
+export PATH=${PATH}:/tools_i686/bin
+
+if [ -z "${1}" ]; then
+ exit 1
+fi
+
+cpio --extract --to-stdout data.img <${1} | xzcat | \
+ tar tvv
+
+cpio --extract --to-stdout info < ${1}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-BATCHLOG=$BASEDIR/log_${TARGET}/_build.00-batch.log
-
-###############################################################################
-# Starts the batch process in the background #
-###############################################################################
-batch_start() {
- [ "$1" = "--clean" ] && TARGET=$TARGET $0 clean
-
- screen -dmS ipfire $0 batch _run
-}
-
-###############################################################################
-# Run this to check what is going on in the moment #
-###############################################################################
-batch_attach() {
- screen -x ipfire
- if [ "$?" -eq "0" ]; then
- beautify message DONE
- else
- beautify message FAIL
- fi
-}
-
-###############################################################################
-# This is the main batch function that runs one thing after an other #
-###############################################################################
-batch_run() {
- gettoolchain
- local DURATION=$(date "+%s")
- $0 build &> $BATCHLOG
- DURATION=$(( $(date "+%s") - ${DURATION} ))
- sleep 30
- if [ -e "$FAILED" ]; then
- batch_mail "Build failed :("
- else
- DURATION=${DURATION} puttarget
- fi
-}
-
-###############################################################################
-# A function to send an email to the developers #
-###############################################################################
-batch_mail() {
- MAIL_SUBJECT="[${HOSTNAME}] - ${1}"
-
- for i in MAIL_SERVER MAIL_TO MAIL_FROM MAIL_USER MAIL_PASS MAIL_SUBJECT; do
- [ -n "${!i}" ] && export ${i}="${!i}"
- done
-
- ## Send the email
- tools/alog2html < $BATCHLOG 2>&1 | tools/sendEmail
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-###############################################################################
-#
-# Beautifying variables & presentation & input output interface
-#
-###############################################################################
-
-## Screen Dimentions
-# Find current screen size
-if [ -z "${COLUMNS}" ]; then
- COLUMNS=$(stty size 2>/dev/null)
- COLUMNS=${COLUMNS##* }
-fi
-
-# When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then
- COLUMNS=80
-fi
-
-## Measurements for positioning result messages
-RESULT_WIDTH=4
-TIME_WIDTH=8
-OPT_WIDTH=7
-VER_WIDTH=10
-RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
-TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
-VER_COL=$((${TIME_COL} - $VER_WIDTH - 5))
-OPT_COL=$((${VER_COL} - $OPT_WIDTH - 5))
-
-## Set Cursur Position Commands, used via echo -e
-SET_RESULT_COL="\\033[${RESULT_COL}G"
-SET_TIME_COL="\\033[${TIME_COL}G"
-SET_VER_COL="\\033[${VER_COL}G"
-SET_OPT_COL="\\033[${OPT_COL}G"
-
-# Normal colors
-CLR_NORM_BLK="\\033[0;30m" # black
-CLR_NORM_RED="\\033[0;31m" # red
-CLR_NORM_GRN="\\033[0;32m" # green
-CLR_NORM_YEL="\\033[0;33m" # yellow
-CLR_NORM_BLU="\\033[0;34m" # blue
-CLR_NORM_MAG="\\033[0;35m" # magenta
-CLR_NORM_CYN="\\033[0;36m" # cyan
-CLR_NORM_WHT="\\033[0;37m" # white
-CLR_NORM_GRY="\\033[0;39m" # grey
-
-# Emphased colors
-CLR_BOLD_BLK="\\033[1;30m" # black
-CLR_BOLD_RED="\\033[1;31m" # red
-CLR_BOLD_GRN="\\033[1;32m" # green
-CLR_BOLD_YEL="\\033[1;33m" # yellow
-CLR_BOLD_BLU="\\033[1;34m" # blue
-CLR_BOLD_MAG="\\033[1;35m" # magenta
-CLR_BOLD_CYN="\\033[1;36m" # cyan
-CLR_BOLD_WHT="\\033[1;37m" # white
-CLR_BOLD_GRY="\\033[1;39m" # grey
-
-# Background colors
-CLR_BACK_BLK="\\033[40m" # black
-CLR_BACK_RED="\\033[41m" # red
-CLR_BACK_GRN="\\033[42m" # green
-CLR_BACK_YEL="\\033[43m" # yellow
-CLR_BACK_BLU="\\033[44m" # blue
-CLR_BACK_MAG="\\033[45m" # magenta
-CLR_BACK_CYN="\\033[46m" # cyan
-CLR_BACK_WHT="\\033[47m" # white
-
-# Action colors
-BOLD=$CLR_BOLD_GRY
-DONE=$CLR_BOLD_GRN
-SKIP=$CLR_BOLD_BLU
-WARN=$CLR_BOLD_MAG
-FAIL=$CLR_BOLD_RED
-NORMAL=$CLR_NORM_GRY
-
-# Color hooks
-BRACKET_L="${CLR_BOLD_BLU}[${NORMAL}"
-BRACKET_R="${CLR_BOLD_BLU}]${NORMAL}"
-
-position_cursor() {
- # ARG1=starting position on screen
- # ARG2=string to be printed
- # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
- # For example if your starting position is column 50 and you want to print Hello three columns to the right
- # of your starting position, your call will look like this:
- # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
- # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
- # your call will look like this:
- # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
- # If you want to start printing at the exact starting location, use offset 0
-
- START=$1
- STRING=$2
- OFFSET=$3
-
- STRING_LENGTH=${#STRING}
-
- if [ ${OFFSET} -lt 0 ]; then
- COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
- else
- COL=$((${START} + ${OFFSET}))
- fi
-
- SET_COL="\\033[${COL}G"
-
- echo $SET_COL
-} # End of position_cursor()
-
-beautify() {
- # Commands: build_stage, make_pkg, message, result
- case "$1" in
- message)
- MESSAGE="$3"
- echo -ne "${BOLD}${MESSAGE}${NORMAL}${SET_RESULT_COL}${BRACKET_L}"
- case "$2" in
- DONE) echo -ne " ${DONE}DONE${NORMAL} ";;
- WARN) echo -ne " ${WARN}WARN${NORMAL} ";;
- FAIL) echo -ne " ${FAIL}FAIL${NORMAL} ";;
- SKIP) echo -ne " ${SKIP}SKIP${NORMAL} ";;
- ON|ENAB*) echo -ne " ${DONE}ENAB${NORMAL} ";;
- OFF|DISA*) echo -ne " ${FAIL}DISA${NORMAL} ";;
- esac
- echo -ne "${BRACKET_R}\n"
- ;;
- build_stage)
- MESSAGE=$2
- echo -ne "${BOLD}*** ${MESSAGE}${SET_OPT_COL} options${SET_VER_COL} version "
- echo -ne "${SET_TIME_COL} time ${SET_RESULT_COL} status${NORMAL}\n"
- ;;
- package)
- local PKG_NAME=$2
- local PKG_VER=$(shrink_string $VER_WIDTH $3)
- local OPTIONS=$4
-
- SET_VER_COL_REAL=`position_cursor $TIME_COL "$PKG_VER" -3`
-
- echo -ne "${PKG_NAME}"
- if ! [ "$OPTIONS" == "" ]; then
- echo -ne "${SET_OPT_COL}${BRACKET_L} ${BOLD}${OPTIONS}${NORMAL} ${BRACKET_R}"
- fi
-
- if [ -z "${PKG_VER}" ]; then
- echo -ne "${SET_RESULT_COL}"
- else
- echo -ne "${SET_VER_COL}${BRACKET_L} ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
- echo -ne "${NORMAL} ${BRACKET_R}${SET_RESULT_COL}"
- fi
- ;;
- result)
- RESULT=$2
-
- if [ ! $3 ]; then
- PKG_TIME=0
- else
- PKG_TIME=$3
- fi
-
- # If time is lager than one minute display it like this: <minutes>:<seconds>, e.g. 1:16
- [ $PKG_TIME -ge 60 ] && PKG_TIME=$(printf "%d:%02d" $[ $PKG_TIME / 60 ] $[ $PKG_TIME % 60 ])
-
- SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
- echo -ne "${SET_TIME_COL}${BRACKET_L} ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ${BRACKET_R}"
- case "$RESULT" in
- DONE) echo -ne "${SET_RESULT_COL}${BRACKET_L} ${DONE}DONE${NORMAL} ${BRACKET_R}\n";;
- FAIL) echo -ne "${SET_RESULT_COL}${BRACKET_L} ${FAIL}FAIL${NORMAL} ${BRACKET_R}\n";;
- SKIP) echo -ne "${SET_RESULT_COL}${BRACKET_L} ${SKIP}SKIP${NORMAL} ${BRACKET_R}\n";;
- esac
- ;;
- esac
-} # End of beautify()
-
-function shrink_string() {
- local LENGTH=$1
- shift
- local STRING=$@
-
- if [ ${#STRING} -gt $LENGTH ]; then
- # If a string is greater than $LENGTH, we keep the first 4 characters
- # and replace enough characters to fit the resulting string on the screen. We'll replace
- # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
- # Example: if we have a 21-long string that we want to fit into a 10-long space,
- # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
- # end up with a 12-character long string. That's why we replace 12 characters with ..
- REMOVE=$(expr substr "$STRING" 4 $[ ${#STRING} - $LENGTH + 2 ])
- STRING=$(echo ${STRING/$REMOVE/..})
- fi
-
- echo "$STRING"
-} # End of shrink_string()
-
-dialogerror() {
- beautify message FAIL >&2
-
- echo -ne "${FAIL}ERROR${NORMAL}: ${BOLD}$*${NORMAL}\n" >&2
- [ -z "$LOGFILE" ] || \
- echo " Check $LOGFILE for errors if applicable" >&2
-} # End of dialogerror()
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-BUILD_SPY_FILENAME=$BASEDIR/.build_spy
-BUILD_SPY_PID=$BUILD_SPY_FILENAME.pid
-
-build_spy() {
- local COMMAND
- COMMAND=$1
- shift 1
- if [ "$COMMAND" = "start" ]; then
- BASEDIR=$BASEDIR UUID=$UUID NAME=$NAME VERSION=$VERSION \
- LOGFILE="$BASEDIR/log_${TARGET}/_build.00-buildspy.log" \
- $BASEDIR/tools/make-buildspy &
- elif [ "$COMMAND" = "exit" ]; then
- sleep 11 && echo -n "BUILDSPY_EXIT " >> $BUILD_SPY_FILENAME &
- else
- echo -n "${COMMAND}=$* " >> $BUILD_SPY_FILENAME
- fi
-}
-
-build_spy_send_profile() {
- build_spy target ${TARGET}
- build_spy hostname ${HOSTNAME}
- build_spy jobs ${DISTCC_JOBS}
- build_spy cpu $(grep ^model\ name /proc/cpuinfo | head -n1 | \
- awk -F: '{ print $2 }' | $BASEDIR/tools/base64)
- build_spy machine $(uname -m)
- build_spy toolchain "${NAME}-${TOOLCHAINVERSION}"
- for i in /etc/{system,fedora,redhat,$SNAME,debian,ubuntu,lsb}-release /etc/debian_version; do
- if [ -e "${i}" ]; then
- SYSTEM_STRING=$(cat ${i} 2>/dev/null)
- grep -q "debian" <<<${i} && SYSTEM_STRING="Debian $SYSTEM_STRING"
- build_spy system "$($BASEDIR/tools/base64 <<<$SYSTEM_STRING)"
- break
- fi
- done
- build_spy rev ${GIT_REV}
-}
-
-if [ "$(basename $0)" == "make-buildspy" ]; then
- if [ -f "$BUILD_SPY_PID" ]; then
- exit 0
- fi
- echo $$ > $BUILD_SPY_PID
-
- while true; do
- DATA+=$(cat $BUILD_SPY_FILENAME 2>/dev/null || true)
- > $BUILD_SPY_FILENAME
-
- for command in $DATA; do
- if [ "$command" = "BUILDSPY_EXIT" ]; then
- BUILDSPY_EXIT=1
- break
- fi
- done
-
- if [ -n "$DATA" ] && \
- $BASEDIR/tools/buildspy \
- action=set uuid=$UUID $DATA >> $LOGFILE 2>&1; then
- DATA=""
- fi
-
- if [ "$BUILDSPY_EXIT" = "1" ]; then
- break
- fi
-
- sleep 10
- done
- rm -f $BUILD_SPY_FILENAME $BUILD_SPY_PID
-fi
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-check_common() {
- local NAME=$1
- if [ -n "$3" ]; then
- local RVER=$2
- local COMMAND=$3
- else
- local COMMAND=$2
- fi
-
- local EXTRA=$4
-
- RANDOM=$$
- TMPFILE=/tmp/ipfire-check-$RANDOM
-
- echo -ne "${BOLD}Checking for $NAME${NORMAL}"
-
- [ -n "$RVER" ] && echo -n " (Requires at least $RVER)"
-
- bash -c "$COMMAND" >$TMPFILE 2>&1
-
- if ! grep -q "command not found" < $TMPFILE; then
- beautify message DONE
- else
- rm -f $TMPFILE 2>/dev/null
- exiterror "$NAME not found!"
- fi
-
- [ -n "$EXTRA" ] && echo -n "$EXTRA"
-
- cat $TMPFILE
- rm -f $TMPFILE 2>/dev/null
- echo # Empty line
-}
-
-check_toolchain() {
- check_common "GNU autoconf" "2.63" "autoconf --version | head -n1"
- check_common "GNU Bash" "2.05a" "bash --version | head -n1 | cut -d\" \" -f2-4"
- check_common "/bin/sh links bash?" "if ! which sh; then echo \"command not found\"; fi"
- check_common "GNU Binutils" "2.12" "ld --version | head -n1 | cut -d\" \" -f3-" "Binutils: "
- check_common "GNU Bison" "1.875" "bison --version | head -n1"
- #check_common "/usr/bin/yacc links bison?" "if ! which yacc; then echo \"command not found\"; fi"
- check_common "Bzip2" "1.0.2" "bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d\" \" -f1,6-"
- check_common "Diffutils" "2.8" "diff --version | head -n1"
- check_common "Findutils" "4.1.20" "find --version | head -n1"
- check_common "GNU awk" "3.0" "gawk --version | head -n1"
- check_common "/bin/awk links gawk?" "if ! which awk; then echo \"command not found\"; fi"
- check_common "GNU CC" "3.0.1" "gcc --version | head -n1"
- check_common "GNU C++" "3.0.1" "g++ --version | head -n1"
- check_common "GNU libc" "2.2.5" "/lib/libc.so.6 | head -n1 | cut -d\" \" -f1-7"
- check_common "GNU libc static" "2.2.5" "test -e /lib/libc.a"
- check_common "GNU Grep" "2.5" "grep --version | head -n1"
- check_common "GNU zip" "1.2.4" "gzip --version | head -n1"
- check_common "Linux 2.6" "2.6.x" "uname -r" "Linux: "
- check_common "GNU make" "3.79.1" "make --version | head -n1"
- check_common "Patch" "2.5.4" "patch --version | head -n1"
- check_common "GNU sed" "3.0.2" "sed --version | head -n1"
- check_common "GNU tar" "1.14" "tar --version | head -n1"
- check_common "GNU Texinfo" "4.8" "makeinfo --version | head -n1"
- check_common "GNU m4" "1.4.8" "m4 --version | head -n1"
- check_common "GNU libtool" "libtool --version | head -n1"
- check_common "GNU automake" "automake --version | head -n1"
- check_common "GNU gettext-tools: msgfmt" "msgfmt --version | head -n1"
-}
-
-check_build() {
- check_common "Coreutils" "5.0" "chown --version | head -n1 | cut -d\")\" -f2" "Coreutils:"
- check_common "Git" "git --version"
- check_common "GNU make" "3.79.1" "make --version | head -n1"
- check_common "GNU which" "which --version | head -n1"
- check_common "Python" "python -V"
-}
-
-check_code() {
- ACTION=$1
- ARGS="--recurse"
-
- echo -n " Running code checks"
-
- case "$ACTION" in
- --fix)
- echo -n " and fix"
- ;;
- "")
- ARGS+=" --dryrun"
- ;;
- *)
- exiterror "This is not a valid option: $ACTION"
- ;;
- esac
-
- echo -n "..." # End the line
-
- python $BASEDIR/tools/code-beautify $ARGS $BASEDIR/{config,doc,lfs,src,tools}
- if [ "$?" -eq "0" ]; then
- beautify message DONE
- else
- beautify message FAIL
- exit 1
- fi
-}
-
-check_sanity() {
-
- echo "Checking sanity of working directory..."
-
- rootfiles_check $*
- check_code $*
-
-}
-
-check_user() {
- if [ -z $IPFIRE_USER ]; then
- echo -n "You have to setup IPFIRE_USER first. See .config for details."
- beautify message FAIL
- exit 1
- fi
-}
-
-check_loop() {
- for i in $(seq 0 7); do
- if [ -e /dev/loop/$i ] || [ -e /dev/loop$i ]; then
- return 0
- fi
- done
- return 1
-}
-
-CPU_FLAGS=$(grep ^flags /proc/cpuinfo)
-check_cpu() {
- FLAG=$1;
- grep -q $FLAG <<< $CPU_FLAGS
- return $?
-}
-
-check_supported_target() {
-
- if [ "$1" == "x86_64" ]; then
- if [ "$(uname -m)" != "x86_64" ]; then
- echo "Your system hasn't got the right architecture to build target $1." >&2
- return 1
- fi
- fi
-
- local FLAGS
- if [ "$1" = "via-c7" ]; then
- FLAGS="sse sse2 pni"
- elif [ "$1" = "via-c3" ]; then
- FLAGS="3dnow"
- elif [ "$1" = "atom" ]; then
- FLAGS="mmx sse sse2 pni ssse3"
- elif [ "$1" = "core2duo" ]; then
- FLAGS="sse2 pni ssse3"
- fi
- for j in $FLAGS; do
- if ! check_cpu $j; then
- echo "Your system doesn't support needed cpu feature \"$j\" to build target $1." >&2
- return 1
- fi
- done
- return 0
-}
-
-check_supported_targets() {
- for i in ${1-$POSSIBLE_TARGETS}; do
- check_supported_target $i 2>/dev/null
- [ "$?" -eq "0" ] && echo -n "$i "
- done
- echo # new line
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-function ccache_disable() {
- CCACHE=off
-}
-
-function ccache_enable() {
- unset CCACHE
-}
-
-function icecc_toolchain() {
- local chroot
- local file
-
- while [ $# -gt 0 ]; do
- case "${1}" in
- --chroot)
- chroot=1
- ;;
- *)
- file=${1}
- ;;
- esac
- shift
- done
-
- if [ -e "${file}" ]; then
- ICECC_VERSION=${file}
- return
- fi
-
- if [ "${chroot}" = "1" ]; then
- chroot_cmd ${TOOLS_DIR}/usr/lib/icecc/icecc-create-env ${file} \
- --gcc=${ICECC_CC} --gxx=${ICECC_CXX} --as=${ICECC_AS}
- else
- ${TOOLS_DIR}/usr/lib/icecc/icecc-create-env ${file} \
- --gcc=${ICECC_CC} --gxx=${ICECC_CXX} --as=${ICECC_AS}
- fi
-
- ICECC_VERSION=${file}
-}
-
-function iceccd_start() {
- if [ -n "$(pidof iceccd)" ]; then
- return
- fi
- ${TOOLS_DIR}/usr/sbin/iceccd -d \
- -m ${ICECC_JOBS-8} \
- -N ${HOSTNAME} \
- -p ${ICECC_PORT-10245} \
- $([ "${ICECC}" == "off" ] && echo "--no-remote") \
- $([ "${ICECC_SCHEDULER}" != "broadcast" ] && echo "-s ${ICECC_SCHEDULER}")
-}
-
-function iceccd_stop() {
- killall iceccd 2>/dev/null
-}
-
-function icecc_disable() {
- ICECC=off
- SAVE_CCACHE_PREFIX=${CCACHE_PREFIX}
- unset CCACHE_PREFIX
-}
-
-function icecc_enable() {
- unset ICECC
- iceccd_start
- CCACHE_PREFIX=$SAVE_CCACHE_PREFIX
- unset SAVE_CCACHE_PREFIX
-}
-
-function icecc_use() {
- local stage=${1}
- local options
- local file=${TOOLS_DIR}/${SNAME}-${TOOLCHAINVERSION}-${stage}-${TARGET}.tar.gz
-
- case "${stage}" in
- toolchain)
- ICECC_AS=${TOOLS_DIR}/bin/as
- ICECC_CC=${TOOLS_DIR}/bin/gcc
- ICECC_CXX=${TOOLS_DIR}/bin/g++
- ;;
- base)
- ICECC_AS=/usr/bin/as
- ICECC_CC=/usr/bin/gcc
- ICECC_CXX=/usr/bin/g++
- options=--chroot
- ;;
- host)
- ICECC_AS=/usr/bin/as
- ICECC_CC=/usr/bin/gcc
- ICECC_CXX=/usr/bin/g++
- file=${TOOLS_DIR}/${SNAME}-${TOOLCHAINVERSION}-${HOSTNAME}.tar.gz
- ;;
- esac
- icecc_toolchain ${options} ${file} >/dev/null
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-ccache_stats() {
- if [ -e $BASEDIR/ccache ]; then
- PATH=$PATH:build_${TARGET}/${TOOLS_DIR}/usr/bin \
- CCACHE_DIR=${BASEDIR}/ccache \
- ccache -s
- else
- echo -n "You can't access the statistics if you didn't run ./make.sh build"
- beautify message FAIL
- fi
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-###############################################################################
-#
-# Define default vars
-#
-###############################################################################
-
-# Default target
-TARGET=${TARGET-i686}
-POSSIBLE_TARGETS="i686 i586 i486 via-c7 via-c3 geodelx atom core2duo x86_64"
-
-# Configuration rootdir
-CONFIG_ROOT=/etc/$SNAME
-
-# Nice level
-NICE=10
-
-# Read in kernel version
-KVER=$(grep --max-count=1 PKG_VER lfs/linux | awk '{ print $3 }' | tr -d '\n'; grep --max-count=1 LOCALVERSION lfs/linux | awk '{ print $3 }' | tail -1)
-
-# Read in machine type
-MACHINE_REAL=$(uname -m)
-
-# Read in information from git
-GIT_REV=$(git rev-list --max-count=1 HEAD)
-GIT_TAG=$(git tag 2>/dev/null | tail -n 1)
-
-# Embedded build
-EMB=0
-
-# Default building options
-BUILD_EXTRAS=1
-BUILD_DEBUG=0
-
-# Default parallelism options
-PARALLELISMFLAGS=$($BASEDIR/src/scripts/parallelismflags --auto)
-
-# Default hostname
-HOSTNAME=${HOSTNAME-$(cat /proc/sys/kernel/hostname)}
-
-# Default scheduler
-ICECC_SCHEDULER="minerva.ipfire.org"
-
-###############################################################################
-#
-# Read the local configuration to override the environment variables
-#
-###############################################################################
-
-if ! [ -e .config ]; then
- sed -e "s/@UUID@/$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)/" \
- -e "s/^#UUID=/UUID=/" < $BASEDIR/.config-default > $BASEDIR/.config
-fi
-
-. $BASEDIR/.config
-
-###############################################################################
-#
-# Variables that are not modifyable by .config
-#
-###############################################################################
-
-if [ 'i686' = $MACHINE_REAL \
- -o 'i586' = $MACHINE_REAL \
- -o 'i486' = $MACHINE_REAL \
- -o 'x86_64' = $MACHINE_REAL ]; then
- IFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
-else
- beautify message FAIL
- echo "Can't determine your architecture - $MACHINE_REAL"
- exit 1
-fi
-
-LINKER=/lib/ld-linux.so.2
-GLOBAL_CFLAGS="-fomit-frame-pointer -pipe"
-if [ 'i686' = $TARGET -o 'i586' = $TARGET \
- -o 'i486' = $TARGET ]; then
- MACHINE=${TARGET}
- IFS_TARGET="${MACHINE}-pc-linux-gnu"
- CFLAGS="-O2 -march=${MACHINE} $GLOBAL_CFLAGS"
- CXXFLAGS="${CFLAGS}"
-elif [ 'atom' = $TARGET ]; then
- MACHINE=i686
- IFS_TARGET="${MACHINE}-atom-linux-gnu"
- CFLAGS="-O2 -march=${MACHINE} $GLOBAL_CFLAGS -mmmx -msse -msse2 -msse3 -mssse3"
- CXXFLAGS="${CFLAGS}"
- ICECC=off
-elif [ 'core2duo' = $TARGET ]; then
- MACHINE=i686
- IFS_TARGET="${MACHINE}-c2d-linux-gnu"
- CFLAGS="-O2 -march=pentium-m $GLOBAL_CFLAGS -msse2"
- CXXFLAGS="${CFLAGS}"
- ICECC=off
-elif [ 'via-c7' = $TARGET ]; then
- MACHINE=i686
- IFS_TARGET="${MACHINE}-via-linux-gnu"
- CFLAGS="-O2 -march=${MACHINE} $GLOBAL_CFLAGS -mmmx -msse -msse2 -msse3"
- CXXFLAGS="${CFLAGS}"
- ICECC=off
-elif [ 'via-c3' = $TARGET ]; then
- MACHINE=i586
- IFS_TARGET="${MACHINE}-via-linux-gnu"
- CFLAGS="-O2 -march=c3 -m3dnow $GLOBAL_CFLAGS"
- CXXFLAGS="${CFLAGS}"
- ICECC=off
-elif [ 'geodelx' = $TARGET ]; then
- MACHINE=i586
- IFS_TARGET="${MACHINE}-geode-linux-gnu"
- CFLAGS="-Os -march=geode $GLOBAL_CFLAGS"
- CXXFLAGS="${CFLAGS}"
- ICECC=off
-elif [ 'x86_64' = $TARGET ]; then
- MACHINE=x86_64
- IFS_TARGET="${MACHINE}-pc-linux-gnu"
- CFLAGS="-Os $GLOBAL_CFLAGS"
- CXXFLAGS="${CFLAGS}"
- LINKER=/lib64/ld-linux-x86-64.so.2
-else
- beautify message FAIL
- echo "Not a valid target arch ($POSSIBLE_TARGETS) - $TARGET"
- exit 1
-fi
-
-# Make debugging symbols
-if [ "$BUILD_DEBUG" == "1" ]; then
- CFLAGS=$(sed -e "s/-O[123s]/-O0/g" <<< $CFLAGS)
- CXXFLAGS=$(sed -e "s/-O[123s]/-O0/g" <<< $CXXFLAGS)
-fi
-
-# Define IMAGENAME
-IMAGENAME=${SNAME}-${VERSION}.${TARGET}
-
-if [ "$BUILD_DEBUG" == "1" ]; then
- # On debug build, append -debug
- IMAGENAME=${IMAGENAME}-debug
-fi
-
-# Define TOOLCHAINNAME
-TOOLCHAINNAME=$SNAME-$TOOLCHAINVERSION-toolchain-${TARGET}
-
-# Set up what used to be /tools
-TOOLS_DIR=/tools_${TARGET}
-
-# Set up /installer
-INSTALLER_DIR=/pomona
-
-# A place to build the iso
-CDROM_DIR=/cdrom
-
-# A place to keep the images
-IMAGES_DIR=/images
-
-# Files that indicates that we are running or failed
-RUNNING=$BASEDIR/.running
-FAILED=$BASEDIR/.failed
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008, 2009 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-ALLOWED_TARGETS=${ALLOWED_TARGETS-$(check_supported_targets)}
-
-cron_run() {
- if [ "$PATH" = "/sbin:/bin" ]; then
- export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- fi
-
- local RAND=$(( $RANDOM % $(wc -w <<< $ALLOWED_TARGETS) ))
-
- if [ "$(dirname $0)" != "." ]; then
- dialogerror "You must change into the basedirectory before you run \"./$(basename $0) $@\""
- exit 1
- fi
-
- if [ -f "$RUNNING" ]; then
- dialogerror "Build is already running at the moment..." 2>&1
- exit 0
- fi
-
- # Pull latest changes
- git_diff
- git checkout -f # Remove all local changes !!!
- git_pull --batch
-
- if [ -f "$FAILED" ]; then
- dialogerror "Build failed..." 2>&1
- exit 0
- fi
-
- local COUNT=0
- for i in $ALLOWED_TARGETS; do
- COUNT=$(( $COUNT + 1 ))
- [ "$COUNT" != "$(( $RAND + 1 ))" ] && continue
- TARGET=$i $0 batch start --clean
- break
- done
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-# A small helper to make the git functions comfortable #
-# #
-###############################################################################
-###############################################################################
-#
-# Set the environment
-#
-###############################################################################
-
-if [ -z "$EDITOR" ]; then
- for i in nano emacs vi; do
- EDITOR=$(which $i 2>/dev/null)
- if ! [ -z "$EDITOR" ]; then
- export EDITOR=$EDITOR
- break
- fi
- done
- [ -z "$EDITOR" ] && exiterror "You should have installed an editor."
-fi
-
-CURRENT_BRANCH=$(git branch | grep ^* | cut -c 3-)
-
-# Apply git hooks
-if [ -d "$BASEDIR/.git" ]; then
- ln -sf $BASEDIR/tools/make-git $BASEDIR/.git/hooks/pre-commit
-fi
-
-###############################################################################
-#
-# A small helper to make the git functions comfortable
-#
-###############################################################################
-
-git_pull() {
- if [ "$1" = "--batch" ]; then
- shift
- git pull $* | grep -q "Already up-to-date." || rm -f $FAILED
- [ "$(expr $RANDOM % 25)" -eq "0" ] && git_gc
- else
- if [ "$CURRENT_BRANCH" == "master" ]; then
- git pull
- else
- echo -n "You are not on branch \"master\". Do you want to rebase from \"master\"? [y/N]"
- read
- [ -z $REPLY ] && return 0
- for i in y Y j J; do
- if [ "$i" == "$REPLY" ]; then
- git rebase -v refs/heads/master
- return $?
- fi
- done
- exiterror "\"$REPLY\" is not a valid answer."
- fi
- fi
- GIT_REV=$(git rev-list --max-count=1 HEAD)
-}
-
-git_push() {
- check_user
-
- [ "$CURRENT_BRANCH" == "master" ] || \
- exiterror "You have to be in branch \"master\", if you want to push."
- git push ssh://${IPFIRE_USER}@git.ipfire.org/pub/git/ipfire-3.x master
-}
-
-git_commit() {
- check_sanity
-
- git commit $*
-
- [ "$?" -eq "0" ] || dialogerror "git commit $* failed."
-}
-
-git_diff() {
- DIFF_NAME="${BASEDIR}/ipfire-diff-$(date '+%Y%m%d-%0k%0M').diff"
-
- check_sanity --fix
-
- echo -ne "Make a local diff to last revision"
- git diff HEAD > $DIFF_NAME
- evaluate
- if [ -s $DIFF_NAME ]; then # if diff file is empty
- echo "Diff was successfully saved to $DIFF_NAME"
- git diff HEAD --stat
- else
- rm -f $DIFF_NAME
- return 1
- fi
-}
-
-git_log() {
- echo -n "Generating changelog from repository"
-
- git log -n 500 --no-merges --pretty=medium --shortstat $(git_range) > $BASEDIR/doc/ChangeLog
- evaluate
-}
-
-git_shortlog() {
- git shortlog --no-merges $(git_range)
-}
-
-git_gc() {
- git gc --prune
-}
-
-git_export() {
- git archive HEAD | gzip -9 > ${SNAME}-${VERSION}.source.tar.gz
-}
-
-git_range() {
- local EXT
- [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG
- [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
- echo $EXT
-}
-
-ssh_cert() {
- test $# -gt 0 || exiterror "You need to pass the hostname of the remote host."
-
- SSH_KEYGEN=`which ssh-keygen`
- if test $? -ne 0; then
- # Error message is printed by 'which'
- return 1
- fi
-
- SSH_DIR=~/.ssh
- if ! test -d $SSH_DIR; then
- mkdir $SSH_DIR
- fi
- chmod 700 $SSH_DIR
-
- if [ ! -f $SSH_DIR/identity ] || [ ! -f $SSH_DIR/identity.pub ]; then
- echo "Generating ssh1 RSA keys - please wait..."
- rm -f $SSH_DIR/identity $SSH_DIR/identity.pub
- $SSH_KEYGEN -t rsa1 -f $SSH_DIR/identity -P ''
- if [ $? -ne 0 ]; then
- echo "Command \"$SSH_KEYGEN -t rsa1 -f $SSH_DIR/identity" \
- "-P ''\" failed" 1>&2
- return 1
- fi
- else
- echo "ssh1 RSA key is present"
- fi
-
- if [ ! -f $SSH_DIR/id_dsa ] || [ ! -f $SSH_DIR/id_dsa.pub ]; then
- echo "Generating ssh2 DSA keys - please wait..."
- rm -f $SSH_DIR/id_dsa $SSH_DIR/id_dsa.pub
- $SSH_KEYGEN -t dsa -f $SSH_DIR/id_dsa -P ''
- if test $? -ne 0; then
- echo "Command \"$SSH_KEYGEN -t dsa -f $SSH_DIR/id_dsa" \
- "-P ''\" failed" 1>&2
- return 1
- fi
- else
- echo "ssh2 DSA key is present"
- fi
-
- SSH1_RSA_KEY=`cat $SSH_DIR/identity.pub`
- SSH2_DSA_KEY=`cat $SSH_DIR/id_dsa.pub`
-
- for IP in $*; do
- echo "You will now be asked for password for $IP"
- ssh -oStrictHostKeyChecking=no $IP "mkdir -p ~/.ssh; chmod 700 ~/.ssh; \
- echo \"$SSH1_RSA_KEY\" >> ~/.ssh/authorized_keys; \
- echo \"$SSH2_DSA_KEY\" >> ~/.ssh/authorized_keys2; \
- chmod 600 ~/.ssh/authorized_keys ~/.ssh/authorized_keys2"
- if test $? -eq 0; then
- echo "Keys were put successfully"
- else
- echo "Error putting keys to $IP" 1>&2
- fi
- done
-
- for IP in $*; do
- for ver in 1 2; do
- echo -n "Checking $IP connectivity by ssh$ver... "
- ssh -q -oProtocol=${ver} -oBatchMode=yes \
- -oStrictHostKeyChecking=no $IP /bin/true
- evaluate
- done
- done
-}
-
-git_hook_pre_commit() {
- local USERNAME USERMAIL
- USERNAME=$(git config --list | grep ^user.name)
- USERNAME=${USERNAME#user.name=}
-
- USERMAIL=$(git config --list | grep ^user.email)
- USERMAIL=${USERMAIL#user.email=}
-
- if ! egrep -q "@ipfire.org" <<< $USERMAIL; then
- echo "User email is not from ipfire.org. Can't commit."
- return 1
- fi
-
- COUNTER=0
- for i in $USERNAME; do
- COUNTER=$[ $COUNTER + 1 ]
- done
-
- if [ ! "$COUNTER" -ge 2 ]; then
- echo "Setup user name as your real name. Can't commit."
- return 1
- fi
-}
-
-# Run hooks
-if [ "$(basename $0)" = "pre-commit" ]; then
- git_hook_pre_commit
- exit $?
-fi
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-###############################################################################
-#
-# System variables
-#
-###############################################################################
-
-PWD=$(pwd)
-BASENAME=$(basename $0)
-
-# Debian specific settings
-if [ ! -e /etc/debian_version ]; then
- FULLPATH=$(which $0)
-else
- if [ -x /usr/bin/realpath ]; then
- FULLPATH=$(/usr/bin/realpath $0)
- else
- echo "ERROR: Need to do apt-get install realpath"
- exit 1
- fi
-fi
-
-BASEDIR=$(echo $FULLPATH | sed "s/\/$BASENAME//g")
-export BASEDIR
-
-. $BASEDIR/tools/make-constants # Load this very early
-. $BASEDIR/tools/make-beautify
-
-mkdir $BASEDIR/log_${TARGET}/ 2>/dev/null
-
-################################################################################
-# #
-# Necessary shell functions #
-# #
-################################################################################
-
-. $BASEDIR/tools/make-buildspy
-. $BASEDIR/tools/make-check
-. $BASEDIR/tools/make-batch
-. $BASEDIR/tools/make-cluster
-. $BASEDIR/tools/make-compilers
-. $BASEDIR/tools/make-git
-. $BASEDIR/tools/make-packages
-. $BASEDIR/tools/make-rootfiles
-. $BASEDIR/tools/make-vm
-. $BASEDIR/tools/make-cron
-
-evaluate() {
- RETVAL=$?
- if [ "$RETVAL" -eq "0" ]; then
- beautify message DONE
- else
- beautify message FAIL
- fi
- (exit $RETVAL)
-}
-
-stdumount() {
- sleep 0.3 # Wait one second for finish of processes
- for fs in $(mount | grep $BASEDIR/build_${TARGET} | awk '{print $3}'); do
- umount $fs 2>/dev/null;
- done
-} # End of stdumount()
-
-exiterror() {
- stdumount
- dialogerror $*
- build_spy state error
- if [ -n "$LOGFILE" ]; then
- tail -n48 $LOGFILE > $FAILED
- echo "$(date -u '+%b %e %T') ERROR: $*" >> $LOGFILE
- build_spy log $($BASEDIR/tools/base64 < $FAILED)
- fi
- build_spy exit
- touch $FAILED
- rm -f $RUNNING 2>/dev/null
- exit 1
-} # End of exiterror()
-
-logger() {
- local logfile=$LOGFILE
- case "$1" in
- --cluster)
- logfile=$BASEDIR/log_$TARGET/_build.00-cluster.log
- shift
- ;;
- esac
- echo "$(date -u '+%b %e %T') $*" >> $logfile
-}
-
-function ifdef() {
- local var=${1}
- [ -n "${!var}" ] && echo "${var}=${!var}"
-}
-
-################################################################################
-# This is the function that sets the environment of a chroot and enters it #
-################################################################################
-entershell() {
- PATH=${TOOLS_DIR}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/bin:/usr/${MACHINE_REAL}-linux/bin
-
- if [ ! -e $LFS/usr/src/lfs/ ]; then
- exiterror "No such file or directory: $LFS/usr/src/lfs/"
- fi
-
- echo -ne "Entering ${BOLD}$MACHINE${NORMAL} LFS chroot, type exit to return to host environment\n"
-
- chroot_cmd ${@-bash} # Run command, given as parameters.
-
- if [ $? -ne 0 ]; then
- exiterror "chroot error"
- else
- stdumount
- fi
-} # End of entershell()
-
-function chroot_cmd() {
- chroot $LFS $TOOLS_DIR/bin/env -i \
- HOME=/root \
- TERM=$TERM \
- PS1="${BOLD}[chroot-${TARGET}(${MACHINE})]${NORMAL} \u:\w\$ " \
- PATH=$PATH \
- CONFIG_ROOT=${CONFIG_ROOT} \
- VERSION=${VERSION} \
- NAME=${NAME} \
- SNAME=${SNAME} \
- SLOGAN="$SLOGAN" \
- CCACHE_DIR=/usr/src/ccache \
- CCACHE_PREFIX=${CCACHE_PREFIX} \
- CCACHE_HASHDIR=${CCACHE_HASHDIR} \
- $(ifdef ICECC) \
- $(ifdef ICECC_CC) \
- $(ifdef ICECC_CXX) \
- $(ifdef ICECC_PREFERRED_HOST) \
- PARALLELISMFLAGS=$PARALLELISMFLAGS \
- LINKER=$LINKER \
- TOOLS_DIR=$TOOLS_DIR \
- INSTALLER_DIR=$INSTALLER_DIR \
- MACHINE="$MACHINE" \
- MACHINE_REAL="$MACHINE_REAL" \
- CFLAGS="$CFLAGS" \
- CXXFLAGS="$CXXFLAGS" \
- IFS_HOST="$IFS_HOST" \
- IFS_TARGET="$IFS_TARGET" \
- KVER=$KVER \
- $@
-}
-
-################################################################################
-# Common checking before entering the chroot and compilling #
-# Return:0 caller can continue #
-# :1 skip (nothing to do) #
-# or fail if no script file found #
-################################################################################
-lfsmakecommoncheck()
-{
- # Skip lfs/Config
- [ "$(basename $1)" = "Config" ] && return 1
-
- # Script present?
- if [ ! -f $BASEDIR/lfs/$1 ]; then
- exiterror "No such file or directory: $BASEDIR/lfs/$1"
- fi
-
- local FILENAME=$1
- eval $(pkg_info $FILENAME)
- logger "Building $FILENAME"
-
- shift 1
-
- [ "$STAGE" != "packages" ] && build_spy package $PKG_NAME
-
- beautify package "$PKG_NAME" "$PKG_VER" "$*"
-
- # Script slipped?
- local i
- for i in $SKIP_PACKAGE_LIST; do
- if [ "$i" = "$PKG_NAME" ]; then
- beautify result SKIP
- return 1
- fi
- done
-
- # On debug build, we don't strip
- if [ "$STAGE" != "toolchain" -a \
- "$PKG_NAME" = "strip" -a "$BUILD_DEBUG" = "1" ]; then
- beautify result SKIP
- return 1
- fi
-
- # Don't create addons?
- if [ "$PKG_EXTRA" = "yes" ] && [ "$BUILD_EXTRAS" = "0" ]; then
- beautify result SKIP
- return 1
- fi
-
- # Don't create debugging tools?
- if [ "$PKG_DEBUG" = "yes" ] && [ "$BUILD_DEBUG" = "0" ]; then
- beautify result SKIP
- return 1
- fi
-
- # Append package to the list it belongs to
- if [ "$STAGE" != "packages" ]; then
- if [ "$PKG_CORE" = "yes" ]; then
- PACKAGES_CORE="$PACKAGES_CORE $PKG_PACKAGES"
- elif [ "$PKG_EXTRA" = "yes" ]; then
- PACKAGES_EXTRA="$PACKAGES_EXTRA $PKG_PACKAGES"
- elif [ "$PKG_DEBUG" = "yes" ]; then
- PACKAGES_DEBUG="$PACKAGES_DEBUG $PKG_PACKAGES"
- fi
- fi
-
- # Searching for dependencies
- local found message
- for dep in $PKG_DEPS; do
- found=0
- for package in $PACKAGES_DONE; do
- if [ "$dep" = "$package" ]; then
- found=1
- break
- fi
- done
- [ "$found" = "0" ] && message="$message $dep"
- done
- if [ "$message" != "" ]; then
- message="Deps are missing: $message"
- if [ "$PKG_EXTRA" = "yes" ]; then
- echo -ne "${WARN}${message}${NORMAL}"
- beautify message SKIP
- return 1
- else
- exiterror "$message"
- fi
- fi
-
- cd $BASEDIR/lfs && make -s -f $FILENAME MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
- if [ $? -ne 0 ]; then
- exiterror "Download error in $1"
- fi
-
- return 0 # pass all!
-} # End of lfsmakecommoncheck()
-
-################################################################################
-# This is the function that builds every package in stage "toolchain" #
-################################################################################
-toolchain_make() {
- lfsmakecommoncheck $*
- [ $? == 1 ] && return 0
-
- local PKG_TIME_START=$(date +%s)
- cd $BASEDIR/lfs && env -i \
- HOME="/root" \
- TERM="${TERM}" \
- PS1='\u:\w\$ ' \
- PATH="${PATH}" \
- \
- NAME="${NAME}" \
- SNAME="${SNAME}" \
- SLOGAN="${SLOGAN}" \
- VERSION="${VERSION}" \
- TARGET="$TARGET" \
- BUILD_DEBUG="${BUILD_DEBUG}" \
- BUILD_EXTRAS="${BUILD_EXTRAS}" \
- KVER="${KVER}" \
- EMB="${EMB}" \
- \
- $(ifdef CCACHE) \
- CCACHE_DIR="${BASEDIR}/ccache" \
- CCACHE_HASHDIR="${CCACHE_HASHDIR}" \
- $(ifdef CCACHE_PREFIX) \
- \
- $(ifdef ICECC) \
- $(ifdef ICECC_VERSION) \
- USE_SCHEDULER="${ICECC_SCHEDULER}" \
- $(ifdef ICECC_CC) \
- $(ifdef ICECC_CXX) \
- $(ifdef ICECC_PREFERRED_HOST) \
- \
- LINKER="${LINKER}" \
- MACHINE="${MACHINE}" \
- MACHINE_REAL="${MACHINE_REAL}" \
- \
- CFLAGS="${CFLAGS}" \
- CXXFLAGS="${CXXFLAGS}" \
- IFS_HOST="${IFS_HOST}" \
- IFS_TARGET="${IFS_TARGET}" \
- PARALLELISMFLAGS="${PARALLELISMFLAGS}" \
- \
- CONFIG_ROOT="${CONFIG_ROOT}" \
- CDROM_DIR="${CDROM_DIR}" \
- IMAGES_DIR="${IMAGES_DIR}" \
- INSTALLER_DIR="${INSTALLER_DIR}" \
- TOOLS_DIR="${TOOLS_DIR}" \
- \
- STAGE="${STAGE}" \
- STAGE_ORDER="${STAGE_ORDER}" \
- \
- IMAGENAME="${IMAGENAME}" \
- PACKAGES_CORE="${PACKAGES_CORE}" \
- PACKAGES_EXTRA="${PACKAGES_EXTRA}" \
- PACKAGES_DEBUG="${PACKAGES_DEBUG}" \
- \
- LOGFILE=$(echo ${LOGFILE} | sed "s,${BASEDIR},/usr/src,g") \
- \
- LFS="${LFS}" \
- LFS_BASEDIR="${BASEDIR}" \
- \
- make -f $* install >> $LOGFILE 2>&1
-
- local COMPILE_SUCCESS=$?
- local PKG_TIME_END=$(date +%s)
-
- if [ $COMPILE_SUCCESS -ne 0 ]; then
- beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
- exiterror "Building $*"
- else
- beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
- PACKAGES_DONE="$PACKAGES_DONE $1"
- fi
-
- return 0
-} # End of toolchain_make()
-
-################################################################################
-# This is the function that builds every package in stage "base" and "ipfire" #
-################################################################################
-ipfire_make() {
- lfsmakecommoncheck $*
- [ $? == 1 ] && return 0
-
- local PKG_TIME_START=$(date +%s)
- chroot $LFS $TOOLS_DIR/bin/env -i \
- HOME="/root" \
- TERM="${TERM}" \
- PS1='\u:\w\$ ' \
- PATH="${PATH}" \
- \
- NAME="${NAME}" \
- SNAME="${SNAME}" \
- SLOGAN="${SLOGAN}" \
- VERSION="${VERSION}" \
- TARGET="$TARGET" \
- BUILD_DEBUG="${BUILD_DEBUG}" \
- BUILD_EXTRAS="${BUILD_EXTRAS}" \
- KVER="${KVER}" \
- EMB="${EMB}" \
- \
- $(ifdef CCACHE) \
- CCACHE_DIR="/usr/src/ccache" \
- CCACHE_HASHDIR="${CCACHE_HASHDIR}" \
- $(ifdef CCACHE_PREFIX) \
- \
- $(ifdef ICECC) \
- $(ifdef ICECC_VERSION) \
- USE_SCHEDULER="${ICECC_SCHEDULER}" \
- $(ifdef ICECC_CC) \
- $(ifdef ICECC_CXX) \
- $(ifdef ICECC_PREFERRED_HOST) \
- \
- LINKER="${LINKER}" \
- MACHINE="${MACHINE}" \
- MACHINE_REAL="${MACHINE_REAL}" \
- \
- CFLAGS="${CFLAGS}" \
- CXXFLAGS="${CXXFLAGS}" \
- IFS_HOST="${IFS_HOST}" \
- IFS_TARGET="${IFS_TARGET}" \
- PARALLELISMFLAGS="${PARALLELISMFLAGS}" \
- \
- CONFIG_ROOT="${CONFIG_ROOT}" \
- CDROM_DIR="${CDROM_DIR}" \
- IMAGES_DIR="${IMAGES_DIR}" \
- INSTALLER_DIR="${INSTALLER_DIR}" \
- TOOLS_DIR="${TOOLS_DIR}" \
- \
- STAGE="${STAGE}" \
- STAGE_ORDER="${STAGE_ORDER}" \
- \
- IMAGENAME="${IMAGENAME}" \
- PACKAGES_CORE="${PACKAGES_CORE}" \
- PACKAGES_EXTRA="${PACKAGES_EXTRA}" \
- PACKAGES_DEBUG="${PACKAGES_DEBUG}" \
- \
- LOGFILE=$(echo ${LOGFILE} | sed "s,${BASEDIR},/usr/src,g") \
- \
- bash -x -c "cd /usr/src/lfs && \
- make -f $* LFS_BASEDIR=/usr/src install packages" >> ${LOGFILE} 2>&1
-
- local COMPILE_SUCCESS=$?
- local PKG_TIME_END=$(date +%s)
-
- if [ $COMPILE_SUCCESS -ne 0 ]; then
- beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
- exiterror "Building $*"
- else
- beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
- PACKAGES_DONE="$PACKAGES_DONE $1"
- fi
-
- return 0
-} # End of ipfire_make()
-
-
-################################################################################
-# This is the function that compresses every package #
-################################################################################
-package_make() {
- SKIP_PACKAGE_LIST="SKIP_PACKAGE_LIST Config adjust-toolchain cdrom images pxe test-toolchain usb-key usb-stick" \
- lfsmakecommoncheck $*
- [ $? == 1 ] && return 0
-
- local PKG_TIME_START=$(date +%s)
- chroot $LFS $TOOLS_DIR/bin/env -i \
- HOME="/root" \
- TERM="${TERM}" \
- PS1='\u:\w\$ ' \
- PATH="${PATH}" \
- \
- NAME="${NAME}" \
- SNAME="${SNAME}" \
- SLOGAN="${SLOGAN}" \
- VERSION="${VERSION}" \
- TARGET="$TARGET" \
- BUILD_DEBUG="${BUILD_DEBUG}" \
- BUILD_EXTRAS="${BUILD_EXTRAS}" \
- KVER="${KVER}" \
- EMB="${EMB}" \
- \
- CCACHE_DIR="/usr/src/ccache" \
- CCACHE_PREFIX="${CCACHE_PREFIX}" \
- CCACHE_HASHDIR="${CCACHE_HASHDIR}" \
- \
- LINKER="${LINKER}" \
- MACHINE="${MACHINE}" \
- MACHINE_REAL="${MACHINE_REAL}" \
- \
- CFLAGS="${CFLAGS}" \
- CXXFLAGS="${CXXFLAGS}" \
- IFS_HOST="${IFS_HOST}" \
- IFS_TARGET="${IFS_TARGET}" \
- PARALLELISMFLAGS="${PARALLELISMFLAGS}" \
- \
- CONFIG_ROOT="${CONFIG_ROOT}" \
- CDROM_DIR="${CDROM_DIR}" \
- IMAGES_DIR="${IMAGES_DIR}" \
- INSTALLER_DIR="${INSTALLER_DIR}" \
- TOOLS_DIR="${TOOLS_DIR}" \
- \
- STAGE="${STAGE}" \
- STAGE_ORDER="${STAGE_ORDER}" \
- \
- IMAGENAME="${IMAGENAME}" \
- PACKAGES_CORE="${PACKAGES_CORE}" \
- PACKAGES_EXTRA="${PACKAGES_EXTRA}" \
- PACKAGES_DEBUG="${PACKAGES_DEBUG}" \
- \
- LOGFILE=$(echo ${LOGFILE} | sed "s,${BASEDIR},/usr/src,g") \
- \
- bash -x -c "cd /usr/src/lfs && \
- make -f $* LFS_BASEDIR=/usr/src package" >>$LOGFILE 2>&1
-
- local COMPILE_SUCCESS=$?
- local PKG_TIME_END=$(date +%s)
-
- if [ $COMPILE_SUCCESS -ne 0 ]; then
- beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
- exiterror "Packageing $*"
- else
- beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
- PACKAGES_DONE="$PACKAGES_DONE $1"
- fi
-
- return 0
-} # End of package_make()
-
-################################################################################
-# This prepares the build environment #
-################################################################################
-prepareenv() {
- LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
- export LOGFILE
- mkdir -p $BASEDIR/log_${TARGET}/01_toolchain 2>/dev/null
- mkdir -p $BASEDIR/log_${TARGET}/02_base 2>/dev/null
- mkdir -p $BASEDIR/log_${TARGET}/03_${SNAME} 2>/dev/null
- mkdir -p $BASEDIR/log_${TARGET}/04_misc 2>/dev/null
- mkdir -p $BASEDIR/log_${TARGET}/05_installer 2>/dev/null
- mkdir -p $BASEDIR/log_${TARGET}/06_packages 2>/dev/null
-
- #############################################################################
- # Are we running the right shell? #
- #############################################################################
-
- if [ ! "$BASH" ]; then
- exiterror "BASH environment variable is not set. You're probably running the wrong shell."
- fi
-
- if [ -z "${BASH_VERSION}" ]; then
- exiterror "Not running BASH shell."
- fi
-
- #############################################################################
- # Trap on emergency exit #
- #############################################################################
- trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
-
-
- #############################################################################
- # Resetting our nice level #
- #############################################################################
- echo -ne "Resetting our nice level to $NICE"
- renice $NICE $$ > /dev/null
- if [ $(nice) != "$NICE" ]; then
- beautify message FAIL
- exiterror "Failed to set correct nice level"
- else
- beautify message DONE
- fi
-
- # Set SCHED_BATCH
- if [ -x /usr/bin/schedtool ]; then
- /usr/bin/schedtool -B $$
- if [ $? -ne 0 ]; then
- echo -ne "Setting kernel schedular to SCHED_BATCH"
- beautify message FAIL
- fi
- fi
-
- ##############################################################################
- # Checking if running as root user #
- ##############################################################################
- if [ $(id -u) != 0 ]; then
- echo -ne "Checking if we're running as root user"
- beautify message FAIL
- exiterror "Not building as root"
- fi
-
- ##############################################################################
- # Checking for necessary temporary space #
- ##############################################################################
- BASE_DEV=$(df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }')
- BASE_ASPACE=$(df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }')
- if (( 2048000 > $BASE_ASPACE )); then
- BASE_USPACE=$(du -skx $BASEDIR | awk '{print $1}')
- if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
- echo -ne "Checking for necessary space on disk $BASE_DEV"
- beautify message FAIL
- exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
- fi
- fi
-
- ##############################################################################
- # Embedded build #
- ##############################################################################
-
- echo -ne "Embedded build"
- if [ $EMB -eq 1 ]; then
- beautify message ON
- check_loop || exiterror "Can't build flash images on this machine."
- else
- beautify message OFF
- fi
-
- export EMB
-
- ##############################################################################
- # Checking CPU features #
- ##############################################################################
-
- check_supported_target $TARGET || \
- exiterror "Your host doesn't have all needed cpu features for building \"$TARGET\""
-
- ##############################################################################
- # Building Linux From Scratch system configuration #
- ##############################################################################
-
- # Set umask
- umask 022
-
- # Set LFS Directory
- LFS=$BASEDIR/build_${TARGET}/${SNAME}
-
- # Check /tools symlink
- if [ -h $TOOLS_DIR ]; then
- rm -f $TOOLS_DIR
- fi
- if [ ! -a $TOOLS_DIR ]; then
- ln -s $BASEDIR/build_${TARGET}/$TOOLS_DIR /
- fi
- if [ ! -h $TOOLS_DIR ]; then
- exiterror "Could not create $TOOLS_DIR symbolic link."
- fi
-
- # Setup environment
- set +h
- LC_ALL=POSIX
- export LFS LC_ALL
- unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
-
- # Make some extra directories
- mkdir -p $BASEDIR/build_${TARGET}/{$TOOLS_DIR,cdrom,$INSTALLER_DIR,$IMAGES_DIR} 2>/dev/null
- mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
- mkdir -p $BASEDIR/cache/{toolchains,patches,tarballs} 2>/dev/null
- mkdir -p $BASEDIR/packages_${TARGET} 2>/dev/null
- mkdir -p $LFS/{$TOOLS_DIR,usr/src} 2>/dev/null
- mkdir -p $LFS/{dev,etc,proc,sys} 2>/dev/null
- mkdir -p $LFS/dev/pts 2>/dev/null
- mkdir -p $LFS/usr/src/{cache,config,doc,lfs,log_${TARGET},src,ccache} 2>/dev/null
- mkdir -p $LFS/{$INSTALLER_DIR,cdrom,images,packages} 2>/dev/null
-
- mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
- mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
-
- # Make all sources and proc available under lfs build
- mount --bind /dev $LFS/dev
- mount --bind /proc $LFS/proc
- mount --bind /sys $LFS/sys
- mount --bind $BASEDIR/cache $LFS/usr/src/cache
- mount --bind $BASEDIR/ccache $LFS/usr/src/ccache
- mount --bind $BASEDIR/config $LFS/usr/src/config
- mount --bind $BASEDIR/doc $LFS/usr/src/doc
- mount --bind $BASEDIR/lfs $LFS/usr/src/lfs
- mount --bind $BASEDIR/log_${TARGET} $LFS/usr/src/log_${TARGET}
- mount --bind $BASEDIR/src $LFS/usr/src/src
- mount --bind $BASEDIR/build_${TARGET}/$TOOLS_DIR $LFS/$TOOLS_DIR
- mount --bind $BASEDIR/build_${TARGET}/$CDROM_DIR $LFS/$CDROM_DIR
- mount --bind $BASEDIR/build_${TARGET}/$INSTALLER_DIR $LFS/$INSTALLER_DIR
- mount --bind $BASEDIR/build_${TARGET}/$IMAGES_DIR $LFS/$IMAGES_DIR
- mount --bind $BASEDIR/packages_${TARGET} $LFS/packages
-
- # Run LFS static binary creation scripts one by one
- export CCACHE_DIR=$BASEDIR/ccache
- export CCACHE_HASHDIR=1
- export CCACHE_PREFIX="icecc"
-
- # Remove pre-install list of installed files in case user erase some files before rebuild
- rm -f $LFS/usr/src/lsalr 2>/dev/null
-}
-
-build() {
- #a prebuilt toolchain package is only used if found in cache
- if [ ! -d $BASEDIR/cache ]; then
- exiterror "Use make.sh source get first!"
- fi
- cd $BASEDIR/cache/toolchains
- PACKAGE=$(ls -v -r $TOOLCHAINNAME.tar.bz2 2>/dev/null | head -n 1)
- #only restore on a clean disk
-
- local BLD_TIME_START=$(date +%s)
- touch $RUNNING; rm -f $FAILED $BUILD_SPY_FILENAME 2>/dev/null
-
- echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n"
-
- build_spy_send_profile
- build_spy state compiling
- build_spy start
-
- if [ -f $BASEDIR/log_${TARGET}/02_base/stage2 ]; then
- prepareenv
- echo "Using installed toolchain" >> $LOGFILE
- beautify message DONE "Stage toolchain already built or extracted"
- else
- if [ -z "$PACKAGE" ]; then
- echo "Full toolchain compilation"
- prepareenv
-
- check_toolchain
-
- beautify build_stage "Building toolchain"
- toolchain_build
- else
- echo "Restore from $PACKAGE"
- cd $BASEDIR && tar jxf $BASEDIR/cache/toolchains/$PACKAGE
- prepareenv
- fi
- fi
-
- beautify build_stage "Building base"
- base_build
-
- beautify build_stage "Building $SNAME"
- ipfire_build
-
- beautify build_stage "Building miscellaneous"
- misc_build
-
-if [ "${EMB}" -eq "0" ]; then
- beautify build_stage "Building installer"
- installer_build
-fi
-
- beautify build_stage "Building packages"
- packages_build
-
- echo ""
- echo "... and all this hard work for this:"
- ls -sh $BASEDIR/${IMAGENAME}.iso
-
- local BLD_TIME_END=$(date +%s)
- build_spy duration $[ $BLD_TIME_END - $BLD_TIME_START ]
- build_spy state idle
- build_spy exit
- rm -f $RUNNING
-}
-
-gettoolchain() {
- check_user
- DIR_TOOLCHAIN="$BASEDIR/cache/toolchains"
- [ -d "${DIR_TOOLCHAIN}" ] || mkdir -p ${DIR_TOOLCHAIN}
- if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then
- URL_TOOLCHAIN=$(grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }')
- DIR_TOOLCHAIN="$BASEDIR/cache/toolchains"
-
- echo "Loading toolchain for $TARGET"
- scp -2 ${IPFIRE_USER}@${URL_TOOLCHAIN}/$TOOLCHAINNAME.tar.bz2 \
- ${DIR_TOOLCHAIN}
- else
- echo -n "Toolchain \"$TOOLCHAINNAME\" is already existing"
- beautify message SKIP
- fi
-}
-
-puttoolchain() {
- check_user
- if [ -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then
- URL_TOOLCHAIN=$(grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }')
- DIR_TOOLCHAIN="$BASEDIR/cache/toolchains"
-
- echo "Pushing toolchain for $TARGET"
- scp -2 ${DIR_TOOLCHAIN}/$TOOLCHAINNAME.tar.bz2 \
- ${IPFIRE_USER}@${URL_TOOLCHAIN}
- else
- echo -n "Toolchain \"$TOOLCHAINNAME\" is not existing. "
- echo -n "Run \"./make.sh build\", first"
- beautify message SKIP
- fi
-}
-
-getsource() {
- if [ ! -d $BASEDIR/cache ]; then
- mkdir -p $BASEDIR/cache/{tarballs,patches}
- fi
- mkdir -p $BASEDIR/log_${TARGET}
- echo -e "${BOLD}Preload all source files${NORMAL}"
- cd $BASEDIR/lfs
- for i in *; do
- if [ -f "$i" -a "$i" != "Config" ]; then
- make -s -f $i \
- LFS_BASEDIR=$BASEDIR \
- MESSAGE="$i\t" \
- download 2>> $LOGFILE
- [ $? -ne 0 ] && beautify message FAIL
- fi
- done
- cd $BASEDIR
-}
-
-putsource() {
- check_user
- URL_SOURCE=$(grep URL_SOURCE lfs/Config | awk '{ print $3 }')
- REMOTE_FILES=$(echo "ls -1" | sftp -C ${IPFIRE_USER}@${URL_SOURCE})
-
- cd $BASEDIR/cache/tarballs/
- for file in $(ls -1); do
- grep -q "$file" <<<$REMOTE_FILES && continue
- NEW_FILES="$NEW_FILES $file"
- done
- [ -n "$NEW_FILES" ] && scp -2 $NEW_FILES ${IPFIRE_USER}@${URL_SOURCE}
- cd $BASEDIR
-}
-
-puttarget() {
- check_user
- URL_TARGET=$(grep URL_TARGET lfs/Config | awk '{ print $3 }')
- DIR="${BASEDIR}/${HOSTNAME}/$(date '+%Y%m%d-%0k')-${TARGET}/"
-
- # If there is no iso, we do nothing.
- ls ${BASEDIR}/${IMAGENAME}.* &>/dev/null || return 0
-
- rm -rf ${BASEDIR}/${HOSTNAME} 2>/dev/null
- mkdir -p ${DIR}
-
- [ -e "${BASEDIR}/packages_${TARGET}" ] && cp -al ${BASEDIR}/packages_${TARGET} ${DIR}
- [ -e "${BATCHLOG}" ] && \
- python ${BASEDIR}/tools/alog2html < ${BATCHLOG} > ${DIR}/build_log.html
- pkg_list_packages > ${DIR}/packages-list.txt
- git_log >/dev/null; cp -l ${BASEDIR}/doc/ChangeLog ${DIR}
- git_export; cp -l ${BASEDIR}/${SNAME}-${VERSION}.source.tar.gz ${DIR}
- git_diff >/dev/null && cp -l ${DIFF_NAME} ${DIR}
- cp -l ${BASEDIR}/${IMAGENAME}.* ${DIR}
-cat <<EOF > ${DIR}/.buildinfo
-HOSTNAME=${HOSTNAME}
-ARCH=${TARGET}
-DATE=$(date "+%s")
-DURATION=${DURATION}
-RELEASE=${NAME}-${VERSION}
-ISO=${IMAGENAME}.iso
-EOF
-
- cd $BASEDIR && \
- scp -2 -r ${HOSTNAME} ${IPFIRE_USER}@${URL_TARGET} || :
-
- rm -rf ${BASEDIR}/${HOSTNAME} 2>/dev/null
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-usage() {
- cat doc/make.sh-usage
- exit 1
-}
-
-case "$1" in
-build)
- # check for prerequisites
- check_build
- # check for sanity of code
- check_sanity
- # compile the distro right now
- build
- # beeps when finished
- echo -ne '\a'
- ;;
-
-shell)
- shift
- # enter a shell inside LFS chroot
- # may be used to change kernel settings
- prepareenv
- entershell $@
- ;;
-
-batch)
- # build the distro in background
- case "$2" in
- cron)
- cron_run
- ;;
- start)
- batch_start $3
- ;;
- _run)
- batch_run
- ;;
- attach|watch)
- batch_attach
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-buildspy|bs)
- # control buildspy
- case "$2" in
- start)
- build_spy start
- ;;
- stop)
- build_spy exit
- ;;
- send|profile)
- build_spy start
- build_spy_send_profile
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-ccache)
- # ccache options
- case "$2" in
- stats)
- ccache_stats
- ;;
- esac
- ;;
-
-config)
- # config options
- case "$2" in
- kernel)
- prepareenv
- entershell bash /usr/src/src/scripts/edit-kernel-config
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-clean)
- iceccd_stop
-
- for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do
- umount $i
- done
-
- stdumount
-
- WHAT=${TARGET}
- [ "$2" = "--all" ] && WHAT="${POSSIBLE_TARGETS}"
-
- for i in ${WHAT}; do
- echo -ne "Cleaning ${BOLD}$i${NORMAL} buildtree"
- rm -rf $BASEDIR/build_$i
- rm -rf $BASEDIR/log_$i
- rm -rf $BASEDIR/packages_$i
- beautify message DONE
- done
- echo -ne "Removing ${BOLD}general files${NORMAL}"
- rm -f $FAILED $RUNNING 2>/dev/null
- beautify message DONE
- ;;
-
-source|src)
- LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
- case "$2" in
- get|pull|download)
- getsource
- ;;
- put|push|upload)
- putsource
- ;;
- list)
- pkg_list_packages | tee -a $BASEDIR/doc/packages-list.txt
- ;;
- esac
- ;;
-
-toolchain)
- case "$2" in
- get|pull|download)
- gettoolchain
- ;;
- put|push|upload)
- puttoolchain
- ;;
- ""|-*)
- prepareenv
- # Check if host can build the toolchain
- check_toolchain
-
- toolchain_build
-
- stdumount
- echo -ne "\ntarball creation "
- [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains
- cd $BASEDIR && tar cj --exclude='log_${TARGET}/_build.*.log' \
- --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
- build_${TARGET} log_${TARGET} >> $LOGFILE
- beautify message DONE
- echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2`
-
- stdumount
-
- [ "$2" = "--put" ] && puttoolchain
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-toolchains)
- for i in $(check_supported_targets); do
- TARGET=$i $0 clean
- TARGET=$i $0 toolchain --put
- done
- ;;
-
-target)
- case "$2" in
- put|push|upload)
- puttarget
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-check)
- case "$2" in
- cpu)
- [ -z "$3" ] && usage
- if check_cpu $3; then
- echo -n "CPU has flag $3"
- beautify message DONE
- else
- dialogerror "CPU hasn't got flag $3"
- exit 1
- fi
- ;;
- sanity)
- check_sanity $3
- ;;
- target*)
- check_supported_targets
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-g[iu]t)
- COMMAND=$2
- shift 2
- case "$COMMAND" in
- update|pull)
- git_pull $*
- ;;
- commit|ci)
- git_commit $*
- ;;
- dist|export|archive)
- git_export $*
- ;;
- push)
- git_push $*
- ;;
- diff|di)
- git_diff $*
- ;;
- log)
- git_log $*
- ;;
- gc)
- git_gc
- ;;
- shortlog|slog)
- git_shortlog
- ;;
- put-key)
- ssh_cert $*
- ;;
- *) # If no command matches run git directly
- git $*
- ;;
- esac
- ;;
-
-package*|pkg)
- case "$2" in
- list|show|ls)
- pkg_list_packages
- ;;
- depedencies|deps)
- shift 2
- for pkg in $@; do
- printf "%-26s: %s\n" "${pkg}" "$(pkg_deps_solve ${pkg})"
- done
- ;;
- file*)
- for i in $BASEDIR/lfs/*; do
- pkg_files $i
- done
- ;;
- info)
- shift 2
- pkg_info_shell $@
- ;;
- group*)
- echo "#### All available groups of packages in ${NAME}-${VERSION} ####"
- echo
- for group in $(pkg_list_groups); do
- echo " * ${group}"
- done
- ;;
- raw)
- pkg_info $3
- ;;
- wikigroup*)
- echo "====== All available groups of packages in ${NAME}-${VERSION} ======"
- echo
- pkg_list_groups_wiki
- ;;
- wikiinfo)
- shift 2
- pkg_info_wiki $@
- ;;
- wikilist)
- pkg_list_packages_wiki
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-push)
- putsource
- git_push
- ;;
-
-pull)
- LOGFILE=$BASEDIR/log_${TARGET}/_build.00-preparation.log
- git_pull
- check_sanity
- getsource
- ;;
-
-rootfiles|rf)
- case "$2" in
- check|ch)
- rootfiles_check $3
- ;;
- commit|ci|update|up)
- rootfiles_commit
- ;;
- copy|cp)
- shift 2
- rootfiles_copy $@
- ;;
- fix)
- rootfiles_check --fix
- ;;
- *)
- usage
- ;;
- esac
- ;;
-
-tree)
- shift
- for pkg in $(for i in $BASEDIR/lfs/*; do echo ${i##*/}; done); do
- to_build="${to_build} $(pkg_deps_solve ${pkg}) ${pkg}"
- done
- old_to_build=${to_build}
- to_build=
- for pkg in ${old_to_build}; do
- grep -qw "${pkg}" <<<${to_build} || to_build="${to_build} ${pkg}"
- done
- echo $to_build
- ;;
-
-vm|qemu)
- case "$2" in
- boot|start|run)
- shift 2
- qemu_start $*
- ;;
-
- clean)
- rm -rf $BASEDIR/vm
- ;;
- esac
- ;;
-
-*)
- usage
- ;;
-
-esac
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-# Save packages, that were already compiled in this variable:
-PACKAGES_DONE=
-
-pkg_list_groups() {
- grep ^GROUP $BASEDIR/lfs/* | awk '{ print $3 }' | sort | uniq
-}
-
-pkg_list_groups_wiki() {
- local group
- local package
- for group in $(pkg_list_groups); do
- echo "===== $group ====="
- for package in $BASEDIR/lfs/*; do
- ( eval $(pkg_info ${package})
- if [ -n "$PKG_NAME" ] && [ "$PKG_REL" != "-1" ] && [ "$PKG_GROUP" = "$group" ]; then
- [ -n "$PKG_VERSION" ] && NAME="${PKG_NAME}-${PKG_VERSION}"
- echo " * [[.:package:$(basename $package)|${PKG_NAME}]] - ${PKG_SHORT}"
- fi
- )
- done
- done
-}
-
-pkg_list_packages() {
- echo "#### List of softwares used to build $NAME Version: $VERSION ####"
- local package
- for i in $BASEDIR/lfs/*; do
- [ -L "$i" ] && continue
- package=$(basename $i)
- ( eval $(pkg_info ${package})
- if [ -n "$PKG_NAME" ] && [ "$PKG_REL" != "-1" ]; then
- printf " * %-30s" ${PKG_NAME}-${PKG_VER}
- echo "${PKG_SHORT}"
- fi
- )
- done
-}
-
-pkg_list_packages_wiki() {
- echo "====== List of softwares used to build $NAME Version: $VERSION ======"
- local package
- for i in $BASEDIR/lfs/*; do
- [ -L "$i" ] && continue
- package=$(basename $i)
- ( eval $(pkg_info ${package})
- if [ -n "$PKG_NAME" ] && [ "$PKG_REL" != "-1" ]; then
- [ -n "$PKG_VER" ] && PKG_NAME="${PKG_NAME}-${PKG_VERSION}"
- echo " * [[.:package:$package|${PKG_NAME}]] - ${PKG_SHORT}"
- fi
- )
- done
-}
-
-pkg_info() {
- [ "$1" = "Config" ] && return
- cd $BASEDIR/lfs && $EXTRA_MAKE make -f $1 \
- CONFIG_ROOT=$CONFIG_ROOT \
- LINKER=$LINKER \
- TOOLS_DIR=$TOOLS_DIR \
- MACHINE="$MACHINE" \
- MACHINE_REAL="$MACHINE_REAL" \
- IFS_HOST="$IFS_HOST" \
- IFS_TARGET="$IFS_TARGET" \
- TARGET="$TARGET" \
- LFS_BASEDIR=$BASEDIR \
- LFS=$LFS \
- INSTALLER_DIR=$INSTALLER_DIR \
- PARALLELISMFLAGS=$PARALLELISMFLAGS \
- KVER=$KVER \
- STAGE=$STAGE \
- STAGE_ORDER=$STAGE_ORDER \
- NAME="${NAME}" \
- SNAME="${SNAME}" \
- SLOGAN="${SLOGAN}" \
- VERSION="${VERSION}" \
- info
-}
-
-pkg_info_wiki() {
- ( eval $(pkg_info ${1})
-
- [ "$PKG_NAME" = "" ] && exit
-
- # Output everything in wiki format
- echo "^ $PKG_NAME ^^"
- echo "| **Version:** | $PKG_VER |"
- echo "| **Release:** | $PKG_REL |"
- echo "| **Group:** | $PKG_GROUP |"
- echo "| **License:** | $PKG_LICENSE |"
- echo "| **Maintainer:** | $PKG_MAINTAINER |"
-
- # Dependencies
- echo -n "| **Dependencies:** | "
- for dep in $PKG_DEPS; do
- echo -n "[[$dep]] "
- done; echo "|"
-
- # Build dependencies
- echo -n "| **Build dependencies:** | "
- for dep in $PKG_BUILD_DEPS; do
- echo -n "[[$dep]] "
- done; echo "|"
-
- echo "| $(echo $PKG_DESC) ||"
- echo "| **Website:** | $PKG_URL |"
- if [ "$PKG_DEBUG" = "yes" ]; then
- echo "<color red>This is a debug-package.</color>"
- fi
- if [ "$PKG_EXTRA" = "yes" ]; then
- echo "<color green>This is an extra package.</color>"
- fi
- echo
- for file in $(find $BASEDIR/src/rootfiles -name "$1"); do
- echo "**.${file#$BASEDIR}**"
- for i in $(cat ${file}); do
- echo " $i"
- done
- done
- )
-}
-
-pkg_deps() {
- (
- eval $(pkg_info ${1})
- echo $PKG_DEPS
- )
-}
-
-pkg_build_deps() {
- (
- eval $(pkg_info ${1})
- echo $PKG_BUILD_DEPS
- )
-}
-
-pkg_all_deps() {
- (
- eval $(pkg_info ${1})
- echo $PKG_BUILD_DEPS $PKG_DEPS
- )
-}
-
-pkg_deps_solve() {
- local pkg=${1}
- local dep
- local deps
- local old_deps
-
- for dep in $(pkg_all_deps ${pkg}); do
- deps="$(pkg_deps_solve ${dep}) ${dep} ${deps}"
- done
-
- old_deps=${deps}
- deps=
- for dep in ${old_deps}; do
- grep -qw "${dep}" <<<${deps} || deps="${deps} ${dep}"
- done
- echo ${deps}
-}
-
-pkg_files() {
- (
- eval $(pkg_info ${1})
- for i in $PKG_FILES; do
- echo $i
- done
- )
-}
-
-function pkg_info_shell() {
- format_desc() {
- MAX_LENGTH=38
- INPUT=$@
-
- LINE=""
- LENGTH=0
- for word in $INPUT; do
- LENGTH=$(expr $LENGTH + ${#word})
- if [ "$LENGTH" -ge "$MAX_LENGTH" ]; then
- printf "$LINE\n"
- LINE=" ${word} "
- LENGTH=${#word}
- else
- LINE="$LINE${word} "
- fi
- #echo "-- ($word) $LINE"
- done
- printf "$LINE\n"
- }
- for pkg in $@; do
- (
- eval "$(pkg_info ${pkg})"
- echo "############################################################"
- echo -e "# ${CLR_BOLD_RED}PACKAGE INFO${NORMAL}"
- echo "############################################################"
- for val in PKG_NAME PKG_VER PKG_REL break PKG_GROUP PKG_MAINTAINER break PKG_URL PKG_LICENSE; do
- if [ "${val}" == "break" ]; then
- echo " ---------------------------------------- "
- else
- printf "${CLR_BOLD_RED}%-12s${NORMAL}: ${!val}\n" ${val#PKG_}
- fi
- done
- echo " ---------------------------------------- "
- for val in PKG_DEPS PKG_BUILD_DEPS; do
- printf "${CLR_BOLD_RED}%-12s${NORMAL}: " ${val#PKG_}
- format_desc ${!val}
- done
- echo " ---------------------------------------- "
- for val in PKG_SHORT PKG_DESC; do
- printf "${CLR_BOLD_RED}%-12s${NORMAL}: " ${val#PKG_}
- format_desc ${!val}
- done
- )
- done
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008, 2009 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-for path in \
- $BASEDIR/src/rootfiles/{core,debug,extras}/$TARGET/ \
- $BASEDIR/src/rootfiles/{core,debug,extras}/; do
- [ -d "$path" ] && ROOTFILES_DIR="$ROOTFILES_DIR $path"
-done
-
-rootfiles_check() {
- ACTION=$1
-
- echo -n " Running rootfile checks"
-
- ROOTFILES=$(find $BASEDIR/src/rootfiles/{core,extras,debug}/ -type f)
-
- case "$ACTION" in
- --fix)
- echo -n " and fix"
-
- # Remove leading pluses and replace them by '#'
- for i in $ROOTFILES; do
- [ ! -f $i ] && continue
- sed -e "s/^+/#/g" -i $i
- done
- ;;
- "")
- : # If no option was given we do nothing.
- ;;
- *)
- exiterror "This is not a valid option: $ACTION"
- ;;
- esac
-
- echo -n "..." # End the line
-
- for i in $ROOTFILES; do
- # Leading slashes
- grep -q ^/ $i
- if [ "$?" -eq "0" ]; then
- dialogerror "Please check your rootfile of \"$(basename $i)\" for leading slashes."
- exit 1
- fi
-
- # Leading plusses
- grep -q ^+ $i
- if [ "$?" -eq "0" ]; then
- dialogerror "Please check your rootfile of \"$(basename $i)\" for leading plusses."
- exit 1
- fi
-
- # Empty lines
- grep -q ^$ $i
- if [ "$?" -eq "0" ]; then
- dialogerror "Please check your rootiles of \"$(basename $i)\" for empty lines."
- exit 1
- fi
- done
- beautify message DONE
-}
-
-rootfiles_commit() {
- TEMPFILE=$(mktemp)
- echo "Rootfile update." > $TEMPFILE
- git_commit -F $TEMPFILE src/rootfiles
- rm -f $TEMPFILE
-}
-
-rootfiles_copy() {
- for i in $@; do
- ( ROOTFILE=$(rootfiles_findone $i)
- if [ "$ROOTFILE" = "" ]; then
- dialogerror "Rootfile of \"$i\" not found. Create it first."
- return 1
- fi
- eval $(pkg_info $i)
- for j in $PKG_NAME{-$PKG_VER,} \
- $(sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/g' <<< $PKG_NAME){,$PKG_VER}; do
- LOGFILE=$(find $BASEDIR/log_$TARGET/ -type f -name $j ! -name *_old)
- [ -n "$LOGFILE" ] && break
- done
- if [ -z "$LOGFILE" ]; then
- dialogerror "No rootfile of \"$i\" in $LOG_DIR."
- return 1
- fi
- echo -n "Copying rootfile from \"$(basename $LOGFILE)\" to $ROOTFILE."
- cp -f $LOGFILE $ROOTFILE
- if [ "$?" -eq "0" ]; then
- beautify message DONE
- else
- beautify message FAIL
- fi
- ) || break
- done
-}
-
-rootfiles_findone() {
- echo $(find $ROOTFILES_DIR -maxdepth 1 -type f ! -name *_changed \
- ! -name *_no_rootfile -name $1 | head -n 1)
-}
-
-rootfiles_find() {
- for i in $@; do
- rootfiles_findone $i
- done
-}
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# #
-# IPFire.org - A linux based firewall #
-# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
-# #
-# This program 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 3 of the License, or #
-# (at your option) any later version. #
-# #
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-qemu_start() {
- # Check if we have a qemu binary
- if ! which qemu &>/dev/null; then
- dialogerror "Cannot find qemu."
- exit 1
- fi
-
- # Check if the working directory is present
- [ -d "$BASEDIR/vm" ] || mkdir $BASEDIR/vm
- QEMU_DISK=$BASEDIR/vm/qemu-hda-$HOSTNAME.img
-
- # Create a qemu disk if not present (4G)
- [ -e $QEMU_DISK ] || qemu-img create $QEMU_DISK 4G
-
- # Prepare qemu command
- QEMU_COMMAND="qemu -name $NAME-$VERSION -m 256"
- QEMU_COMMAND="$QEMU_COMMAND -k de -localtime -usb"
- QEMU_COMMAND="$QEMU_COMMAND -no-reboot -vnc :2 -hda $QEMU_DISK"
-
- case "$1" in
- ""|cd*)
- QEMU_COMMAND="$QEMU_COMMAND -boot d -cdrom"
- if [ -n "$2" ]; then
- QEMU_COMMAND="$QEMU_COMMAND $2"
- else
- QEMU_COMMAND="$QEMU_COMMAND $BASEDIR/$IMAGENAME.iso"
- fi
- ;;
- disk|hd*)
- QEMU_COMMAND="$QEMU_COMMAND -boot c"
- ;;
- esac
-
- echo -e "We are going to run a ${BOLD}virtual machine${NORMAL}, now."
- echo
- echo "You may connect to this machine with a vnc viewer to $HOSTNAME:2."
- echo "Kill this vm by pressing Ctrl+C."
- echo
- $QEMU_COMMAND
- if [ $? -eq 0 ]; then
- echo -n "The virtual machine quit gracefully."
- beautify message DONE
- else
- echo -n "The virtual machine quit with an error!"
- beautify message FAIL
- fi
-}
+++ /dev/null
-#!/bin/bash
-
-BASEDIR=/ipfire-3.x
-
-. /ipfire-3.x/tools/naoki-include
-
-# Read in global configuration
-
-
-# CLI
-
-function usage() {
- cat <<EOF
-$0 - Usage:
- Blaaah
-
-EOF
-}
-
-while [ $# -gt 0 ]; do
- case "${1}" in
- --debug|-d)
- DEBUG=1
- log INFO "Debugging is enabled."
- ;;
-
- --force|-f)
- FORCE=1
- log INFO "Force is enabled."
- ;;
-
- --help|-h)
- usage
- exit 0
- ;;
-
- --toolchain)
- log INFO "Toolchain option is enabled."
- TOOLCHAIN=1
- ;;
-
- *)
- if [ -z "${ACTION}" ]; then
- ACTION=${1}
- elif [ -z "${PKG_NAME}" ] && is_package ${1}; then
- PKG_NAME=$(find_package ${1})
- else
- error "Unrecognized option: ${1}."
- exit 2
- fi
- esac
- shift
-done
-
-#if [ -z "${PKG_NAME}" ]; then
-# usage
-# error "You must provide a valid package name."
-# exit 2
-#fi
-
-# Read in package metadata
-log DEBUG "Pakckage: ${PKG_NAME}..."
-log DEBUG "Action : ${ACTION}..."
-log DEBUG "CLI : $@"
-
-## Init environment
-#BUILD_DIR=${BASEDIR}/build_$(package_id)
-
-#if [ -d "${BUILD_DIR}" ]; then
-# if force; then
-# warning "An old build directory is still there. Cleaning up."
-# naoki_cleanup
-# else
-# error "An old build directory is still there."
-# error " Run with --force or remove manually."
-# exit 1
-# fi
-#fi
-
-# Run
-case "${ACTION}" in
- init)
- naoki_init ${PKG_NAME} $@
- ;;
-
- destroy|cleanup)
- naoki_cleanup ${PKG_NAME} $@
- ;;
-
- build)
- if [ "${TOOLCHAIN}" = "1" ]; then
- naoki_toolchain ${PKG_NAME}
- exit $?
- else
- naoki_build ${PKG_NAME}
- exit $?
- fi
- ;;
-
- dependencies|deps)
- package_toolchain_dependencies ${PKG_NAME}
- package_toolchain_dependencies_recursive ${PKG_NAME}
- package_runtime_dependencies ${PKG_NAME}
- package_runtime_dependencies_recursive ${PKG_NAME}
- package_build_dependencies ${PKG_NAME}
- package_build_dependencies_recursive ${PKG_NAME}
- ;;
-
- profile)
- package_profile ${PKG_NAME}
- ;;
-
- raw|info)
- package_info ${PKG_NAME}
- ;;
-
- shell)
- naoki_shell ${PKG_NAME}
- ;;
-
- list)
- for package in $(package_list); do
- printf "%-30s %-15s %1s\n" \
- "${package}" \
- "$(package_version ${package})-$(package_release ${package})" \
- $(package_is_built ${package} && echo "Y" || echo "N")
- done
- ;;
-
- tree)
- package_tree $(package_list)
- ;;
-
- *)
- error "You must provide an action."
- exit 2
- ;;
-
-esac
+++ /dev/null
-#!/bin/bash
-
-BUILD_DIR="${BASEDIR}/build/naoki_$(date +"%d%m-%H%M").$$.${MACHINE}"
-BUILD_ROOT="/buildroot.$$"
-TOOLS_DIR=/tools_${MACHINE}
-TOOLS_DIR_REAL=${BASEDIR}/build/tools_${MACHINE}
-
-ARCH=i686
-
-PACKAGES_MANDATORY="bash bzip2 coreutils cpio diffutils findutils gawk gcc grep"
-PACKAGES_MANDATORY="${PACKAGES_MANDATORY} gzip make patch sed tar util-linux-ng"
-PACKAGES_MANDATORY="${PACKAGES_MANDATORY} which"
-
-PACKAGES_PARALLELISM=2
-PARALLELISMFLAGS=-j5
-
-CFLAGS="-fomit-frame-pointer -pipe"
-case "${ARCH}" in
- i?86)
- CFLAGS="-O2 -march=${ARCH} ${CFLAGS}"
- CXXFLAGS="${CFLAGS}"
- TARGET="${ARCH}-pc-linux-gnu"
- ;;
-esac
-
-log INFO "Machine information:"
-log INFO " Hostname : ${HOSTNAME}"
-log INFO " Architecture : ${MACHINE}"
-
-log INFO "Target information:"
-log INFO " Architecture : ${ARCH}"
-log INFO " CFLAGS : ${CFLAGS}"
-log INFO " CXXFLAGS : ${CXXFLAGS}"
-log INFO " TARGET : ${TARGET}"
-log INFO " Parallelism : ${PARALLELISMFLAGS}"
+++ /dev/null
-#!/bin/bash
-
-LOGFILE=${BASEDIR}/naoki.log
-
-function exithandler() {
- local mount
- local mounts
-
- log DEBUG "Unmounting everything in ${BUILD_DIR}..."
- while true; do
- mounts=$(mount | grep "${BUILD_DIR}")
- if [ -z "${mounts}" ]; then
- log DEBUG " Everything is unmounted."
- break
- fi
-
- while read mount; do
- umount $(awk '{ print $3 }' <<<${mount})
- done <<<"${mounts}"
- done
-
- if [ ! -e "${BUILD_DIR}/.failed" ]; then
- rm -rf ${BUILD_DIR}
- fi
-
- log DEBUG "Shut down naoki instance with pid $$."
- log DEBUG "----------"
-}
-trap exithandler EXIT
-
-function debug() {
- [ "${DEBUG}" = "1" ]
-}
-
-function force() {
- [ "${FORCE}" = "1" ]
-}
-
-function naoki_lock() {
- local lockfile="${BUILD_DIR}/.lock"
-
- case "${1}" in
- 1)
- touch ${lockfile}
- ;;
- 0)
- rm -f ${lockfile}
- ;;
- *)
- if [ -e "${lockfile}" ]; then
- return 0
- else
- return 1
- fi
- ;;
- esac
-}
-
-function naoki_prepare() {
- local p=$(find_package ${1})
- shift
-
- msg "Preparing environment ${BUILD_DIR}..."
-
- # Download package's object files
- package_download ${p}
- [ $? -ne 0 ] && return 1
-
- mkdir -p ${BUILD_DIR}/usr/src
-
- if [ "${TOOLCHAIN}" = "1" ]; then
- ## Creating /tools_xxx
- # if dir points to wrong direction, we will remove it.
- if [ "$(readlink ${TOOLS_DIR})" != "${TOOLS_DIR_REAL}" ]; then
- rm -f ${TOOLS_DIR}
- fi
- mkdir ${TOOLS_DIR_REAL} 2>/dev/null
- if [ ! -h "${TOOLS_DIR}" ]; then
- ln -fs ${TOOLS_DIR_REAL} ${TOOLS_DIR}
- fi
-
- else
- mkdir -p \
- ${BUILD_DIR}/{boot,etc,root,tmp} \
- ${BUILD_DIR}/{dev,proc,sys} \
- ${BUILD_DIR}/{,usr/}{bin,lib,sbin} \
- ${BUILD_DIR}/${BUILD_ROOT} \
- ${BUILD_DIR}/${TOOLS_DIR}
-
- touch ${BUILD_DIR}/etc/{fstab,mtab}
-
- # Configure dns resolving
- cp -f /etc/resolv.conf /etc/hosts ${BUILD_DIR}/etc/
-
- grep ^root /etc/passwd > ${BUILD_DIR}/etc/passwd
- grep ^root /etc/group > ${BUILD_DIR}/etc/group
-
- local i
- for i in cache ccache pkgs src tools ${DIR_PACKAGES}; do
- if [ "${i:0:1}" != "/" ]; then
- i="${BASEDIR}/${i}"
- fi
- mkdir -p ${i} ${BUILD_DIR}/usr/src/${i##*/} 2>/dev/null
- mount --bind ${i} ${BUILD_DIR}/usr/src/${i##*/}
- done
- mount --bind ${TOOLS_DIR_REAL} ${BUILD_DIR}/${TOOLS_DIR}/
-
- # Mounting kernel fs
- ## Maybe, it is not the best way to mount-bind the whole dev...
- for i in dev proc sys; do
- mount --bind /${i} ${BUILD_DIR}/${i}
- done
-
- # Extract needed packages
- local pkg_dependencies=$(package_dependencies_recursive ${p})
- msg " Resolving recursive dependencies: ${pkg_dependencies-None}"
- local dep
- local missing
- for dep in ${pkg_dependencies}; do
- if ! package_is_built ${dep}; then
- missing="${missing} ${dep}"
- fi
- done
- if [ -n "${missing}" ]; then
- msg "Dependencies for ${p} are missing: ${missing}"
- return 4
- fi
-
- for dep in $(listsort ${pkg_dependencies} $(package_mandatory)); do
- package_decompress ${dep}
- done
-
- for i in /bin/bash /bin/echo /bin/pwd /bin/sh; do
- if [ -e "${BUILD_DIR}${i}" ]; then
- continue
- fi
- if [ ! -e "${TOOLS_DIR}${i}" ]; then
- log WARNING "Cannot create symlink ${i}: ${TOOLS_DIR}${i} - No such file or directory."
- fi
- log DEBUG "Creating symlink: ${BUILD_DIR}${i} --> ${TOOLS_DIR}${i}"
- ln -sf ${TOOLS_DIR}${i} ${BUILD_DIR}${i}
- done
- fi
-
- return 0
-}
-
-function naoki_cleanup() {
- local p=$(find_package ${1})
-
- log INFO "Cleaning up environment ${BUILD_DIR}..."
-
- if naoki_lock; then
- error "Cannot remove locked ${BUILD_DIR}..."
- return 1
- fi
-
- #rm -rf ${BUILD_DIR}
-}
-
-function naoki_cmd() {
- local package
- local chroot_cmd
- local cmd
- local with_chroot=1
-
- while [ $# -gt 0 ]; do
- case "${1}" in
- --without-chroot)
- with_chroot=0
- ;;
- *)
- if [ -z "${package}" ]; then
- package=$(find_package ${1})
- else
- cmd="${cmd} ${1}"
- fi
- ;;
- esac
- shift
- done
- cmd=${cmd:1}
-
- is_package ${package} || return 1
-
- log DEBUG "Running command \"${cmd}\" - chroot=${with_chroot}."
-
- local path="/sbin:/usr/sbin:/bin:/usr/bin"
- local toolchain_path="${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin"
- if [ "${TOOLCHAIN}" = "1" ]; then
- path="${toolchain_path}:${path}"
- else
- path="${path}:${toolchain_path}"
- fi
-
- # ccache
- if [ -x "${BUILD_DIR}/usr/bin/ccache" ]; then
- path="/usr/ccache/bin:${path}"
- fi
-
- log DEBUG " PATH : ${path}"
-
- local pkgroot=${DIR_PKGS}
- local ps1="\u:\w\$ "
-
- if [ "${with_chroot}" = "1" ]; then
- chroot_cmd="chroot ${BUILD_DIR}"
- pkgroot="/usr/src/pkgs"
- ps1="${CLR_NORM_RED}chroot${NORMAL}: \w\$ "
-
- touch ${BUILD_DIR}/.chroot
- fi
-
- local ret
- PATH=${path} \
- ${chroot_cmd} \
- env -i \
- HOME="/root" \
- TERM="${TERM}" \
- PS1="${ps1}" \
- PATH="${path}" \
- \
- DISTRO_NAME="${DISTRO_NAME}" \
- DISTRO_SNAME="${DISTRO_SNAME}" \
- DISTRO_VERSION="${DISTRO_VERSION}" \
- DISTRO_EPOCH="${DISTRO_EPOCH}" \
- DISTRO_SLOGAN="${DISTRO_SLOGAN}" \
- \
- BASEDIR="${BASEDIR}" \
- ROOT=$([ "${TOOLCHAIN}" = "1" ] && \
- echo "${BUILD_DIR}") \
- CHROOT="${with_chroot}" \
- TOOLS_DIR="${TOOLS_DIR}" \
- TOOLCHAIN="${TOOLCHAIN}" \
- BUILDROOT="${BUILD_ROOT}" \
- PKGROOT="${pkgroot}" \
- \
- CFLAGS="${CFLAGS}" \
- CXXFLAGS="${CXXFLAGS}" \
- TARGET="${TARGET}" \
- TARGET_MACHINE="${MACHINE}" \
- PARALLELISMFLAGS="${PARALLELISMFLAGS}" \
- \
- CCACHE_DIR=$([ "${TOOLCHAIN}" = "1" ] && \
- echo "${BASEDIR}/ccache" || \
- echo "/usr/src/ccache") \
- \
- ${cmd}
-
- ret=$?
- log DEBUG " Exit code: ${ret}"
-
- return ${ret}
-}
-
-function naoki_make() {
- local p=${1}
- shift
-
- local cmd="make --no-print-directory -C"
- if [ "${CHROOT}" = "0" ] || [ "${TOOLCHAIN}" = "1" ]; then
- cmd="${cmd} ${DIR_PKGS}/${p}"
- else
- cmd="${cmd} /usr/src/pkgs/${p}"
- fi
- cmd="${cmd} -f ${p##*/}.nm"
-
- naoki_cmd ${p} "${cmd}" $@
- return ${PIPESTATUS[0]}
-}
-
-function naoki_build() {
- local p=$(find_package ${1})
- shift
-
- local ret
- msg "Going on to build package \"${p}\"."
-
- naoki_prepare ${p} $@
- ret=$?
-
- if [ "${ret}" != "0" ]; then
- error "Prepare command failed."
- exit ${ret}
- fi
-
- naoki_make ${p} package $@
- ret=$?
-
- if [ "${ret}" != "0" ]; then
- error "Package build failed."
- touch ${BUILD_DIR}/.failed
- exit ${ret}
- fi
-}
-
-function naoki_build_tree() {
- local packages
- local p
-
- package_tree $@ | \
- while read packages; do
- for p in ${packages}; do
- naoki_build ${p}
- done
- done
-}
-
-function naoki_shell() {
- local p=$(find_package ${1})
- shift
-
- naoki_prepare ${p}
- naoki_make ${p} shell
-
- # A little help message
- echo
- echo -e " ${CLR_NORM_RED}Chroot environment${NORMAL}"
- echo
- echo " This is starting a chrooted environment where you can natively"
- echo " access the build system. When you leave the shell all files will"
- echo " be lost."
- echo
- echo " Source of ${PKG_NAME} is extracted to /usr/src."
- echo
- echo -e " ${BOLD}Exit with Ctrl+D.${NORMAL}"
- echo
-
- naoki_cmd ${p} "bash --login"
- local ret=$?
-
- echo
- echo "Exit code: ${ret}"
- echo
-}
-
-function naoki_toolchain() {
- TOOLCHAIN=1
-
- local p=$(find_package ${1})
- shift
-
- naoki_build ${p} --without-chroot $@
-}
+++ /dev/null
-#!/bin/bash
-
-if [ -z "${BASEDIR}" ]; then
- echo "${0##*/}: ERROR: BASEDIR is not set." >&2
- exit 1
-fi
-
-export NAOKI_INCLUDE=1
-
-. ${BASEDIR}/tools/common-include
-
-. ${BASEDIR}/tools/naoki-constants
-. ${BASEDIR}/tools/naoki-functions
-
-log DEBUG "Started up naoki instance with pid $$"
-
-# Build cache
-export __PACKAGE_LIST=$(package_list)
for file in ${DIR_QA}/*; do
[ -x "${file}" ] || continue
-
+
${file} || exit $?
done
--- /dev/null
+../common-functions
\ No newline at end of file
exit 1
fi
-get_interpreter() {
- local file=${1}
-
- readelf -l ${file} | grep "program interpreter" | \
- tr -d "]" | awk '{ print $NF }'
-}
+# Include additional functions
+. $(dirname ${0})/qa-functions
+++ /dev/null
-#!/usr/bin/python
-
-import sys
-import socket
-
-print socket.gethostbyname(sys.argv[1])
+++ /dev/null
-#!/usr/bin/python
-
-import os
-import smtplib
-
-from email.MIMEMultipart import MIMEMultipart
-from email.MIMEText import MIMEText
-#from email.MIMEImage import MIMEImage
-
-try:
- server = "%s" % os.environ["MAIL_SERVER"]
-except KeyError:
- server = "mail01.tremer.info"
-
-try:
- toaddrs = "%s" % os.environ["MAIL_TO"]
-except KeyError:
- toaddrs = "developers@ipfire.org"
-
-try:
- fromaddr = "%s" % os.environ["MAIL_FROM"]
-except KeyError:
- fromaddr = "build@ipfire.org"
-
-try:
- subject = "%s" % os.environ["MAIL_SUBJECT"]
-except KeyError:
- subject = "No subject given"
-
-auth=True
-try:
- user = os.environ["MAIL_USER"]
- password = os.environ["MAIL_PASS"]
-except KeyError:
- auth=False
-
-text = ""
-while 1:
- try:
- line = raw_input()
- except EOFError:
- break
- text += line + "\r\n"
-
-# Create message
-msg = MIMEMultipart('related')
-msg['Subject'] = subject
-msg['From'] = fromaddr
-msg['To'] = toaddrs
-msg.preamble = 'This is a multi-part message in MIME format.'
-
-msg.attach(MIMEText(text, 'html'))
-
-server = smtplib.SMTP(server)
-#server.set_debuglevel(1)
-if auth:
- server.login(user, password)
-
-server.sendmail(fromaddr, toaddrs.split(", "), msg.as_string())
-server.quit()
+++ /dev/null
-#! /usr/bin/python
-
-import os
-import sys
-from select import select
-
-targets = [sys.stdout]
-for filename in sys.argv[1:]:
- f = open(filename, "w")
- targets.append(f)
-
-targetfds = []
-for f in targets:
- targetfds.append(f.fileno())
-
-src = sys.stdin.fileno()
-while 1:
- (r, w, x) = select([src],[],[])
- str = os.read(src,1)
- if str == '':
- break
-
- for fd in targetfds:
- os.write(fd, str)
-
-for f in targets:
- f.close()