summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2014-08-25 05:10:17 +0200
committerDaniel Baumann <mail@daniel-baumann.ch>2014-08-25 06:12:56 +0200
commita3e93f9c5773cd4517dc5a823c67eb72ae91fa81 (patch)
tree9685179641869f3a0248749bec142a18385b73ce
parent1fe3b72c636cbd95da764e4950f56021693f8d03 (diff)
downloadvyos-live-build-a3e93f9c5773cd4517dc5a823c67eb72ae91fa81.tar.gz
vyos-live-build-a3e93f9c5773cd4517dc5a823c67eb72ae91fa81.zip
Writing configuration out to config/build.conf in init component and getting rid of intermediate configuration file by using only new build.conf file.
-rwxr-xr-xcomponents/bootstrap-cdebootstrap16
-rwxr-xr-xcomponents/bootstrap-debootstrap20
-rwxr-xr-xcomponents/init108
-rwxr-xr-xscripts/build/config62
4 files changed, 121 insertions, 85 deletions
diff --git a/components/bootstrap-cdebootstrap b/components/bootstrap-cdebootstrap
index 59c83c8df..1fe27ae5e 100755
--- a/components/bootstrap-cdebootstrap
+++ b/components/bootstrap-cdebootstrap
@@ -42,22 +42,22 @@ def main():
args = arguments.parse_args()
## Parsing Configuration
- if not os.path.isfile('config/build'):
- print('E: config/build - no such file', file=sys.stderr)
+ if not os.path.isfile('config/build.conf'):
+ print('E: config/build.conf - no such file', file=sys.stderr)
sys.exit(1)
config = configparser.ConfigParser()
- config.read('config/build')
+ config.read('config/build.conf')
try:
- architecture = config.get('Image', 'Architecture')
- distribution = config.get('Image', 'Parent-Distribution')
- mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap')
+ architecture = config.get('build', 'Architecture')
+ distribution = config.get('build', 'Parent-Distribution')
+ mirror_bootstrap = config.get('build', 'Parent-Mirror-Bootstrap')
except:
- distribution = config.get('Image', 'Distribution')
- mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap')
+ distribution = config.get('build', 'Distribution')
+ mirror_bootstrap = config.get('build', 'Mirror-Bootstrap')
# --verbose
verbose = args.verbose
diff --git a/components/bootstrap-debootstrap b/components/bootstrap-debootstrap
index 70974be6e..01df273e1 100755
--- a/components/bootstrap-debootstrap
+++ b/components/bootstrap-debootstrap
@@ -42,24 +42,24 @@ def main():
args = arguments.parse_args()
## Parsing Configuration
- if not os.path.isfile('config/build'):
- print('E: config/build - no such file', file=sys.stderr)
+ if not os.path.isfile('config/build.conf'):
+ print('E: config/build.conf - no such file', file=sys.stderr)
sys.exit(1)
config = configparser.ConfigParser()
- config.read('config/build')
+ config.read('config/build.conf')
try:
- architecture = config.get('Image', 'Architecture')
- archive_areas = config.get('Image', 'Parent-Archive-Areas')
- distribution = config.get('Image', 'Parent-Distribution')
- mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap')
+ architecture = config.get('build', 'Architecture')
+ archive_areas = config.get('build', 'Parent-Archive-Areas')
+ distribution = config.get('build', 'Parent-Distribution')
+ mirror_bootstrap = config.get('build', 'Parent-Mirror-Bootstrap')
except:
- archive_areas = config.get('Image', 'Archive-Areas')
- distribution = config.get('Image', 'Distribution')
- mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap')
+ archive_areas = config.get('build', 'Archive-Areas')
+ distribution = config.get('build', 'Distribution')
+ mirror_bootstrap = config.get('build', 'Mirror-Bootstrap')
# --verbose
verbose = args.verbose
diff --git a/components/init b/components/init
index 89da3e11e..969cc1694 100755
--- a/components/init
+++ b/components/init
@@ -12,6 +12,7 @@ import argparse
import configparser
import glob
import os
+import platform
import shutil
import subprocess
import sys
@@ -24,6 +25,12 @@ import urllib.request
# * use gettext for i18n
def main():
+ ## early defaults detection
+ architecture = platform.machine()
+
+ if (architecture == 'x86_64'):
+ architecture = 'amd64'
+
## Parsing Arguments
arguments = argparse.ArgumentParser(
prog = 'lb init',
@@ -34,27 +41,54 @@ def main():
formatter_class = argparse.ArgumentDefaultsHelpFormatter
)
- arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4')
- arguments.add_argument('--verbose', help='set verbose option', action='store_true')
+ arguments.add_argument('--version', help='show program\'s version number and exit', action='version', version='live-build 4')
+ arguments.add_argument('--verbose', help='set verbose option', action='store_true')
+
+ arguments.add_argument('--project', help='set project defaults', default='debian')
+ arguments.add_argument('--system', help='set system type', default='live')
+ arguments.add_argument('--architecture', help='set system architecture', default=architecture)
+
+ arguments.add_argument('--archive-areas', help='set default archive areas', default='main')
+ arguments.add_argument('--parent-archive-areas', help='set default parent archive areas', default='main')
+
+ arguments.add_argument('--distribution', help='set default distribution', default='jessie')
+ arguments.add_argument('--parent-distribution', help='set default parent distribution', default='jessie')
- arguments.add_argument('--distribution', help='set default distribution', default='jessie')
- arguments.add_argument('--project', help='set project defaults', default='debian')
- arguments.add_argument('--system', help='set system type', default='live')
+ arguments.add_argument('--mirror-bootstrap', help='set default bootstrap mirror', default='http://ftp.debian.org/debian')
+ arguments.add_argument('--parent-mirror-bootstrap', help='set default parent bootstrap mirror', default='http://ftp.debian.org/debian')
args = arguments.parse_args()
# --verbose
verbose = args.verbose
- # --distribution
- distribution = args.distribution
-
# --project
project = args.project
# --system
system = args.system
+ # --architecture
+ architecture = args.architecture
+
+ # --archive-areas
+ archive_areas = args.archive_areas
+
+ # --parent-archive-areas
+ parent_archive_areas = args.parent_archive_areas
+
+ # --distribution
+ distribution = args.distribution
+
+ # --parent-distribution
+ parent_distribution = args.parent_distribution
+
+ # --mirror-bootstrap
+ mirror_bootstrap = args.mirror_bootstrap
+
+ # --parent-mirror-bootstrap
+ parent_mirror_bootstrap = args.parent_mirror_bootstrap
+
## Setting defaults
if not system:
@@ -72,6 +106,31 @@ def main():
distribution = default_distribution[project]
+ ## Setting derivative defaults
+ if (project == 'progress-linux'):
+ # parent-distribution
+ if(distribution == 'artax'):
+ parent_distribution = 'squeeze'
+ if(distribution == 'artax-backports'):
+ parent_distribution = 'squeeze'
+ if(distribution == 'baureo'):
+ parent_distribution = 'wheezy'
+ if(distribution == 'baureo-backports'):
+ parent_distribution = 'wheezy'
+ if(distribution == 'cairon'):
+ parent_distribution = 'jessie'
+ if(distribution == 'cairon-backports'):
+ parent_distribution = 'jessie'
+ else:
+ # parent-architecture
+ parent_architecture = architecture
+
+ # parent-distribution
+ parent_distribution = distribution
+
+ # parent-mirror-bootstrap
+ parent_mirror_bootstrap = mirror_bootstrap
+
## Creating configuration directory
# stagefile
@@ -94,6 +153,39 @@ def main():
print('Make sure you are using the newest version at all times.')
+ ## Writing main configuration file
+
+ os.makedirs('config', exist_ok=True)
+
+ config = configparser.ConfigParser()
+
+ configfile = open("config/build.conf", 'w')
+
+ config.add_section('build')
+
+ config.set('build','Architecture', architecture)
+
+ config.set('build','Archive-Areas', archive_areas)
+ config.set('build','Parent-Archive-Areas', parent_archive_areas)
+
+ config.set('build','Distribution', distribution)
+ config.set('build','Parent-Distribution', parent_distribution)
+
+ config.set('build','Mirror-Bootstrap', mirror_bootstrap)
+ config.set('build','Parent-Mirror-Bootstrap', parent_mirror_bootstrap)
+
+ config.set('build','Project', project)
+ config.set('build','System', system)
+
+ config.add_section('meta')
+
+ config.set('meta','Version', '4.0')
+
+ config.write(configfile)
+ configfile.close()
+
+ ## Populating configuration directory
+
# Configuring default archive-keys
if (project == 'progress-linux'):
# dependencies
diff --git a/scripts/build/config b/scripts/build/config
index e3ae1410d..c666765a0 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -26,7 +26,6 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--apt-recommends true|false]\n\
\t [--apt-secure true|false]\n\
\t [--apt-source-archives true|false]\n\
-\t [-a|--architectures ARCHITECTURE]\n\
\t [-b|--binary-images iso|iso-hybrid|netboot|tar|hdd]\n\
\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\
\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\
@@ -104,8 +103,6 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--net-cow-server IP|HOSTNAME]\n\
\t [--net-tarball true|false]\n\
\t [--quiet]\n\
-\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
-\t [--parent-archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
\t [--security true|false]\n\
\t [--source true|false]\n\
\t [-s|--source-images iso|netboot|tar|hdd]\n\
@@ -131,12 +128,12 @@ Local_arguments ()
apt-pipeline:,apt-recommends:,apt-secure:,apt-source-archives:,bootstrap:,cache:,cache-indices:,cache-packages:,
cache-stages:,debconf-frontend:,debconf-priority:,dump,
initramfs:,initramfs-compression:,initsystem:,fdisk:,losetup:,mode:,system:,tasksel:,
- templates:,architectures:,clean,
- distribution:,parent-distribution:,parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-binary:,
+ templates:,clean,
+ parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-binary:,
parent-mirror-binary-security:,parent-mirror-debian-installer:,
mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:,
mirror-binary-security:,mirror-debian-installer:,
- archive-areas:,parent-archive-areas:,chroot-filesystem:,
+ chroot-filesystem:,
gzip-options:,image-name:,interactive:,keyring-packages:,linux-flavours:,linux-packages:,
security:,updates:,backports:,binary-filesystem:,binary-images:,
apt-indices:,bootappend-install:,bootappend-live:,bootappend-live-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:,
@@ -346,21 +343,6 @@ Local_arguments ()
;;
# config/bootstrap
- -a|--architectures)
- LIVE_IMAGE_ARCHITECTURE="${2}"
- shift 2
- ;;
-
- -d|--distribution)
- LB_DISTRIBUTION="${2}"
- shift 2
- ;;
-
- --parent-distribution)
- LB_PARENT_DISTRIBUTION="${2}"
- shift 2
- ;;
-
-m|--parent-mirror-bootstrap)
LB_PARENT_MIRROR_BOOTSTRAP="${2}"
shift 2
@@ -421,16 +403,6 @@ Local_arguments ()
shift 2
;;
- --archive-areas)
- LIVE_IMAGE_ARCHIVE_AREAS="${2}"
- shift 2
- ;;
-
- --parent-archive-areas)
- LIVE_IMAGE_PARENT_ARCHIVE_AREAS="${2}"
- shift 2
- ;;
-
# config/chroot
--chroot-filesystem)
LB_CHROOT_FILESYSTEM="${2}"
@@ -1338,33 +1310,5 @@ then
rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true
fi
-cat > config/build << EOF
-[Image]
-Architecture: ${LIVE_IMAGE_ARCHITECTURE}
-Archive-Areas: ${LIVE_IMAGE_ARCHIVE_AREAS}
-Distribution: ${LB_DISTRIBUTION}
-Mirror-Bootstrap: ${LB_MIRROR_BOOTSTRAP}
-EOF
-
-if [ "${LB_DERIVATIVE}" = "true" ]
-then
-
-cat >> config/build << EOF
-
-Parent-Archive-Areas: ${LIVE_IMAGE_ARCHIVE_AREAS}
-Parent-Distribution: ${LB_PARENT_DISTRIBUTION}
-Parent-Mirror-Bootstrap: ${LB_PARENT_MIRROR_BOOTSTRAP}
-EOF
-
-fi
-
-cat >> config/build << EOF
-
-[FIXME]
-Configuration-Version: ${LIVE_CONFIGURATION_VERSION}
-Name: ${LIVE_IMAGE_NAME}
-Type: ${LIVE_IMAGE_TYPE}
-EOF
-
# Creating stage file
Create_stagefile .build/config