forked from ungleich-public/cdist
Implement preos and triggering
This commit is contained in:
parent
afa00a9094
commit
11974e5ed6
101 changed files with 10570 additions and 4 deletions
|
@ -5,10 +5,12 @@ import logging
|
|||
import collections
|
||||
import functools
|
||||
import cdist.configuration
|
||||
import cdist.trigger
|
||||
import cdist.preos
|
||||
|
||||
|
||||
# set of beta sub-commands
|
||||
BETA_COMMANDS = set(('install', 'inventory', ))
|
||||
BETA_COMMANDS = set(('install', 'inventory', 'preos', 'trigger', ))
|
||||
# set of beta arguments for sub-commands
|
||||
BETA_ARGS = {
|
||||
'config': set(('tag', 'all_tagged_hosts', 'use_archiving', )),
|
||||
|
@ -422,6 +424,9 @@ def get_parsers():
|
|||
parser['inventory'].set_defaults(
|
||||
func=cdist.inventory.Inventory.commandline)
|
||||
|
||||
# PreOs
|
||||
parser['preos'] = parser['sub'].add_parser('preos', add_help=False)
|
||||
|
||||
# Shell
|
||||
parser['shell'] = parser['sub'].add_parser(
|
||||
'shell', parents=[parser['loglevel']])
|
||||
|
@ -431,6 +436,27 @@ def get_parsers():
|
|||
' should be POSIX compatible shell.'))
|
||||
parser['shell'].set_defaults(func=cdist.shell.Shell.commandline)
|
||||
|
||||
# Trigger
|
||||
parser['trigger'] = parser['sub'].add_parser(
|
||||
'trigger', parents=[parser['loglevel'],
|
||||
parser['beta'],
|
||||
parser['config_main']])
|
||||
parser['trigger'].add_argument(
|
||||
'-6', '--ipv6', default=False,
|
||||
help=('Listen to both IPv4 and IPv6 (instead of only IPv4)'),
|
||||
action='store_true')
|
||||
parser['trigger'].add_argument(
|
||||
'-D', '--directory', action='store', required=False,
|
||||
help=('Where to create local files'))
|
||||
parser['trigger'].add_argument(
|
||||
'-H', '--http-port', action='store', default=3000, required=False,
|
||||
help=('Create trigger listener via http on specified port'))
|
||||
parser['trigger'].add_argument(
|
||||
'-S', '--source', action='store', required=False,
|
||||
help=('Which file to copy for creation'))
|
||||
|
||||
parser['trigger'].set_defaults(func=cdist.trigger.Trigger.commandline)
|
||||
|
||||
for p in parser:
|
||||
parser[p].epilog = EPILOG
|
||||
|
||||
|
|
12
cdist/conf/type/__cdist_preos_trigger/gencode-remote
Normal file
12
cdist/conf/type/__cdist_preos_trigger/gencode-remote
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
os=$(cat "$__global/explorer/os")
|
||||
|
||||
case "$os" in
|
||||
devuan)
|
||||
echo "update-rc.d cdist-preos-trigger defaults > /dev/null"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
45
cdist/conf/type/__cdist_preos_trigger/man.rst
Normal file
45
cdist/conf/type/__cdist_preos_trigger/man.rst
Normal file
|
@ -0,0 +1,45 @@
|
|||
cdist-type__cdist_preos_trigger(7)
|
||||
==================================
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__cdist_preos_trigger - configure cdist preos trigger
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Create cdist PreOS trigger by creating systemd unit file that will be started
|
||||
at boot and will execute trigger command - connect to specified host and port.
|
||||
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
trigger-command
|
||||
Command that will be executed as a PreOS cdist trigger.
|
||||
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
None
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
# Configure default curl trigger for host cdist.ungleich.ch at port 80.
|
||||
__cdist_preos_trigger http --trigger-command '/usr/bin/curl cdist.ungleich.ch:80'
|
||||
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Darko Poljak <darko.poljak--@--ungleich.ch>
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2016 Darko Poljak. 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.
|
67
cdist/conf/type/__cdist_preos_trigger/manifest
Normal file
67
cdist/conf/type/__cdist_preos_trigger/manifest
Normal file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/sh
|
||||
|
||||
os="$(cat "$__global/explorer/os")"
|
||||
trigger_command=$(cat "$__object/parameter/trigger-command")
|
||||
|
||||
case "$os" in
|
||||
devuan)
|
||||
__file /etc/init.d/cdist-preos-trigger --owner root \
|
||||
--group root \
|
||||
--mode 755 \
|
||||
--source - << EOF
|
||||
#!/bin/sh
|
||||
# /etc/init.d/cdist-preos-trigger
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cdist-preos-trigger
|
||||
# Required-Start: \$all
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5 S
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Execute cdist preos trigger command
|
||||
# Description: Execute cdist preos trigger commnad.
|
||||
### END INIT INFO
|
||||
|
||||
case "\$1" in
|
||||
start)
|
||||
echo "Starting cdist-preos-trigger command"
|
||||
${trigger_command} &
|
||||
;;
|
||||
stop)
|
||||
# no-op
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/cdist-preos-trigger {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
__file /etc/systemd/system/cdist-preos-trigger.service --owner root \
|
||||
--group root \
|
||||
--mode 644 \
|
||||
--source - << EOF
|
||||
[Unit]
|
||||
Description=preos trigger
|
||||
Wants=network-online.target
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=no
|
||||
# Broken systemd
|
||||
ExecStartPre=/bin/sleep 5
|
||||
ExecStart=${trigger_command}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
require="__file/etc/systemd/system/cdist-preos-trigger.service" \
|
||||
__start_on_boot cdist-preos-trigger
|
||||
;;
|
||||
esac
|
||||
|
1
cdist/conf/type/__cdist_preos_trigger/parameter/required
Normal file
1
cdist/conf/type/__cdist_preos_trigger/parameter/required
Normal file
|
@ -0,0 +1 @@
|
|||
trigger-command
|
101
cdist/preos.py
Normal file
101
cdist/preos.py
Normal file
|
@ -0,0 +1,101 @@
|
|||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import inspect
|
||||
import argparse
|
||||
import cdist
|
||||
import logging
|
||||
|
||||
|
||||
_PREOS_CALL = "commandline"
|
||||
_PREOS_NAME = "_preos_name"
|
||||
_PREOS_MARKER = "_cdist_preos"
|
||||
_PLUGINS_DIR = "preos"
|
||||
_PLUGINS_PATH = [os.path.join(os.path.dirname(__file__), _PLUGINS_DIR), ]
|
||||
cdist_home = cdist.home_dir()
|
||||
if cdist_home:
|
||||
cdist_home_preos = os.path.join(cdist_home, "preos")
|
||||
if os.path.isdir(cdist_home_preos):
|
||||
_PLUGINS_PATH.append(cdist_home_preos)
|
||||
sys.path.extend(_PLUGINS_PATH)
|
||||
|
||||
|
||||
log = logging.getLogger("PreOS")
|
||||
|
||||
|
||||
def preos_plugin(obj):
|
||||
"""It is preos if _PREOS_MARKER is True and has _PREOS_CALL."""
|
||||
if hasattr(obj, _PREOS_MARKER):
|
||||
is_preos = getattr(obj, _PREOS_MARKER)
|
||||
else:
|
||||
is_preos = False
|
||||
|
||||
if is_preos and hasattr(obj, _PREOS_CALL):
|
||||
yield obj
|
||||
|
||||
|
||||
def scan_preos_dir_plugins(dir):
|
||||
for fname in os.listdir(dir):
|
||||
if os.path.isfile(os.path.join(dir, fname)):
|
||||
fname = os.path.splitext(fname)[0]
|
||||
module_name = fname
|
||||
try:
|
||||
module = __import__(module_name)
|
||||
yield from preos_plugin(module)
|
||||
clsmembers = inspect.getmembers(module, inspect.isclass)
|
||||
for cm in clsmembers:
|
||||
c = cm[1]
|
||||
yield from preos_plugin(c)
|
||||
except ImportError as e:
|
||||
log.warning("Cannot import '{}': {}".format(module_name, e))
|
||||
|
||||
|
||||
def find_preos_plugins():
|
||||
for dir in _PLUGINS_PATH:
|
||||
yield from scan_preos_dir_plugins(dir)
|
||||
|
||||
|
||||
def find_preoses():
|
||||
preoses = {}
|
||||
for preos in find_preos_plugins():
|
||||
if hasattr(preos, _PREOS_NAME):
|
||||
preos_name = getattr(preos, _PREOS_NAME)
|
||||
else:
|
||||
preos_name = preos.__name__.lower()
|
||||
preoses[preos_name] = preos
|
||||
return preoses
|
||||
|
||||
|
||||
def check_root():
|
||||
if os.geteuid() != 0:
|
||||
raise cdist.Error("Must be run with root privileges")
|
||||
|
||||
|
||||
class PreOS(object):
|
||||
preoses = None
|
||||
|
||||
@classmethod
|
||||
def commandline(cls, argv):
|
||||
|
||||
if not cls.preoses:
|
||||
cls.preoses = find_preoses()
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Create PreOS", prog="cdist preos")
|
||||
parser.add_argument('preos', help='PreOS to create, one of: {}'.format(
|
||||
set(cls.preoses)))
|
||||
args = parser.parse_args(argv[1:2])
|
||||
|
||||
preos_name = args.preos
|
||||
if preos_name in cls.preoses:
|
||||
preos = cls.preoses[preos_name]
|
||||
func = getattr(preos, _PREOS_CALL)
|
||||
if inspect.ismodule(preos):
|
||||
func_args = [preos, argv[2:], ]
|
||||
else:
|
||||
func_args = [argv[2:], ]
|
||||
log.info("Running preos : {}".format(preos_name))
|
||||
func(*func_args)
|
||||
else:
|
||||
log.error("Unknown preos: {}, available preoses: {}".format(
|
||||
preos_name, set(cls.preoses.keys())))
|
1
cdist/preos/debootstrap/__init__.py
Normal file
1
cdist/preos/debootstrap/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from debootstrap.debootstrap import Debian, Ubuntu, Devuan
|
246
cdist/preos/debootstrap/debootstrap.py
Normal file
246
cdist/preos/debootstrap/debootstrap.py
Normal file
|
@ -0,0 +1,246 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 2016 Darko Poljak (darko.poljak at ungleich.ch)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist 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.
|
||||
#
|
||||
# cdist 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 cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
|
||||
import cdist
|
||||
import cdist.config
|
||||
import cdist.core
|
||||
import cdist.preos
|
||||
import argparse
|
||||
import cdist.argparse
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
class Debian(object):
|
||||
_preos_name = 'debian'
|
||||
_cdist_preos = True
|
||||
|
||||
_files_dir = os.path.join(os.path.dirname(__file__), "files")
|
||||
|
||||
@classmethod
|
||||
def default_args(cls):
|
||||
default_remote_exec = os.path.join(cls._files_dir, "remote-exec.sh")
|
||||
default_remote_copy = os.path.join(cls._files_dir, "remote-copy.sh")
|
||||
default_init_manifest = os.path.join(
|
||||
cls._files_dir, "init-manifest-{}".format(cls._preos_name))
|
||||
|
||||
defargs = argparse.Namespace()
|
||||
defargs.arch = 'amd64'
|
||||
defargs.bootstrap = False
|
||||
defargs.configure = False
|
||||
defargs.cdist_params = '-v'
|
||||
defargs.rm_bootstrap_dir = False
|
||||
defargs.suite = 'stable'
|
||||
defargs.remote_exec = default_remote_exec
|
||||
defargs.remote_copy = default_remote_copy
|
||||
defargs.manifest = default_init_manifest
|
||||
|
||||
return defargs
|
||||
|
||||
@classmethod
|
||||
def get_parser(cls):
|
||||
defargs = cls.default_args()
|
||||
cdist_parser = cdist.argparse.get_parsers()
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='cdist preos {}'.format(cls._preos_name),
|
||||
parents=[cdist_parser['loglevel'], cdist_parser['beta']])
|
||||
parser.add_argument('target_dir', nargs=1,
|
||||
help=("target directory where PreOS will be "
|
||||
"bootstrapped"))
|
||||
parser.add_argument(
|
||||
'-a', '--arch',
|
||||
help="target debootstrap architecture, by default '{}'".format(
|
||||
defargs.arch), dest='arch', default=defargs.arch)
|
||||
parser.add_argument(
|
||||
'-B', '--bootstrap',
|
||||
help='do bootstrap step',
|
||||
dest='bootstrap', action='store_true', default=defargs.bootstrap)
|
||||
parser.add_argument(
|
||||
'-C', '--configure',
|
||||
help='do configure step',
|
||||
dest='configure', action='store_true', default=defargs.configure)
|
||||
parser.add_argument(
|
||||
'-c', '--cdist-params',
|
||||
help=("parameters that will be passed to cdist config, by default"
|
||||
" '{}' is used".format(defargs.cdist_params)),
|
||||
dest='cdist_params', default=defargs.cdist_params)
|
||||
parser.add_argument(
|
||||
'-D', '--drive-boot',
|
||||
help='create bootable PreOS on specified drive',
|
||||
dest='drive')
|
||||
parser.add_argument(
|
||||
'-e', '--remote-exec',
|
||||
help=("remote exec that cdist config will use, by default "
|
||||
"internal script is used"),
|
||||
dest='remote_exec', default=defargs.remote_exec)
|
||||
parser.add_argument(
|
||||
'-i', '--init-manifest',
|
||||
help=("init manifest that cdist config will use, by default "
|
||||
"internal init manifest is used"),
|
||||
dest='manifest', default=defargs.manifest)
|
||||
parser.add_argument(
|
||||
'-k', '--keyfile', action="append",
|
||||
help=("ssh key files that will be added to cdist config; "
|
||||
"'__ssh_authorized_keys root ...' type is appended to "
|
||||
"initial manifest"),
|
||||
dest='keyfile')
|
||||
parser.add_argument(
|
||||
'-m', '--mirror',
|
||||
help='use specified mirror for debootstrap',
|
||||
dest='mirror')
|
||||
parser.add_argument(
|
||||
'-P', '--root-password',
|
||||
help='Set specified password for root, generated by default',
|
||||
dest='root_password')
|
||||
parser.add_argument('-p', '--pxe-boot-dir', help='PXE boot directory',
|
||||
dest='pxe_boot_dir')
|
||||
parser.add_argument(
|
||||
'-r', '--rm-bootstrap-dir',
|
||||
help='remove target directory after finishing',
|
||||
dest='rm_bootstrap_dir', action='store_true',
|
||||
default=defargs.rm_bootstrap_dir)
|
||||
parser.add_argument(
|
||||
'-S', '--script',
|
||||
help='use specified script for debootstrap',
|
||||
dest='script')
|
||||
parser.add_argument('-s', '--suite',
|
||||
help="suite used for debootstrap, "
|
||||
"by default '{}'".format(defargs.suite),
|
||||
dest='suite', default=defargs.suite)
|
||||
parser.add_argument(
|
||||
'-t', '--trigger-command',
|
||||
help=("trigger command that will be added to cdist config; "
|
||||
"'__cdist_preos_trigger http ...' type is appended to "
|
||||
"initial manifest"),
|
||||
dest='trigger_command')
|
||||
parser.add_argument(
|
||||
'-y', '--remote-copy',
|
||||
help=("remote copy that cdist config will use, by default "
|
||||
"internal script is used"),
|
||||
dest='remote_copy', default=defargs.remote_copy)
|
||||
parser.epilog = cdist.argparse.EPILOG
|
||||
|
||||
return parser
|
||||
|
||||
@classmethod
|
||||
def update_env(cls, env):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def commandline(cls, argv):
|
||||
log = logging.getLogger(cls.__name__)
|
||||
|
||||
parser = cls.get_parser()
|
||||
cdist.argparse.add_beta_command(cls._preos_name)
|
||||
args = parser.parse_args(argv)
|
||||
if args.script and not args.mirror:
|
||||
raise cdist.Error("script option cannot be used without "
|
||||
"mirror option")
|
||||
|
||||
args.command = cls._preos_name
|
||||
cdist.argparse.check_beta(vars(args))
|
||||
|
||||
cdist.preos.check_root()
|
||||
|
||||
args.target_dir = os.path.realpath(args.target_dir[0])
|
||||
args.os = cls._preos_name
|
||||
args.remote_exec = os.path.realpath(args.remote_exec)
|
||||
args.remote_copy = os.path.realpath(args.remote_copy)
|
||||
args.manifest = os.path.realpath(args.manifest)
|
||||
if args.keyfile:
|
||||
new_keyfile = [os.path.realpath(x) for x in args.keyfile]
|
||||
args.keyfile = new_keyfile
|
||||
if args.pxe_boot_dir:
|
||||
args.pxe_boot_dir = os.path.realpath(args.pxe_boot_dir)
|
||||
|
||||
cdist.argparse.handle_loglevel(args)
|
||||
log.debug("preos: {}, args: {}".format(cls._preos_name, args))
|
||||
try:
|
||||
env = vars(args)
|
||||
new_env = {}
|
||||
for key in env:
|
||||
if key == 'verbose':
|
||||
if env[key] >= 3:
|
||||
new_env['debug'] = "yes"
|
||||
elif env[key] == 2:
|
||||
new_env['verbose'] = "yes"
|
||||
elif not env[key]:
|
||||
new_env[key] = ''
|
||||
elif isinstance(env[key], bool) and env[key]:
|
||||
new_env[key] = "yes"
|
||||
elif isinstance(env[key], list):
|
||||
val = env[key]
|
||||
new_env[key + "_cnt"] = str(len(val))
|
||||
for i, v in enumerate(val):
|
||||
new_env[key + "_" + str(i)] = v
|
||||
else:
|
||||
new_env[key] = str(env[key])
|
||||
env = new_env
|
||||
env.update(os.environ)
|
||||
cls.update_env(env)
|
||||
log.debug("preos: {} env: {}".format(cls._preos_name, env))
|
||||
cmd = os.path.join(cls._files_dir, "code")
|
||||
info_msg = ["Running preos: {}, suite: {}, arch: {}".format(
|
||||
cls._preos_name, args.suite, args.arch), ]
|
||||
if args.mirror:
|
||||
info_msg.append("mirror: {}".format(args.mirror))
|
||||
if args.script:
|
||||
info_msg.append("script: {}".format(args.script))
|
||||
if args.bootstrap:
|
||||
info_msg.append("bootstrapping")
|
||||
if args.configure:
|
||||
info_msg.append("configuring")
|
||||
if args.pxe_boot_dir:
|
||||
info_msg.append("creating PXE")
|
||||
if args.drive:
|
||||
info_msg.append("creating bootable drive")
|
||||
log.info(info_msg)
|
||||
log.debug("cmd={}".format(cmd))
|
||||
subprocess.check_call(cmd, env=env, shell=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
log.error("preos {} failed: {}".format(cls._preos_name, e))
|
||||
|
||||
|
||||
class Ubuntu(Debian):
|
||||
_preos_name = "ubuntu"
|
||||
|
||||
@classmethod
|
||||
def default_args(cls):
|
||||
defargs = super().default_args()
|
||||
defargs.suite = 'xenial'
|
||||
return defargs
|
||||
|
||||
|
||||
class Devuan(Debian):
|
||||
_preos_name = "devuan"
|
||||
|
||||
@classmethod
|
||||
def default_args(cls):
|
||||
defargs = super().default_args()
|
||||
defargs.suite = 'jessie'
|
||||
return defargs
|
||||
|
||||
@classmethod
|
||||
def update_env(cls, env):
|
||||
env['DEBOOTSTRAP_DIR'] = os.path.join(cls._files_dir,
|
||||
'devuan-debootstrap')
|
281
cdist/preos/debootstrap/files/code
Executable file
281
cdist/preos/debootstrap/files/code
Executable file
|
@ -0,0 +1,281 @@
|
|||
#!/bin/sh
|
||||
##
|
||||
## 2016 Darko Poljak (darko.poljak at ungleich.ch)
|
||||
##
|
||||
## This file is part of cdist.
|
||||
##
|
||||
## cdist 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.
|
||||
##
|
||||
## cdist 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 cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -e
|
||||
|
||||
if [ "${debug}" ]
|
||||
then
|
||||
set -x
|
||||
cdist_params="${cdist_params} -d"
|
||||
fi
|
||||
|
||||
bootstrap_dir="${target_dir}"
|
||||
|
||||
case "${os}" in
|
||||
ubuntu|debian|devuan)
|
||||
# nothing, those are valid values
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: invalid os value: ${os}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
check_bootstrap_dir() {
|
||||
if [ ! -e "$1" ]
|
||||
then
|
||||
echo "ERROR: bootstrap directory $1 does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# bootstrap
|
||||
if [ "${bootstrap}" ]
|
||||
then
|
||||
if [ "${DEBOOTSTRAP_DIR}" ]
|
||||
then
|
||||
debootstrap_cmd="${DEBOOTSTRAP_DIR}/debootstrap"
|
||||
else
|
||||
command -v debootstrap 2>&1 > /dev/null || {
|
||||
echo "ERROR: debootstrap not found" >&2
|
||||
exit 1
|
||||
}
|
||||
debootstrap_cmd="debootstrap"
|
||||
fi
|
||||
|
||||
# If PreOS on drive then do not check for directory emptiness.
|
||||
# Partition can at least contain 'lost+found' directory.
|
||||
if [ ! "${drive}" ]
|
||||
then
|
||||
if [ -e "${bootstrap_dir}" ]
|
||||
then
|
||||
dir_content=$(ls -A "${bootstrap_dir}" | wc -l)
|
||||
else
|
||||
dir_content=0
|
||||
fi
|
||||
if [ "${dir_content}" -ne 0 ]
|
||||
then
|
||||
echo "ERROR: "${bootstrap_dir}" not empty " >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "bootstrapping..."
|
||||
fi
|
||||
mkdir -p "${bootstrap_dir}"
|
||||
"${debootstrap_cmd}" --include=openssh-server --arch=${arch} ${suite} ${bootstrap_dir} \
|
||||
${mirror} ${script}
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "bootstrap finished"
|
||||
fi
|
||||
fi
|
||||
|
||||
chroot_mount() {
|
||||
mount -t proc none "${bootstrap_dir}/proc" || true
|
||||
mount -t sysfs none "${bootstrap_dir}/sys" || true
|
||||
mount -o bind /dev "${bootstrap_dir}/dev" || true
|
||||
mount -t devpts none "${bootstrap_dir}/dev/pts" || true
|
||||
}
|
||||
|
||||
chroot_umount() {
|
||||
umount "${bootstrap_dir}/dev/pts" || true
|
||||
umount "${bootstrap_dir}/dev" || true
|
||||
umount "${bootstrap_dir}/sys" || true
|
||||
umount "${bootstrap_dir}/proc" || true
|
||||
}
|
||||
|
||||
TRAPFUNC="umount \"${bootstrap_dir}/dev/pts\" || true; \
|
||||
umount \"${bootstrap_dir}/dev\" || true; \
|
||||
umount \"${bootstrap_dir}/sys\" || true; \
|
||||
umount \"${bootstrap_dir}/proc\" || true;"
|
||||
|
||||
# config
|
||||
if [ "${configure}" ]
|
||||
then
|
||||
if [ ! -f "${manifest}" ]
|
||||
then
|
||||
echo "ERROR: ${manifest} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "${remote_exec}" ]
|
||||
then
|
||||
echo "ERROR: ${remote_exec} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "${remote_copy}" ]
|
||||
then
|
||||
echo "ERROR: ${remote_copy} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${trigger_command}" ]
|
||||
then
|
||||
trigger_line="__cdist_preos_trigger http --trigger-command '${trigger_command}'\n"
|
||||
else
|
||||
trigger_line=""
|
||||
fi
|
||||
|
||||
if [ "${keyfile_cnt}" -a "${keyfile_cnt}" -gt 0 ]
|
||||
then
|
||||
i="$((keyfile_cnt - 1))"
|
||||
keyfiles=""
|
||||
while [ "${i}" -ge 0 ]
|
||||
do
|
||||
kf_var="keyfile_${i}"
|
||||
eval kf='$'"${kf_var}"
|
||||
if [ ! -f "${kf}" ]
|
||||
then
|
||||
echo "ERROR: ${kf} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
key=$(cat "${kf}")
|
||||
keyfiles="${keyfiles} --key '${key}'"
|
||||
i=$((i - 1))
|
||||
done
|
||||
ssh_auth_keys_line="__ssh_authorized_keys root ${keyfiles}\n"
|
||||
else
|
||||
ssh_auth_keys_line=""
|
||||
fi
|
||||
|
||||
check_bootstrap_dir "${bootstrap_dir}"
|
||||
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "configuring..."
|
||||
fi
|
||||
|
||||
trap "${TRAPFUNC}" 0 1 2 3 15
|
||||
|
||||
chroot_mount
|
||||
|
||||
chroot "${bootstrap_dir}" /usr/bin/apt-get update
|
||||
|
||||
if [ "${drive}" ]
|
||||
then
|
||||
grub_manifest_line="__package grub-pc --state present\n"
|
||||
grub_kern_params_line="__line linux_kernel_params \
|
||||
--file /etc/default/grub \
|
||||
--line 'GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash net.ifnames=0\"'\n"
|
||||
else
|
||||
grub_manifest_line=""
|
||||
grub_kern_params_line=""
|
||||
fi
|
||||
grub_lines="${grub_manifest_line}${grub_kern_params_line}"
|
||||
|
||||
printf "${trigger_line}${ssh_auth_keys_line}${grub_lines}" \
|
||||
| cat "${manifest}" - |\
|
||||
cdist config \
|
||||
${cdist_params} -i - \
|
||||
--remote-exec "${remote_exec}" \
|
||||
--remote-copy "${remote_copy}" \
|
||||
"${bootstrap_dir}"
|
||||
|
||||
# __hostname with systmed uses hostnamectl which needs dbus running
|
||||
# set hostname explicitly here instead
|
||||
printf "preos\n" > "${bootstrap_dir}/etc/hostname"
|
||||
|
||||
chroot "${bootstrap_dir}" /usr/bin/apt-get autoclean
|
||||
chroot "${bootstrap_dir}" /usr/bin/apt-get clean
|
||||
chroot "${bootstrap_dir}" /usr/bin/apt-get autoremove
|
||||
|
||||
chroot_umount
|
||||
|
||||
trap - 0 1 2 3 15
|
||||
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "configuring finished"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${pxe_boot_dir}" ]
|
||||
then
|
||||
check_bootstrap_dir "${bootstrap_dir}"
|
||||
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "creating pxe..."
|
||||
fi
|
||||
|
||||
mkdir -p "${pxe_boot_dir}"
|
||||
cp "${bootstrap_dir}"/boot/vmlinuz-* "${pxe_boot_dir}/kernel"
|
||||
cd "${bootstrap_dir}"
|
||||
find . -print0 | cpio --null -o --format=newc | gzip -9 > "${pxe_boot_dir}/initramfs"
|
||||
|
||||
mkdir -p "${pxe_boot_dir}/pxelinux.cfg"
|
||||
cat <<EOPXEF > "${pxe_boot_dir}/pxelinux.cfg/default"
|
||||
DEFAULT preos
|
||||
LABEL preos
|
||||
KERNEL kernel
|
||||
APPEND utf8 load_ramdisk=1 root=/dev/ram nofb initrd=initramfs console=ttyS1,115200 net.ifnames=0
|
||||
EOPXEF
|
||||
|
||||
cp "${bootstrap_dir}/usr/lib/PXELINUX/pxelinux.0" "${pxe_boot_dir}/pxelinux.0"
|
||||
cp "${bootstrap_dir}/usr/lib/syslinux/modules/bios/ldlinux.c32" \
|
||||
"${pxe_boot_dir}/ldlinux.c32"
|
||||
# network boot need all files world readable
|
||||
chmod -R 644 "${pxe_boot_dir}"/*
|
||||
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "pxe creation finished"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${drive}" ]
|
||||
then
|
||||
trap "${TRAPFUNC}" 0 1 2 3 15
|
||||
chroot_mount
|
||||
chroot "${bootstrap_dir}" grub-install ${drive}
|
||||
chroot "${bootstrap_dir}" /bin/sh -c "GRUB_DISABLE_OS_PROBER=true update-grub"
|
||||
# set root password
|
||||
if [ ! "${root_password}" ]
|
||||
then
|
||||
if ! which strings >/dev/null 2>&1
|
||||
then
|
||||
printf "strings is missing\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
root_password="$(head -n 1000 /dev/urandom | strings | \
|
||||
grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n')"
|
||||
printf "Generated root password (without quotes):'${root_password}'\n"
|
||||
fi
|
||||
chroot "${bootstrap_dir}" /bin/sh -c "echo \"root:${root_password}\" | \
|
||||
chpasswd"
|
||||
# /etc/securetty must not be world writeable.
|
||||
chmod 644 "${bootstrap_dir}"/etc/securetty
|
||||
chroot_umount
|
||||
trap - 0 1 2 3 15
|
||||
fi
|
||||
|
||||
if [ "${rm_bootstrap_dir}" ]
|
||||
then
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "removing bootstrap dir..."
|
||||
fi
|
||||
rm -r -f "${bootstrap_dir}"
|
||||
if [ "${verbose}" -o "${debug}" ]
|
||||
then
|
||||
echo "removing bootstrap dir finished"
|
||||
fi
|
||||
fi
|
18
cdist/preos/debootstrap/files/devuan-debootstrap/Makefile
Normal file
18
cdist/preos/debootstrap/files/devuan-debootstrap/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
# avoid dpkg-dev dependency; fish out the version with sed
|
||||
VERSION := $(shell sed 's/.*(\(.*\)).*/\1/; q' debian/changelog)
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
DSDIR=$(DESTDIR)/usr/share/debootstrap
|
||||
install:
|
||||
mkdir -p $(DSDIR)/scripts
|
||||
mkdir -p $(DESTDIR)/usr/sbin
|
||||
|
||||
cp -a scripts/* $(DSDIR)/scripts/
|
||||
install -o root -g root -m 0644 functions $(DSDIR)/
|
||||
|
||||
sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)/usr/sbin/debootstrap
|
||||
chown root:root $(DESTDIR)/usr/sbin/debootstrap
|
||||
chmod 0755 $(DESTDIR)/usr/sbin/debootstrap
|
65
cdist/preos/debootstrap/files/devuan-debootstrap/README
Normal file
65
cdist/preos/debootstrap/files/devuan-debootstrap/README
Normal file
|
@ -0,0 +1,65 @@
|
|||
README for debootstrap
|
||||
======================
|
||||
|
||||
See the manpage for (some) documentation.
|
||||
|
||||
Running debootstrap from source
|
||||
-------------------------------
|
||||
|
||||
You can run debootstrap from its source tree without installing it. This
|
||||
can be useful if you want a quick way to make a Debian chroot on another
|
||||
system, or if you are testing modifications to debootstrap.
|
||||
|
||||
First, get the source.
|
||||
|
||||
* Either by using git
|
||||
git clone https://anonscm.debian.org/git/d-i/debootstrap.git
|
||||
|
||||
* Or by visiting <https://packages.debian.org/source/sid/debootstrap>
|
||||
and downloading the tar.gz file
|
||||
|
||||
Then in the debootstrap source directory:
|
||||
|
||||
export DEBOOTSTRAP_DIR=`pwd`
|
||||
sudo ./debootstrap stable my-stable-dir
|
||||
|
||||
If you are running a multi-stage boot strap (for example for a QEMU
|
||||
rootfs) you don't even need root:
|
||||
|
||||
export DEBOOTSTRAP_DIR=`pwd`
|
||||
fakeroot ./debootstrap --foreign --arch=armhf testing my-testing-dir http://deb.debian.org/debian
|
||||
|
||||
Of course you will need to execute the second stage as root to finish the bootstrap:
|
||||
|
||||
(on foreign hardware)
|
||||
/debootstrap/debootstrap --second-stage
|
||||
|
||||
|
||||
Future
|
||||
------
|
||||
|
||||
* Cross-strap support - so you can bootstrap a filesystem to the
|
||||
point where it will successfully boot, and finish installing itself
|
||||
without having to be running the target architecture or OS yourself.
|
||||
|
||||
debootstrap --arch powerpc sarge ./sarge-ppc-chroot ...
|
||||
|
||||
on an i386 system, boot a powerpc box with sarge-ppc-chroot as its
|
||||
root files system, and have it "work". The cross-hurd package does
|
||||
something similar, and should be replaced by this feature.
|
||||
|
||||
* There should be some (better) way of telling debootstrap what "base"
|
||||
packages you want to install -- this varies between making a chroot,
|
||||
doing an install, and doing a buildd. Also, some installs want
|
||||
different base packages (to setup networking, or kernels, eg)
|
||||
|
||||
|
||||
NMUing
|
||||
------
|
||||
|
||||
If there's a problem with debootstrap that you need fixed, feel free to do
|
||||
an NMU to fix it. Usual rules: try not to break anything, and mail the
|
||||
patch to the BTS. Don't worry about asking first though.
|
||||
|
||||
However, note that debootstrap is now team maintained. Anyone in d-i can do
|
||||
a release without the bother of a NMU.
|
11
cdist/preos/debootstrap/files/devuan-debootstrap/TODO
Normal file
11
cdist/preos/debootstrap/files/devuan-debootstrap/TODO
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
Features:
|
||||
++ second stage via chroot debootstrap/debootstrap
|
||||
++ debootstrap/deb file to record deb destinations/information
|
||||
|
||||
-- configuration file
|
||||
-- versus command line
|
||||
-- support for sources (vs mirrors)
|
||||
-- faux-pinning for packages
|
||||
|
||||
++ makedev in second stage
|
6
cdist/preos/debootstrap/files/devuan-debootstrap/debian/.gitignore
vendored
Normal file
6
cdist/preos/debootstrap/files/devuan-debootstrap/debian/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
debootstrap
|
||||
debootstrap-udeb
|
||||
files
|
||||
*.debhelper.log
|
||||
*.substvars
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
To sync up with debians source for inspiration you should run the following:
|
||||
|
||||
`git remote add alioth-git git://anonscm.debian.org/d-i/debootstrap.git`
|
||||
`git fetch alioth-git`
|
||||
|
||||
After that you can either cherry-pick or merge releases from debian. To
|
||||
merge a release, it's do:
|
||||
`git tag` to list the release tags
|
||||
and
|
||||
`git merge <tag>`
|
||||
followed by all the fixups and then commit with an appropriate message like
|
||||
"Merging Release <tag> from debian"
|
||||
|
||||
Copyright 2016 Daniel Reurich <daniel@centurion.net.nz>
|
||||
|
2655
cdist/preos/debootstrap/files/devuan-debootstrap/debian/changelog
Normal file
2655
cdist/preos/debootstrap/files/devuan-debootstrap/debian/changelog
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1 @@
|
|||
9
|
|
@ -0,0 +1,26 @@
|
|||
Source: debootstrap
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: Franco (nextime) Lanza <nextime@devuan.org>
|
||||
Uploaders: Franco (nextime) Lanza <nextime@devuan.org>, Daniel Reurich <daniel@centurion.net.nz>
|
||||
Build-Depends: debhelper (>= 9), makedev (>= 2.3.1-69) [linux-any], git
|
||||
Standards-Version: 3.9.8
|
||||
Vcs-Browser: https://git.devuan.org/devuan-packages/debootstrap
|
||||
Vcs-Git: https://git.devuan.org/devuan-packages/debootstrap.git
|
||||
|
||||
Package: debootstrap
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, wget
|
||||
Recommends: gnupg, ${keyring}, devuan-keyring
|
||||
Description: Bootstrap a basic Devuan system
|
||||
debootstrap is used to create a Devuan base system from scratch,
|
||||
without requiring the availability of dpkg or apt. It does this by
|
||||
downloading .deb files from a mirror site, and carefully unpacking them
|
||||
into a directory which can eventually be chrooted into.
|
||||
|
||||
Package: debootstrap-udeb
|
||||
Section: debian-installer
|
||||
Package-Type: udeb
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, mounted-partitions
|
||||
Description: Bootstrap the Devuan system
|
|
@ -0,0 +1,30 @@
|
|||
This package was debianized by Anthony Towns <ajt@debian.org> on
|
||||
Tue, 30 Jan 2001 10:54:45 +1000.
|
||||
|
||||
It was written from scratch for Debian by Anthony Towns <ajt@debian.org>
|
||||
based loosely on the code for constructing base tarballs as part of the
|
||||
boot-floppies package.
|
||||
|
||||
Copyright:
|
||||
|
||||
Copyright (c) 2001-2005 Anthony Towns
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -0,0 +1 @@
|
|||
README
|
|
@ -0,0 +1 @@
|
|||
debootstrap.8
|
|
@ -0,0 +1,9 @@
|
|||
[DEFAULT]
|
||||
compression = xz
|
||||
pristine-tar = false
|
||||
upstream-tag = devuan/1.0.85
|
||||
|
||||
[git-buildpackage]
|
||||
upstream-tree = tag
|
||||
tarball-dir = ../tarballs/
|
||||
export-dir = ../build-area/
|
47
cdist/preos/debootstrap/files/devuan-debootstrap/debian/rules
Executable file
47
cdist/preos/debootstrap/files/devuan-debootstrap/debian/rules
Executable file
|
@ -0,0 +1,47 @@
|
|||
#! /usr/bin/make -f
|
||||
|
||||
ifeq (0,$(shell dpkg-vendor --derives-from Ubuntu; echo $$?))
|
||||
KEYRING := ubuntu-keyring
|
||||
else ifeq (0,$(shell dpkg-vendor --derives-from Devuan; echo $$?))
|
||||
KEYRING := devuan-keyring
|
||||
else ifeq (0,$(shell dpkg-vendor --derives-from Tanglu; echo $$?))
|
||||
KEYRING := tanglu-archive-keyring
|
||||
else
|
||||
KEYRING := debian-archive-keyring
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
# need to be root to make devices, so build is done in install target
|
||||
override_dh_auto_build:
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_build
|
||||
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/debootstrap
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/debootstrap-udeb
|
||||
|
||||
# remove scripts not needed by d-i
|
||||
-rm -f debian/debootstrap-udeb/usr/share/debootstrap/scripts/potato \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/woody \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/sarge \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/warty \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/hoary \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/breezy \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/dapper \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/edgy \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/feisty \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/*.buildd \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/*.fakechroot \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/stable \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/testing \
|
||||
debian/debootstrap-udeb/usr/share/debootstrap/scripts/unstable
|
||||
|
||||
override_dh_gencontrol:
|
||||
dh_gencontrol -- -Vkeyring=$(KEYRING)
|
||||
|
||||
# Specify gzip to mitigate #770217:
|
||||
override_dh_builddeb:
|
||||
dh_builddeb -pdebootstrap -- -Zgzip
|
||||
dh_builddeb -pdebootstrap-udeb -- -Zxz
|
|
@ -0,0 +1 @@
|
|||
3.0 (git)
|
703
cdist/preos/debootstrap/files/devuan-debootstrap/debootstrap
Executable file
703
cdist/preos/debootstrap/files/devuan-debootstrap/debootstrap
Executable file
|
@ -0,0 +1,703 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
VERSION='@VERSION@'
|
||||
|
||||
unset TMP TEMP TMPDIR || true
|
||||
|
||||
# might not be exported if we're running from init=/bin/sh or similar
|
||||
export PATH
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ -z "$DEBOOTSTRAP_DIR" ]; then
|
||||
if [ -x /debootstrap/debootstrap ]; then
|
||||
DEBOOTSTRAP_DIR=/debootstrap
|
||||
else
|
||||
DEBOOTSTRAP_DIR=/usr/share/debootstrap
|
||||
fi
|
||||
fi
|
||||
|
||||
. $DEBOOTSTRAP_DIR/functions
|
||||
exec 4>&1
|
||||
|
||||
LANG=C
|
||||
USE_COMPONENTS=main
|
||||
KEYRING=""
|
||||
DISABLE_KEYRING=""
|
||||
FORCE_KEYRING=""
|
||||
VARIANT=""
|
||||
MERGED_USR="no"
|
||||
ARCH=""
|
||||
HOST_ARCH=""
|
||||
HOST_OS=""
|
||||
KEEP_DEBOOTSTRAP_DIR=""
|
||||
USE_DEBIANINSTALLER_INTERACTION=""
|
||||
SECOND_STAGE_ONLY=""
|
||||
PRINT_DEBS=""
|
||||
CHROOTDIR=""
|
||||
MAKE_TARBALL=""
|
||||
EXTRACTOR_OVERRIDE=""
|
||||
UNPACK_TARBALL=""
|
||||
ADDITIONAL=""
|
||||
EXCLUDE=""
|
||||
VERBOSE=""
|
||||
CERTIFICATE=""
|
||||
CHECKCERTIF=""
|
||||
PRIVATEKEY=""
|
||||
|
||||
|
||||
DEF_MIRROR="http://packages.devuan.org/merged"
|
||||
DEF_HTTPS_MIRROR="https://packages.devuan.org/merged"
|
||||
|
||||
export LANG USE_COMPONENTS EXCLUDE
|
||||
umask 022
|
||||
|
||||
###########################################################################
|
||||
|
||||
## phases:
|
||||
## finddebs dldebs printdebs first_stage second_stage
|
||||
|
||||
RESOLVE_DEPS=true
|
||||
|
||||
WHAT_TO_DO="finddebs dldebs first_stage second_stage"
|
||||
am_doing_phase () {
|
||||
# usage: if am_doing_phase finddebs; then ...; fi
|
||||
local x;
|
||||
for x in "$@"; do
|
||||
if echo " $WHAT_TO_DO " | grep -q " $x "; then return 0; fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
usage_err()
|
||||
{
|
||||
info USAGE1 "usage: [OPTION]... <suite> <target> [<mirror> [<script>]]"
|
||||
info USAGE2 "Try \`${0##*/} --help' for more information."
|
||||
error "$@"
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: ${0##*/} [OPTION]... <suite> <target> [<mirror> [<script>]]"
|
||||
echo "Bootstrap a Debian base system into a target directory."
|
||||
echo
|
||||
cat <<EOF
|
||||
--help display this help and exit
|
||||
--version display version information and exit
|
||||
--verbose don't turn off the output of wget
|
||||
|
||||
--download-only download packages, but don't perform installation
|
||||
--print-debs print the packages to be installed, and exit
|
||||
|
||||
--arch=A set the architecture to install (use if no dpkg)
|
||||
[ --arch=powerpc ]
|
||||
|
||||
--include=A,B,C adds specified names to the list of base packages
|
||||
--exclude=A,B,C removes specified packages from the list
|
||||
--components=A,B,C use packages from the listed components of the
|
||||
archive
|
||||
--variant=X use variant X of the bootstrap scripts
|
||||
(currently supported variants: buildd, fakechroot,
|
||||
minbase)
|
||||
--merged-usr make /{bin,sbin,lib}/ symlinks to /usr/
|
||||
--keyring=K check Release files against keyring K
|
||||
--no-check-gpg avoid checking Release file signatures
|
||||
--force-check-gpg force checking Release file signatures
|
||||
(also disables automatic fallback to HTTPS in case
|
||||
of a missing keyring), aborting otherwise
|
||||
--no-resolve-deps don't try to resolve dependencies automatically
|
||||
|
||||
--unpack-tarball=T acquire .debs from a tarball instead of http
|
||||
--make-tarball=T download .debs and create a tarball (tgz format)
|
||||
--second-stage-target=DIR
|
||||
Run second stage in a subdirectory instead of root
|
||||
(can be used to create a foreign chroot)
|
||||
(requires --second-stage)
|
||||
--extractor=TYPE override automatic .deb extractor selection
|
||||
(supported: $EXTRACTORS_SUPPORTED)
|
||||
--debian-installer used for internal purposes by debian-installer
|
||||
--private-key=file read the private key from file
|
||||
--certificate=file use the client certificate stored in file (PEM)
|
||||
--no-check-certificate do not check certificate against certificate authorities
|
||||
EOF
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ -z "$PKGDETAILS" ]; then
|
||||
error 1 NO_PKGDETAILS "No pkgdetails available; either install perl, or build pkgdetails.c from the base-installer source package"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ $# != 0 ] ; then
|
||||
while true ; do
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
echo "debootstrap $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
--debian-installer)
|
||||
if ! (echo -n "" >&3) 2>/dev/null; then
|
||||
error 1 ARG_DIBYHAND "If running debootstrap by hand, don't use --debian-installer"
|
||||
fi
|
||||
USE_DEBIANINSTALLER_INTERACTION=yes
|
||||
shift
|
||||
;;
|
||||
--foreign)
|
||||
if [ "$PRINT_DEBS" != "true" ]; then
|
||||
WHAT_TO_DO="finddebs dldebs first_stage"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--second-stage)
|
||||
WHAT_TO_DO="second_stage"
|
||||
SECOND_STAGE_ONLY=true
|
||||
shift
|
||||
;;
|
||||
--second-stage-target|--second-stage-target=?*)
|
||||
if [ "$SECOND_STAGE_ONLY" != "true" ] ; then
|
||||
error 1 STAGE2ONLY "option %s only applies in the second stage" "$1"
|
||||
fi
|
||||
if [ "$1" = "--second-stage-target" -a -n "$2" ] ; then
|
||||
CHROOTDIR="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--second-stage-target=}" ]; then
|
||||
CHROOTDIR="${1#--second-stage-target=}"
|
||||
shift
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument: %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--print-debs)
|
||||
WHAT_TO_DO="finddebs printdebs kill_target"
|
||||
PRINT_DEBS=true
|
||||
shift
|
||||
;;
|
||||
--download-only)
|
||||
WHAT_TO_DO="finddebs dldebs"
|
||||
shift
|
||||
;;
|
||||
--make-tarball|--make-tarball=?*)
|
||||
WHAT_TO_DO="finddebs dldebs maketarball kill_target"
|
||||
if [ "$1" = "--make-tarball" -a -n "$2" ] ; then
|
||||
MAKE_TARBALL="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--make-tarball=}" ]; then
|
||||
MAKE_TARBALL="${1#--make-tarball=}"
|
||||
shift
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--resolve-deps)
|
||||
# redundant, but avoids breaking compatibility
|
||||
RESOLVE_DEPS=true
|
||||
shift
|
||||
;;
|
||||
--no-resolve-deps)
|
||||
RESOLVE_DEPS=false
|
||||
shift
|
||||
;;
|
||||
--keep-debootstrap-dir)
|
||||
KEEP_DEBOOTSTRAP_DIR=true
|
||||
shift
|
||||
;;
|
||||
--arch|--arch=?*)
|
||||
if [ "$1" = "--arch" -a -n "$2" ] ; then
|
||||
ARCH="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--arch=}" ]; then
|
||||
ARCH="${1#--arch=}"
|
||||
shift
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--extractor|--extractor=?*)
|
||||
if [ "$1" = "--extractor" -a -n "$2" ] ; then
|
||||
EXTRACTOR_OVERRIDE="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--extractor=}" ]; then
|
||||
EXTRACTOR_OVERRIDE="${1#--extractor=}"
|
||||
shift
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
if valid_extractor "$EXTRACTOR_OVERRIDE"; then
|
||||
if ! type "$EXTRACTOR_OVERRIDE" >/dev/null 2>&1; then
|
||||
error 1 MISSINGEXTRACTOR "The selected extractor cannot be found: %s" "$EXTRACTOR_OVERRIDE"
|
||||
fi
|
||||
else
|
||||
error 1 BADEXTRACTOR "%s: unknown extractor" "$EXTRACTOR_OVERRIDE"
|
||||
fi
|
||||
;;
|
||||
--unpack-tarball|--unpack-tarball=?*)
|
||||
if [ "$1" = "--unpack-tarball" -a -n "$2" ] ; then
|
||||
UNPACK_TARBALL="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--unpack-tarball=}" ]; then
|
||||
UNPACK_TARBALL="${1#--unpack-tarball=}"
|
||||
shift
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
if [ ! -f "$UNPACK_TARBALL" ] ; then
|
||||
error 1 NOTARBALL "%s: No such file or directory" "$UNPACK_TARBALL"
|
||||
fi
|
||||
;;
|
||||
--include|--include=?*)
|
||||
if [ "$1" = "--include" -a -n "$2" ]; then
|
||||
ADDITIONAL="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--include=}" ]; then
|
||||
ADDITIONAL="${1#--include=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
ADDITIONAL="$(echo "$ADDITIONAL" | tr , " ")"
|
||||
;;
|
||||
--exclude|--exclude=?*)
|
||||
if [ "$1" = "--exclude" -a -n "$2" ]; then
|
||||
EXCLUDE="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--exclude=}" ]; then
|
||||
EXCLUDE="${1#--exclude=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
EXCLUDE="$(echo "$EXCLUDE" | tr , " ")"
|
||||
;;
|
||||
--verbose)
|
||||
VERBOSE=true
|
||||
export VERBOSE
|
||||
shift 1
|
||||
;;
|
||||
--components|--components=?*)
|
||||
if [ "$1" = "--components" -a -n "$2" ]; then
|
||||
USE_COMPONENTS="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--components=}" ]; then
|
||||
USE_COMPONENTS="${1#--components=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
USE_COMPONENTS="$(echo "$USE_COMPONENTS" | tr , "|")"
|
||||
;;
|
||||
--variant|--variant=?*)
|
||||
if [ "$1" = "--variant" -a -n "$2" ]; then
|
||||
VARIANT="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--variant=}" ]; then
|
||||
VARIANT="${1#--variant=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--merged-usr)
|
||||
MERGED_USR=yes
|
||||
shift
|
||||
;;
|
||||
--no-merged-usr)
|
||||
MERGED_USR=no
|
||||
shift
|
||||
;;
|
||||
--keyring|--keyring=?*)
|
||||
if ! gpgv --version >/dev/null 2>&1; then
|
||||
error 1 NEEDGPGV "gpgv not installed, but required for Release verification"
|
||||
fi
|
||||
if [ "$1" = "--keyring" -a -n "$2" ]; then
|
||||
KEYRING="$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--keyring=}" ]; then
|
||||
KEYRING="${1#--keyring=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--no-check-gpg)
|
||||
shift 1
|
||||
DISABLE_KEYRING=1
|
||||
;;
|
||||
--force-check-gpg)
|
||||
shift 1
|
||||
FORCE_KEYRING=1
|
||||
;;
|
||||
--certificate|--certificate=?*)
|
||||
if [ "$1" = "--certificate" -a -n "$2" ]; then
|
||||
CERTIFICATE="--certificate=$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--certificate=}" ]; then
|
||||
CERTIFICATE="--certificate=${1#--certificate=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--private-key|--private-key=?*)
|
||||
if [ "$1" = "--private-key" -a -n "$2" ]; then
|
||||
PRIVATEKEY="--private-key=$2"
|
||||
shift 2
|
||||
elif [ "$1" != "${1#--private-key=}" ]; then
|
||||
PRIVATEKEY="--private-key=${1#--private-key=}"
|
||||
shift 1
|
||||
else
|
||||
error 1 NEEDARG "option requires an argument %s" "$1"
|
||||
fi
|
||||
;;
|
||||
--no-check-certificate)
|
||||
CHECKCERTIF="--no-check-certificate"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
error 1 BADARG "unrecognized or invalid option %s" "$1"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ -n "$DISABLE_KEYRING" -a -n "$FORCE_KEYRING" ]; then
|
||||
error 1 BADARG "Both --no-check-gpg and --force-check-gpg specified, please pick one (at most)"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ "$SECOND_STAGE_ONLY" = "true" ]; then
|
||||
SUITE=$(cat $DEBOOTSTRAP_DIR/suite)
|
||||
ARCH=$(cat $DEBOOTSTRAP_DIR/arch)
|
||||
if [ -e $DEBOOTSTRAP_DIR/variant ]; then
|
||||
VARIANT=$(cat $DEBOOTSTRAP_DIR/variant)
|
||||
SUPPORTED_VARIANTS="$VARIANT"
|
||||
fi
|
||||
if [ -z "$CHROOTDIR" ]; then
|
||||
TARGET=/
|
||||
else
|
||||
TARGET=$CHROOTDIR
|
||||
fi
|
||||
SCRIPT=$DEBOOTSTRAP_DIR/suite-script
|
||||
else
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
usage_err 1 NEEDSUITETARGET "You must specify a suite and a target."
|
||||
fi
|
||||
SUITE="$1"
|
||||
TARGET="$2"
|
||||
USER_MIRROR="$3"
|
||||
TARGET="${TARGET%/}"
|
||||
if [ "${TARGET#/}" = "${TARGET}" ]; then
|
||||
if [ "${TARGET%/*}" = "$TARGET" ] ; then
|
||||
TARGET="$(echo "`pwd`/$TARGET")"
|
||||
else
|
||||
TARGET="$(cd "${TARGET%/*}"; echo "`pwd`/${TARGET##*/}")"
|
||||
fi
|
||||
fi
|
||||
|
||||
SCRIPT="$DEBOOTSTRAP_DIR/scripts/$1"
|
||||
if [ -n "$VARIANT" ] && [ -e "${SCRIPT}.${VARIANT}" ]; then
|
||||
SCRIPT="${SCRIPT}.${VARIANT}"
|
||||
SUPPORTED_VARIANTS="$VARIANT"
|
||||
fi
|
||||
if [ "$4" != "" ]; then
|
||||
SCRIPT="$4"
|
||||
fi
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if in_path dpkg && \
|
||||
dpkg --print-architecture >/dev/null 2>&1; then
|
||||
HOST_ARCH=`/usr/bin/dpkg --print-architecture`
|
||||
elif in_path udpkg && \
|
||||
udpkg --print-architecture >/dev/null 2>&1; then
|
||||
HOST_ARCH=`/usr/bin/udpkg --print-architecture`
|
||||
elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
|
||||
HOST_ARCH=`cat $DEBOOTSTRAP_DIR/arch`
|
||||
fi
|
||||
HOST_OS="$HOST_ARCH"
|
||||
# basic host OS guessing for non-Debian systems
|
||||
if [ -z "$HOST_OS" ]; then
|
||||
case `uname` in
|
||||
Linux)
|
||||
HOST_OS=linux
|
||||
;;
|
||||
GNU/kFreeBSD)
|
||||
HOST_OS=kfreebsd
|
||||
;;
|
||||
GNU)
|
||||
HOST_OS=hurd
|
||||
;;
|
||||
FreeBSD*)
|
||||
HOST_OS=freebsd
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
ARCH=$HOST_ARCH
|
||||
fi
|
||||
|
||||
if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then
|
||||
error 1 WHATARCH "Couldn't work out current architecture"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$HOST_OS" = "kfreebsd" ] || [ "$HOST_OS" = "freebsd" ]; then
|
||||
for module in linprocfs fdescfs tmpfs linsysfs; do
|
||||
kldstat -m "$module" > /dev/null 2>&1 || warning SANITYCHECK "Probably required module %s is not loaded" "$module"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$TARGET" = "/" ]; then
|
||||
CHROOT_CMD=""
|
||||
else
|
||||
CHROOT_CMD="chroot $TARGET"
|
||||
fi
|
||||
|
||||
if [ -z "$SHA_SIZE" ]; then
|
||||
SHA_SIZE=256
|
||||
fi
|
||||
if ! in_path "sha${SHA_SIZE}sum" && ! in_path "sha${SHA_SIZE}"; then
|
||||
SHA_SIZE=1
|
||||
fi
|
||||
DEBOOTSTRAP_CHECKSUM_FIELD="SHA$SHA_SIZE"
|
||||
|
||||
export ARCH SUITE TARGET CHROOT_CMD SHA_SIZE DEBOOTSTRAP_CHECKSUM_FIELD
|
||||
|
||||
if am_doing_phase first_stage second_stage; then
|
||||
if in_path id && [ `id -u` -ne 0 ]; then
|
||||
error 1 NEEDROOT "debootstrap can only run as root"
|
||||
fi
|
||||
# Ensure that we can create working devices and executables on the target.
|
||||
if ! check_sane_mount "$TARGET"; then
|
||||
error 1 NOEXEC "Cannot install into target '$TARGET' mounted with noexec or nodev"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "$SCRIPT" ]; then
|
||||
error 1 NOSCRIPT "No such script: %s" "$SCRIPT"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ "$TARGET" != "" ]; then
|
||||
mkdir -p "$TARGET/debootstrap"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
# Use of fd's by functions/scripts:
|
||||
#
|
||||
# stdin/stdout/stderr: used normally
|
||||
# fd 4: I:/W:/etc information
|
||||
# fd 5,6: spare for functions
|
||||
# fd 7,8: spare for scripts
|
||||
|
||||
if [ "$USE_DEBIANINSTALLER_INTERACTION" = yes ]; then
|
||||
# stdout=stderr: full log of debootstrap run
|
||||
# fd 3: I:/W:/etc information
|
||||
exec 4>&3
|
||||
elif am_doing_phase printdebs; then
|
||||
# stderr: I:/W:/etc information
|
||||
# stdout: debs needed
|
||||
exec 4>&2
|
||||
else
|
||||
# stderr: used in exceptional circumstances only
|
||||
# stdout: I:/W:/etc information
|
||||
# $TARGET/debootstrap/debootstrap.log: full log of debootstrap run
|
||||
exec 4>&1
|
||||
exec >>"$TARGET/debootstrap/debootstrap.log"
|
||||
exec 2>&1
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ "$UNPACK_TARBALL" ]; then
|
||||
if [ "${UNPACK_TARBALL#/}" = "$UNPACK_TARBALL" ]; then
|
||||
error 1 TARPATH "Tarball must be given a complete path"
|
||||
fi
|
||||
if [ "${UNPACK_TARBALL%.tar}" != "$UNPACK_TARBALL" ]; then
|
||||
(cd "$TARGET" && tar -xf "$UNPACK_TARBALL")
|
||||
elif [ "${UNPACK_TARBALL%.tgz}" != "$UNPACK_TARBALL" ]; then
|
||||
(cd "$TARGET" && zcat "$UNPACK_TARBALL" | tar -xf -)
|
||||
else
|
||||
error 1 NOTTAR "Unknown tarball: must be either .tar or .tgz"
|
||||
fi
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
. "$SCRIPT"
|
||||
|
||||
if [ "$SECOND_STAGE_ONLY" = "true" ]; then
|
||||
MIRRORS=null:
|
||||
else
|
||||
MIRRORS="$DEF_MIRROR"
|
||||
if [ "$USER_MIRROR" != "" ]; then
|
||||
MIRRORS="$USER_MIRROR"
|
||||
MIRRORS="${MIRRORS%/}"
|
||||
fi
|
||||
fi
|
||||
|
||||
export MIRRORS
|
||||
|
||||
ok=false
|
||||
for v in $SUPPORTED_VARIANTS; do
|
||||
if doing_variant $v; then ok=true; fi
|
||||
done
|
||||
if ! $ok; then
|
||||
error 1 UNSUPPVARIANT "unsupported variant"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if am_doing_phase finddebs; then
|
||||
if [ "$FINDDEBS_NEEDS_INDICES" = "true" ] || \
|
||||
[ "$RESOLVE_DEPS" = "true" ]; then
|
||||
download_indices
|
||||
GOT_INDICES=true
|
||||
fi
|
||||
|
||||
work_out_debs
|
||||
|
||||
base=$(without "$base $ADDITIONAL" "$EXCLUDE")
|
||||
|
||||
if [ "$RESOLVE_DEPS" = true ]; then
|
||||
requiredX=$(echo $(echo $required | tr ' ' '\n' | sort | uniq))
|
||||
baseX=$(echo $(echo $base | tr ' ' '\n' | sort | uniq))
|
||||
|
||||
baseN=$(without "$baseX" "$requiredX")
|
||||
baseU=$(without "$baseX" "$baseN")
|
||||
|
||||
if [ "$baseU" != "" ]; then
|
||||
info REDUNDANTBASE "Found packages in base already in required: %s" "$baseU"
|
||||
fi
|
||||
|
||||
info RESOLVEREQ "Resolving dependencies of required packages..."
|
||||
required=$(resolve_deps $requiredX)
|
||||
info RESOLVEBASE "Resolving dependencies of base packages..."
|
||||
base=$(resolve_deps $baseX)
|
||||
base=$(without "$base" "$required")
|
||||
|
||||
requiredX=$(without "$required" "$requiredX")
|
||||
baseX=$(without "$base" "$baseX")
|
||||
if [ "$requiredX" != "" ]; then
|
||||
info NEWREQUIRED "Found additional required dependencies: %s" "$requiredX"
|
||||
fi
|
||||
if [ "$baseX" != "" ]; then
|
||||
info NEWBASE "Found additional base dependencies: %s" "$baseX"
|
||||
fi
|
||||
fi
|
||||
|
||||
all_debs="$required $base"
|
||||
fi
|
||||
|
||||
if am_doing_phase printdebs; then
|
||||
echo "$all_debs"
|
||||
fi
|
||||
|
||||
if am_doing_phase dldebs; then
|
||||
if [ "$GOT_INDICES" != "true" ]; then
|
||||
download_indices
|
||||
fi
|
||||
download $all_debs
|
||||
fi
|
||||
|
||||
if am_doing_phase maketarball; then
|
||||
(cd $TARGET;
|
||||
tar czf - var/lib/apt var/cache/apt) >$MAKE_TARBALL
|
||||
fi
|
||||
|
||||
if am_doing_phase first_stage; then
|
||||
choose_extractor
|
||||
|
||||
# first stage sets up the chroot -- no calls should be made to
|
||||
# "chroot $TARGET" here; but they should be possible by the time it's
|
||||
# finished
|
||||
first_stage_install
|
||||
|
||||
if ! am_doing_phase second_stage; then
|
||||
cp "$0" "$TARGET/debootstrap/debootstrap"
|
||||
cp $DEBOOTSTRAP_DIR/functions "$TARGET/debootstrap/functions"
|
||||
cp $SCRIPT "$TARGET/debootstrap/suite-script"
|
||||
echo "$ARCH" >"$TARGET/debootstrap/arch"
|
||||
echo "$SUITE" >"$TARGET/debootstrap/suite"
|
||||
[ "" = "$VARIANT" ] ||
|
||||
echo "$VARIANT" >"$TARGET/debootstrap/variant"
|
||||
echo "$required" >"$TARGET/debootstrap/required"
|
||||
echo "$base" >"$TARGET/debootstrap/base"
|
||||
|
||||
chmod 755 "$TARGET/debootstrap/debootstrap"
|
||||
fi
|
||||
fi
|
||||
|
||||
if am_doing_phase second_stage; then
|
||||
if [ "$SECOND_STAGE_ONLY" = true ]; then
|
||||
required="$(cat $DEBOOTSTRAP_DIR/required)"
|
||||
base="$(cat $DEBOOTSTRAP_DIR/base)"
|
||||
all_debs="$required $base"
|
||||
fi
|
||||
|
||||
# second stage uses the chroot to clean itself up -- has to be able to
|
||||
# work from entirely within the chroot (in case we've booted into it,
|
||||
# possibly over NFS eg)
|
||||
|
||||
second_stage_install
|
||||
|
||||
# create sources.list
|
||||
# first, kill debootstrap.invalid sources.list
|
||||
if [ -e "$TARGET/etc/apt/sources.list" ]; then
|
||||
rm -f "$TARGET/etc/apt/sources.list"
|
||||
fi
|
||||
if [ "${MIRRORS#http://}" != "$MIRRORS" ]; then
|
||||
setup_apt_sources "${MIRRORS%% *}"
|
||||
mv_invalid_to "${MIRRORS%% *}"
|
||||
else
|
||||
setup_apt_sources "$DEF_MIRROR"
|
||||
mv_invalid_to "$DEF_MIRROR"
|
||||
fi
|
||||
|
||||
if [ -e "$TARGET/debootstrap/debootstrap.log" ]; then
|
||||
if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then
|
||||
cp "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log"
|
||||
else
|
||||
# debootstrap.log is still open as stdout/stderr and needs
|
||||
# to remain so, but after unlinking it some NFS servers
|
||||
# implement this by a temporary file in the same directory,
|
||||
# which makes it impossible to rmdir that directory.
|
||||
# Moving it instead works around the problem.
|
||||
mv "$TARGET/debootstrap/debootstrap.log" "$TARGET/var/log/bootstrap.log"
|
||||
fi
|
||||
fi
|
||||
sync
|
||||
|
||||
if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then
|
||||
if [ -x "$TARGET/debootstrap/debootstrap" ]; then
|
||||
chmod 644 "$TARGET/debootstrap/debootstrap"
|
||||
fi
|
||||
else
|
||||
rm -rf "$TARGET/debootstrap"
|
||||
fi
|
||||
fi
|
||||
|
||||
if am_doing_phase kill_target; then
|
||||
if [ "$KEEP_DEBOOTSTRAP_DIR" != true ]; then
|
||||
info KILLTARGET "Deleting target directory"
|
||||
rm -rf "$TARGET"
|
||||
fi
|
||||
fi
|
189
cdist/preos/debootstrap/files/devuan-debootstrap/debootstrap.8
Normal file
189
cdist/preos/debootstrap/files/devuan-debootstrap/debootstrap.8
Normal file
|
@ -0,0 +1,189 @@
|
|||
.TH DEBOOTSTRAP 8 2015-05-21 "Devuan Project" "Devuan GNU/Linux manual"
|
||||
.SH NAME
|
||||
debootstrap \- Bootstrap a basic Devuan system
|
||||
.SH SYNOPSIS
|
||||
.B debootstrap
|
||||
.RB [ OPTION\&.\&.\&. ]
|
||||
.I SUITE TARGET
|
||||
.RI [ MIRROR
|
||||
.RI [ SCRIPT ]]
|
||||
|
||||
.B debootstrap
|
||||
.RB [ OPTION\&.\&.\&. ]
|
||||
\-\-second\-stage
|
||||
.SH DESCRIPTION
|
||||
.B debootstrap
|
||||
bootstraps a basic Devuan system of
|
||||
.I SUITE
|
||||
into
|
||||
.I TARGET
|
||||
from
|
||||
.I MIRROR
|
||||
by running
|
||||
.IR SCRIPT .
|
||||
.I MIRROR
|
||||
can be an http:// or https:// URL, a file:/// URL, or an ssh:/// URL.
|
||||
.PP
|
||||
The
|
||||
.I SUITE
|
||||
may be a release code name (eg, ceres, ascii, jessie)
|
||||
or a symbolic name (eg, unstable, testing, stable, oldstable)
|
||||
.PP
|
||||
Notice that file:/ URLs are translated to file:/// (correct scheme as
|
||||
described in RFC1738 for local filenames), and file:// will \fBnot\fR work.
|
||||
ssh://USER@HOST/PATH URLs are retrieved using
|
||||
.BR scp ;
|
||||
use of
|
||||
.B ssh\-agent
|
||||
or similar is strongly recommended.
|
||||
.PP
|
||||
\fBDebootstrap\fR can be used to install Devuan in a system without using an
|
||||
installation disk but can also be used to run a different Devuan flavor in a \fBchroot\fR
|
||||
environment.
|
||||
This way you can create a full (minimal) Devuan installation which
|
||||
can be used for testing purposes (see the \fBEXAMPLES\fR section).
|
||||
If you are looking for a chroot system to build packages please take a look at
|
||||
\fBpbuilder\fR.
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
.IP "\fB\-\-arch=ARCH\fP"
|
||||
Set the target architecture (use if dpkg isn't installed).
|
||||
See also \-\-foreign.
|
||||
.IP
|
||||
.IP "\fB\-\-include=alpha,beta\fP"
|
||||
Comma separated list of packages which will be added to download and extract
|
||||
lists.
|
||||
.IP
|
||||
.IP "\fB\-\-exclude=alpha,beta\fP"
|
||||
Comma separated list of packages which will be removed from download and
|
||||
extract lists.
|
||||
WARNING: you can and probably will exclude essential packages, be
|
||||
careful using this option.
|
||||
.IP
|
||||
.IP "\fB\-\-components=alpha,beta\fP"
|
||||
Use packages from the listed components of the archive.
|
||||
.IP
|
||||
.IP "\fB\-\-no\-resolve\-deps\fP"
|
||||
By default, debootstrap will attempt to automatically resolve any missing
|
||||
dependencies, warning if any are found.
|
||||
Note that this is not a complete dependency resolve in the sense of dpkg
|
||||
or apt, and that it is far better to specify the entire base system than
|
||||
rely on this option.
|
||||
With this option set, this behaviour is disabled.
|
||||
.IP
|
||||
.IP "\fB\-\-variant=minbase|buildd|fakechroot\fP"
|
||||
Name of the bootstrap script variant to use.
|
||||
Currently, the variants supported are minbase, which only includes
|
||||
essential packages and apt; buildd, which installs the build-essential
|
||||
packages into
|
||||
.IR TARGET ;
|
||||
and fakechroot, which installs the packages without root privileges.
|
||||
The default, with no \fB\-\-variant=X\fP argument, is to create a base
|
||||
Devuan installation in
|
||||
.IR TARGET .
|
||||
.IP
|
||||
.IP "\fB\-\-merged-usr\fP"
|
||||
Create /{bin,sbin,lib}/ symlinks pointing to their counterparts in /usr/.
|
||||
.IP
|
||||
.IP "\fB\-\-no-merged-usr\fP"
|
||||
Do not create /{bin,sbin,lib}/ symlinks pointing to their counterparts in /usr/.
|
||||
(Default.)
|
||||
.IP
|
||||
.IP "\fB\-\-keyring=KEYRING\fP"
|
||||
Override the default keyring for the distribution being bootstrapped,
|
||||
and use
|
||||
.IR KEYRING
|
||||
to check signatures of retrieved Release files.
|
||||
.IP
|
||||
.IP "\fB\-\-no-check-gpg\fP"
|
||||
Disables checking gpg signatures of retrieved Release files.
|
||||
.IP
|
||||
.IP "\fB\-\-force-check-gpg\fP"
|
||||
Forces checking Release file signatures, disabling automatic fallback to
|
||||
HTTPS in case of a missing keyring. Incompatible with the previous option.
|
||||
.IP
|
||||
.IP "\fB\-\-verbose\fP"
|
||||
Produce more info about downloading.
|
||||
.IP
|
||||
.IP "\fB\-\-print\-debs\fP"
|
||||
Print the packages to be installed, and exit.
|
||||
Note that a TARGET directory must be specified so debootstrap can
|
||||
download Packages files to determine which packages should be installed,
|
||||
and to resolve dependencies.
|
||||
The TARGET directory will be deleted unless \-\-keep\-debootstrap\-dir
|
||||
is specified.
|
||||
.IP
|
||||
.IP "\fB\-\-download\-only\fP"
|
||||
Download packages, but don't perform installation.
|
||||
.IP
|
||||
.IP "\fB\-\-foreign\fP"
|
||||
Do the initial unpack phase of bootstrapping only, for example if the
|
||||
target architecture does not match the host architecture.
|
||||
A copy of debootstrap sufficient for completing the bootstrap process
|
||||
will be installed as /debootstrap/debootstrap in the target filesystem.
|
||||
You can run it with the \fB\-\-second\-stage\fP option to complete the
|
||||
bootstrapping process.
|
||||
.IP
|
||||
.IP "\fB\-\-second\-stage\fP"
|
||||
Complete the bootstrapping process.
|
||||
Other arguments are generally not needed.
|
||||
.IP
|
||||
.IP "\fB\-\-second\-stage\-target=DIR\fP"
|
||||
Run second stage in a subdirectory instead of root. (can be used to create
|
||||
a foreign chroot) (requires \-\-second\-stage)
|
||||
.IP
|
||||
.IP "\fB\-\-keep\-debootstrap\-dir\fP"
|
||||
Don't delete the /debootstrap directory in the target after completing the
|
||||
installation.
|
||||
.IP
|
||||
.IP "\fB\-\-unpack\-tarball=FILE\fP"
|
||||
Acquire .debs from tarball FILE instead of downloading via http.
|
||||
.IP
|
||||
.IP "\fB\-\-make\-tarball=FILE\fP"
|
||||
Instead of bootstrapping, make a tarball (written to FILE) of the downloaded
|
||||
packages.
|
||||
The resulting tarball may be passed to a later
|
||||
.BR \-\-unpack\-tarball .
|
||||
.IP
|
||||
.IP "\fB\-\-debian\-installer\fP"
|
||||
Used for internal purposes by the debian-installer
|
||||
.IP
|
||||
.IP "\fB\-\-extractor=TYPE\fP"
|
||||
Override automatic .deb extractor selection to
|
||||
.IR TYPE .
|
||||
Supported extractors are: dpkg-deb and ar.
|
||||
.IP
|
||||
.IP "\fB\-\-no\-check\-certificate\fP"
|
||||
Do not check certificate against certificate authorities
|
||||
.IP
|
||||
.IP "\fB\-\-certificate=FILE\fP"
|
||||
Use the client certificate stored in file (PEM)
|
||||
.IP
|
||||
.IP "\fB\-\-private\-key=FILE\fP"
|
||||
Read the private key from file
|
||||
|
||||
.SH EXAMPLES
|
||||
.
|
||||
.PP
|
||||
To setup an \fIascii\fR system:
|
||||
.PP
|
||||
debootstrap ascii ./ascii-chroot http://packages.devuan.org/merged
|
||||
.PP
|
||||
debootstrap ascii ./ascii-chroot file:///LOCAL_MIRROR/devuan
|
||||
.PP
|
||||
Full process to create a complete Devuan installation of \fIceres\fR (unstable)
|
||||
in a chroot:
|
||||
.PP
|
||||
main # debootstrap ceres ceres-root http://packages.devuan.org/merged
|
||||
[ ... watch it download the whole system ]
|
||||
main # echo "proc ceres-root/proc proc defaults 0 0" >> /etc/fstab
|
||||
main # mount proc ceres-root/proc -t proc
|
||||
main # echo "sysfs ceres-root/sys sysfs defaults 0 0" >> /etc/fstab
|
||||
main # mount sysfs ceres-root/sys -t sysfs
|
||||
main # cp /etc/hosts ceres-root/etc/hosts
|
||||
main # chroot ceres-root /bin/bash
|
||||
.SH AUTHOR
|
||||
.B debootstrap
|
||||
This manpage was originally written by Anthony Towns <ajt@debian.org>.
|
||||
and Matt Kraai <kraai@debian.org> for Debian.
|
||||
It was re-worked for Devuan by Daniel Reurich <daniel@centurion.net.nz>.
|
1735
cdist/preos/debootstrap/files/devuan-debootstrap/functions
Normal file
1735
cdist/preos/debootstrap/files/devuan-debootstrap/functions
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,202 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot minbase
|
||||
keyring /usr/share/keyrings/tanglu-archive-keyring.gpg
|
||||
default_mirror http://archive.tanglu.org/tanglu
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
kfreebsd-*) LIBC="libc0.1" ;;
|
||||
hurd-*) LIBC="libc0.3" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant - || doing_variant fakechroot; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
|
||||
# we want the Tanglu minimal dependency set to be installed
|
||||
base="$base tanglu-minimal"
|
||||
elif doing_variant buildd; then
|
||||
base="apt build-essential"
|
||||
elif doing_variant minbase; then
|
||||
base="apt"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# ldd.fake needs binutils
|
||||
required="$required binutils"
|
||||
fi
|
||||
|
||||
case $MIRRORS in
|
||||
https://*)
|
||||
base="$base apt-transport-https ca-certificates"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Maintainer: unknown
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
setup_dynamic_devices
|
||||
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-passwd
|
||||
x_core_install base-files
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
exec 7>&1
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
setup_available $required $base
|
||||
done_predeps=
|
||||
while predep=$(get_next_predep); do
|
||||
# We have to resolve dependencies of pre-dependencies manually because
|
||||
# dpkg --predep-package doesn't handle this.
|
||||
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
|
||||
# XXX: progress is tricky due to how dpkg_progress works
|
||||
# -- cjwatson 2009-07-29
|
||||
p; smallyes '' |
|
||||
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
|
||||
base=$(without "$base" "$predep")
|
||||
done_predeps="$done_predeps $predep"
|
||||
done
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/ascii
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/ascii
Symbolic link
|
@ -0,0 +1 @@
|
|||
ceres
|
|
@ -0,0 +1 @@
|
|||
aequorea
|
163
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/breezy
Normal file
163
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/breezy
Normal file
|
@ -0,0 +1,163 @@
|
|||
default_mirror http://old-releases.ubuntu.com/ubuntu
|
||||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant -; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
# TODO: add Build-Essential: yes extraoverrides
|
||||
#base="$(get_debs Build-Essential: yes)"
|
||||
|
||||
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
|
||||
|
||||
base="apt binutils cpio cpp cpp-4.0 dpkg-dev g++ g++-4.0 gcc gcc-4.0 gcc-4.0-base ${LIBC}-dev libdb4.2 libgdbm3 libstdc++6 libstdc++6-4.0-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
add ia64 base "libunwind7-dev"
|
||||
add sparc base "lib64gcc1"
|
||||
add sparc base "libc6-dev-sparc64"
|
||||
add sparc base "libc6-sparc64"
|
||||
fi
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
umount_on_exit /dev/.static/dev
|
||||
umount_on_exit /dev
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/buster
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/buster
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
218
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/ceres
Normal file
218
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/ceres
Normal file
|
@ -0,0 +1,218 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot minbase scratchbox
|
||||
keyring /usr/share/keyrings/devuan-archive-keyring.gpg
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
kfreebsd-*) LIBC="libc0.1" ;;
|
||||
hurd-*) LIBC="libc0.3" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
devuan_required="devuan-keyring devuan-baseconf sysvinit-core"
|
||||
devuan_remove="systemd systemd-sysv"
|
||||
|
||||
if doing_variant - || doing_variant fakechroot; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important) $devuan_required"
|
||||
elif doing_variant buildd || doing_variant scratchbox; then
|
||||
base="apt build-essential $devuan_required"
|
||||
elif doing_variant minbase; then
|
||||
base="apt $devuan_required"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# ldd.fake needs binutils
|
||||
required="$required binutils"
|
||||
fi
|
||||
|
||||
case $MIRRORS in
|
||||
https://*)
|
||||
base="$base apt-transport-https ca-certificates"
|
||||
;;
|
||||
esac
|
||||
#base=$(without "$base" "$devuan_remove")
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
case "$CODENAME" in
|
||||
jessie|jessie-kfreebsd) ;;
|
||||
*)
|
||||
EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k"
|
||||
setup_merged_usr
|
||||
;;
|
||||
esac
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
setup_dynamic_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(in_target dpkg-deb -f "$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Maintainer: unknown
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
elif doing_variant scratchbox; then
|
||||
true
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-passwd
|
||||
x_core_install base-files
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
exec 7>&1
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
|
||||
chmod 755 "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
setup_available $required $base
|
||||
done_predeps=
|
||||
while predep=$(get_next_predep); do
|
||||
# We have to resolve dependencies of pre-dependencies manually because
|
||||
# dpkg --predep-package doesn't handle this.
|
||||
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
|
||||
# XXX: progress is tricky due to how dpkg_progress works
|
||||
# -- cjwatson 2009-07-29
|
||||
p; smallyes '' |
|
||||
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
|
||||
base=$(without "$base" "$predep")
|
||||
done_predeps="$done_predeps $predep"
|
||||
done
|
||||
|
||||
if [ -n "$base" ]; then
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
|
||||
fi
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
rm -f "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
aequorea
|
168
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/dapper
Normal file
168
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/dapper
Normal file
|
@ -0,0 +1,168 @@
|
|||
case $ARCH in
|
||||
amd64|i386|powerpc|sparc)
|
||||
default_mirror http://archive.ubuntu.com/ubuntu
|
||||
;;
|
||||
*)
|
||||
default_mirror http://ports.ubuntu.com/ubuntu-ports
|
||||
;;
|
||||
esac
|
||||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant -; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
# TODO: add Build-Essential: yes extraoverrides
|
||||
#base="$(get_debs Build-Essential: yes)"
|
||||
|
||||
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
|
||||
|
||||
base="apt binutils cpio cpp cpp-4.0 dpkg-dev g++ g++-4.0 gcc gcc-4.0 ${LIBC}-dev libgdbm3 libstdc++6 libstdc++6-4.0-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
add ia64 base "libunwind7-dev"
|
||||
add sparc base "lib64gcc1"
|
||||
add sparc base "libc6-dev-sparc64"
|
||||
add sparc base "libc6-sparc64"
|
||||
fi
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
aequorea
|
187
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/edgy
Normal file
187
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/edgy
Normal file
|
@ -0,0 +1,187 @@
|
|||
case $ARCH in
|
||||
amd64|i386|powerpc|sparc)
|
||||
default_mirror http://archive.ubuntu.com/ubuntu
|
||||
;;
|
||||
*)
|
||||
default_mirror http://ports.ubuntu.com/ubuntu-ports
|
||||
;;
|
||||
esac
|
||||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant -; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
# TODO: add Build-Essential: yes extraoverrides
|
||||
#base="$(get_debs Build-Essential: yes)"
|
||||
|
||||
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
|
||||
|
||||
base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules"
|
||||
|
||||
add ia64 base "libunwind7-dev"
|
||||
add sparc base "lib64gcc1"
|
||||
add sparc base "libc6-dev-sparc64"
|
||||
add sparc base "libc6-sparc64"
|
||||
elif doing_variant fakechroot; then
|
||||
base="apt"
|
||||
fi
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# fix initscripts postinst (no mounting possible, and wrong if condition)
|
||||
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
|
||||
fi
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/etch
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/etch
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
|
@ -0,0 +1 @@
|
|||
sid
|
190
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/feisty
Normal file
190
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/feisty
Normal file
|
@ -0,0 +1,190 @@
|
|||
case $ARCH in
|
||||
amd64|i386|powerpc|sparc)
|
||||
default_mirror http://archive.ubuntu.com/ubuntu
|
||||
;;
|
||||
*)
|
||||
default_mirror http://ports.ubuntu.com/ubuntu-ports
|
||||
;;
|
||||
esac
|
||||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant -; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
# TODO: add Build-Essential: yes extraoverrides
|
||||
#base="$(get_debs Build-Essential: yes)"
|
||||
|
||||
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; }
|
||||
|
||||
base="apt binutils cpio cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 ${LIBC}-dev libdb4.4 libgdbm3 libstdc++6 libstdc++6-4.1-dev linux-libc-dev make patch perl perl-modules"
|
||||
|
||||
add ia64 base "libunwind7-dev"
|
||||
add sparc base "lib64gcc1"
|
||||
add sparc base "libc6-dev-sparc64"
|
||||
add sparc base "libc6-sparc64"
|
||||
elif doing_variant fakechroot; then
|
||||
base="apt"
|
||||
fi
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# fix initscripts postinst (no mounting possible, and wrong if condition)
|
||||
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
|
||||
|
||||
# kill libdevmapper postinst; it tries to create /dev/mapper/
|
||||
rm "$TARGET/var/lib/dpkg/info/libdevmapper1"*.postinst
|
||||
fi
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
230
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/gutsy
Normal file
230
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/gutsy
Normal file
|
@ -0,0 +1,230 @@
|
|||
case $ARCH in
|
||||
amd64|i386)
|
||||
default_mirror http://archive.ubuntu.com/ubuntu
|
||||
;;
|
||||
sparc)
|
||||
case $SUITE in
|
||||
gutsy)
|
||||
default_mirror http://archive.ubuntu.com/ubuntu
|
||||
;;
|
||||
*)
|
||||
default_mirror http://ports.ubuntu.com/ubuntu-ports
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
default_mirror http://ports.ubuntu.com/ubuntu-ports
|
||||
;;
|
||||
esac
|
||||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot minbase
|
||||
keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
kfreebsd-*) LIBC="libc0.1" ;;
|
||||
hurd-*) LIBC="libc0.3" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant -; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
base="$(get_debs Build-Essential: yes)"
|
||||
elif doing_variant fakechroot || doing_variant minbase; then
|
||||
base="apt"
|
||||
fi
|
||||
|
||||
case $MIRRORS in
|
||||
https://*)
|
||||
base="$base apt-transport-https ca-certificates"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-passwd
|
||||
x_core_install base-files
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/Etc/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# fix initscripts postinst (no mounting possible, and wrong if condition)
|
||||
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
|
||||
fi
|
||||
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
|
||||
chmod 755 "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
if [ -x "$TARGET/sbin/initctl" ]; then
|
||||
mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi
|
||||
echo
|
||||
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
|
||||
chmod 755 "$TARGET/sbin/initctl"
|
||||
fi
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
setup_available $required $base
|
||||
done_predeps=
|
||||
while predep=$(get_next_predep); do
|
||||
# We have to resolve dependencies of pre-dependencies manually because
|
||||
# dpkg --predep-package doesn't handle this.
|
||||
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
|
||||
# XXX: progress is tricky due to how dpkg_progress works
|
||||
# -- cjwatson 2009-07-29
|
||||
p; smallyes '' |
|
||||
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
|
||||
base=$(without "$base" "$predep")
|
||||
done_predeps="$done_predeps $predep"
|
||||
done
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
if [ -x "$TARGET/sbin/initctl.REAL" ]; then
|
||||
mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl"
|
||||
fi
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
rm -f "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/hardy
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/hardy
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
179
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/hoary
Normal file
179
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/hoary
Normal file
|
@ -0,0 +1,179 @@
|
|||
default_mirror http://old-releases.ubuntu.com/ubuntu
|
||||
mirror_style release
|
||||
download_style apt
|
||||
|
||||
case $ARCH in
|
||||
ia64) LIBC="libc6.1" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk mount ncurses-base ncurses-bin passwd perl-base procps python-minimal python2.4-minimal sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5"
|
||||
|
||||
base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject ethtool evms evms-ncurses fdutils file ftp gettext-base gnupg grepmap groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.5 libfribidi0 libgc1 libgcrypt11 libgdbm3 libgnutls11 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-12 libpcap0.8 libreiserfs0.3-0 libsasl2 libsasl2-modules libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lsb-release lshw lsof lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.4 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base ubuntu-keyring udev usbutils vim vim-common w3m wget wireless-tools xfsprogs"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"i386")
|
||||
required="$required libc6 libc6-i686"
|
||||
base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4"
|
||||
;;
|
||||
"powerpc")
|
||||
required="$required libc6 libreadline4"
|
||||
base="$base hfsplus hfsutils libelfg0 libhfsp0 ltrace mac-fdisk pmac-fdisk powerpc-utils"
|
||||
;;
|
||||
"amd64")
|
||||
required="$required libc6"
|
||||
base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4"
|
||||
;;
|
||||
"ia64")
|
||||
required="$required libc6.1 libunwind7"
|
||||
base="$base dmidecode libreadline4"
|
||||
;;
|
||||
"sparc")
|
||||
required="$required libc6"
|
||||
base="$base lib64gcc1 libc6-sparc64 libreadline4"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_debs () {
|
||||
first_stage_install
|
||||
second_stage_install
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
setup_proc
|
||||
umount_on_exit /.dev
|
||||
umount_on_exit /dev
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
x_core_install debconf
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $required; echo $#)"
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
#on_exit "(in_target_nofail umount /dev/pts) || true"
|
||||
|
||||
smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL"
|
||||
ln -s /bin/true "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
default_mirror http://old-releases.ubuntu.com/ubuntu
|
||||
mirror_style release
|
||||
download_style apt
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin passwd perl-base pkgstriptranslations python-minimal python2.4-minimal sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
|
||||
|
||||
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"amd64")
|
||||
;;
|
||||
"i386")
|
||||
;;
|
||||
"powerpc")
|
||||
;;
|
||||
"ia64")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
base="$base libunwind7 libunwind7-dev"
|
||||
;;
|
||||
|
||||
# Unsupported architectures:
|
||||
"alpha")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_debs () {
|
||||
first_stage_install
|
||||
second_stage_install
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
#on_exit "in_target_nofail umount /dev/pts"
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29
|
||||
|
||||
info INSTCORE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTCORE "Installing core packages" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/jaunty
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/jaunty
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/jessie
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/jessie
Symbolic link
|
@ -0,0 +1 @@
|
|||
ceres
|
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/karmic
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/karmic
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/lenny
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/lenny
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/lucid
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/lucid
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/natty
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/natty
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
|
@ -0,0 +1 @@
|
|||
sid
|
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/oneiric
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/oneiric
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
104
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/potato
Normal file
104
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/potato
Normal file
|
@ -0,0 +1,104 @@
|
|||
mirror_style release
|
||||
download_style apt var-state
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = alpha ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
required="base-files base-passwd bash bsdutils debconf-tiny debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname ldso libc6 libdb2 libgdbmg1 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libpopt0 libreadline4 libstdc++2.10 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-5.005-base perl-base procps sed shellutils slang1 sysklogd sysvinit tar textutils update util-linux whiptail"
|
||||
|
||||
base="adduser ae apt base-config elvis-tiny fbset fdutils gettext-base console-data console-tools console-tools-libs libdb2 libwrap0 locales modconf netbase ftp ppp pppconfig pump tasksel tcpd textutils telnet xviddetect"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(without_package "libc6" "$required") libc6.1"
|
||||
;;
|
||||
"i386")
|
||||
base="$base fdflush isapnptools lilo mbr pciutils pcmcia-cs psmisc setserial syslinux"
|
||||
;;
|
||||
*)
|
||||
# other arches may have special needs not yet represented here
|
||||
# oh well, Potato is old
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
:> "$TARGET/var/lib/dpkg/status"
|
||||
echo > "$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
|
||||
x_feign_install () {
|
||||
local pkg=$1
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install dpkg
|
||||
|
||||
if [ -e "$TARGET/usr/bin/perl-5.005.dist" ]; then
|
||||
mv "$TARGET/usr/bin/perl-5.005.dist" "$TARGET/usr/bin/perl-5.005"
|
||||
fi
|
||||
if [ ! -e "$TARGET/usr/bin/perl" ]; then
|
||||
ln -sf perl-5.005 "$TARGET/usr/bin/perl"
|
||||
fi
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
export DEBIAN_FRONTEND=Noninteractive
|
||||
|
||||
setup_proc
|
||||
ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig"
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
x_core_install base-files base-passwd ldso
|
||||
x_core_install dpkg
|
||||
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
x_core_install $LIBC
|
||||
|
||||
smallyes '' | x_core_install perl-5.005-base
|
||||
x_core_install mawk
|
||||
x_core_install debconf-tiny
|
||||
|
||||
in_target dpkg-preconfigure $(debfor $required $base)
|
||||
|
||||
repeatn 5 in_target dpkg --force-depends --unpack $(debfor $required)
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
cp "$TARGET/bin/true" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
in_target dpkg --configure --pending --force-configure-any --force-depends
|
||||
|
||||
smallyes '' | repeatn 5 in_target dpkg --force-auto-select --force-overwrite --skip-same-version --install $(debfor $base)
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/precise
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/precise
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/quantal
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/quantal
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/raring
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/raring
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
218
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/sarge
Normal file
218
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/sarge
Normal file
|
@ -0,0 +1,218 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libperl5.8 libpopt0 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 initscripts sysvinit sysv-rc tar util-linux whiptail libgcc1 gcc-3.3-base libstdc++5"
|
||||
|
||||
base="adduser apt apt-utils libdb4.2 at base-config aptitude libsigc++-1.2-5c102 bsdmainutils console-common console-tools libconsole console-data cpio cron dhcp-client ed exim4 exim4-base exim4-config exim4-daemon-light libgcrypt11 libgnutls11 libgpg-error0 libopencdk8 libtasn1-2 fdutils gettext-base groff-base ifupdown info klogd libssl0.9.7 liblzo1 zlib1g liblockfile1 libpcre3 libwrap0 logrotate mailx man-db libgdbm3 manpages nano net-tools netbase netkit-inetd iputils-ping nvi ppp pppconfig pppoe pppoeconf libpcap0.7 sysklogd tasksel libtextwrap1 tcpd telnet libtext-iconv-perl wget"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
IPFWTOOL=iptables
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$base pciutils"
|
||||
IPFWTOOL="ipchains"
|
||||
;;
|
||||
"arm")
|
||||
base="$base libgpmg1"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"i386")
|
||||
required="$(without_package "libperl5.8" "$required")"
|
||||
base="$base pciutils psmisc"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"ia64")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required") libreadline4"
|
||||
base="$base elilo efibootmgr dosfstools libparted1.6-12 parted"
|
||||
;;
|
||||
"m68k")
|
||||
required="$required libreadline4"
|
||||
base="$base atari-bootstrap atari-fdisk amiga-fdisk eject mac-fdisk pmac-fdisk-cross vmelilo"
|
||||
IPFWTOOL="ipchains"
|
||||
;;
|
||||
"powerpc")
|
||||
required="$required libreadline4"
|
||||
base="$base mac-fdisk amiga-fdisk psmisc powerpc-utils pciutils hfsutils"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"sparc")
|
||||
base="$base silo eject pciutils sparc-utils"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"mips")
|
||||
base="$base dvhtool pciutils"
|
||||
;;
|
||||
"mipsel")
|
||||
base="$base pciutils"
|
||||
;;
|
||||
"hppa")
|
||||
base="$base palo pciutils"
|
||||
required="$(without_package "libstdc++2.10-glibc2.2" "$required")"
|
||||
;;
|
||||
s390|s390x)
|
||||
# base-config depends on console-tools and console-data
|
||||
# so we can't exclude them although they are useless on s390
|
||||
base="$base s390-tools telnetd devfsd"
|
||||
base="$(without_package "console-tools-libs" "$base")"
|
||||
base="$(without_package "fdutils" "$base")"
|
||||
base="$(without_package "ppp" "$base")"
|
||||
base="$(without_package "pppconfig" "$base")"
|
||||
base="$(without_package "pppoe" "$base")"
|
||||
base="$(without_package "pppoeconf" "$base")"
|
||||
;;
|
||||
sh*)
|
||||
base="$base libstdc++3 gcc-3.0-base"
|
||||
base="$(without_package "fdutils" "$base")"
|
||||
required="$required libgcc1"
|
||||
required="$(without_package "libstdc++2.10-glibc2.2" "$required")"
|
||||
;;
|
||||
"amd64")
|
||||
base="$base pciutils psmisc"
|
||||
IPFWTOOL="iptables"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
|
||||
base="$base $IPFWTOOL"
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #7
|
||||
x_core_install debconf
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #29
|
||||
|
||||
# if [ ! -e "$TARGET/etc/exim/exim.conf" ]; then
|
||||
# mkdir -p "$TARGET/etc/exim"
|
||||
# touch "$TARGET/etc/exim/exim.conf"
|
||||
# fi
|
||||
|
||||
info INSTBASE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
ln -sf /bin/true "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
ln -sf exim4 "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
p 9; progress $baseprog $bases INSTBASE "Installing base system" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTBASE "Installing base system" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login mawk mount ncurses-base ncurses-bin passwd perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
|
||||
|
||||
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
"arm")
|
||||
;;
|
||||
"i386")
|
||||
;;
|
||||
"ia64")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
"m68k")
|
||||
;;
|
||||
"powerpc")
|
||||
;;
|
||||
"sparc")
|
||||
;;
|
||||
"mips")
|
||||
;;
|
||||
"mipsel")
|
||||
;;
|
||||
"hppa")
|
||||
;;
|
||||
s390|s390x)
|
||||
;;
|
||||
sh*)
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #7
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #29
|
||||
|
||||
info INSTBASE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
p 9; progress $baseprog $bases INSTBASE "Installing base system" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTBASE "Installing base system" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
|
||||
mirror_style release
|
||||
download_style apt
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login mawk mount ncurses-base ncurses-bin passwd perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
|
||||
|
||||
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
required="$required binutils fakechroot"
|
||||
base="$(without_package "binutils" "$base")"
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
"arm")
|
||||
;;
|
||||
"i386")
|
||||
;;
|
||||
"ia64")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
"m68k")
|
||||
;;
|
||||
"powerpc")
|
||||
;;
|
||||
"sparc")
|
||||
;;
|
||||
"mips")
|
||||
;;
|
||||
"mipsel")
|
||||
;;
|
||||
"hppa")
|
||||
;;
|
||||
s390|s390x)
|
||||
;;
|
||||
sh*)
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_devices_fakechroot
|
||||
setup_proc_fakechroot
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
install_fakechroot_tools
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #7
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #29
|
||||
|
||||
info INSTBASE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
p 9; progress $baseprog $bases INSTBASE "Installing base system" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTBASE "Installing base system" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/saucy
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/saucy
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
214
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/sid
Normal file
214
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/sid
Normal file
|
@ -0,0 +1,214 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
finddebs_style from-indices
|
||||
variants - buildd fakechroot minbase
|
||||
keyring /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
|
||||
fi
|
||||
|
||||
case $ARCH in
|
||||
alpha|ia64) LIBC="libc6.1" ;;
|
||||
kfreebsd-*) LIBC="libc0.1" ;;
|
||||
hurd-*) LIBC="libc0.3" ;;
|
||||
*) LIBC="libc6" ;;
|
||||
esac
|
||||
|
||||
work_out_debs () {
|
||||
required="$(get_debs Priority: required)"
|
||||
|
||||
if doing_variant - || doing_variant fakechroot; then
|
||||
#required="$required $(get_debs Priority: important)"
|
||||
# ^^ should be getting debconf here somehow maybe
|
||||
base="$(get_debs Priority: important)"
|
||||
elif doing_variant buildd; then
|
||||
base="apt build-essential"
|
||||
elif doing_variant minbase; then
|
||||
base="apt"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
# ldd.fake needs binutils
|
||||
required="$required binutils"
|
||||
fi
|
||||
|
||||
case $MIRRORS in
|
||||
https://*)
|
||||
base="$base apt-transport-https ca-certificates"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
case "$CODENAME" in
|
||||
etch|etch-m68k|jessie|jessie-kfreebsd|lenny|squeeze|wheezy) ;;
|
||||
*)
|
||||
EXTRACT_DEB_TAR_OPTIONS="$EXTRACT_DEB_TAR_OPTIONS -k"
|
||||
setup_merged_usr
|
||||
;;
|
||||
esac
|
||||
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
: >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
setup_dynamic_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(in_target dpkg-deb -f "$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Maintainer: unknown
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
setup_proc_fakechroot
|
||||
else
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-passwd
|
||||
x_core_install base-files
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
if doing_variant fakechroot; then
|
||||
install_fakechroot_tools
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
if doing_variant -; then
|
||||
x_core_install debconf
|
||||
fi
|
||||
|
||||
baseprog=0
|
||||
bases=$(set -- $required; echo $#)
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
exec 7>&1
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
|
||||
chmod 755 "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
smallyes '' |
|
||||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
|
||||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
setup_available $required $base
|
||||
done_predeps=
|
||||
while predep=$(get_next_predep); do
|
||||
# We have to resolve dependencies of pre-dependencies manually because
|
||||
# dpkg --predep-package doesn't handle this.
|
||||
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
|
||||
# XXX: progress is tricky due to how dpkg_progress works
|
||||
# -- cjwatson 2009-07-29
|
||||
p; smallyes '' |
|
||||
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
|
||||
base=$(without "$base" "$predep")
|
||||
done_predeps="$done_predeps $predep"
|
||||
done
|
||||
|
||||
if [ -n "$base" ]; then
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
smallyes '' |
|
||||
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
|
||||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
|
||||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
|
||||
fi
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
rm -f "$TARGET/usr/sbin/policy-rc.d"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/squeeze
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/squeeze
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/stable
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/stable
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/stretch
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/stretch
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/testing
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/testing
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/trusty
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/trusty
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/utopic
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/utopic
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/vivid
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/vivid
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
166
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/warty
Normal file
166
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/warty
Normal file
|
@ -0,0 +1,166 @@
|
|||
default_mirror http://old-releases.ubuntu.com/ubuntu
|
||||
mirror_style release
|
||||
download_style apt
|
||||
|
||||
LIBC=libc6
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libc6 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5"
|
||||
|
||||
base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dbus-1 dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject evms evms-ncurses fdutils file ftp gettext-base gnupg groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libatm1 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.3 libexpat1 libfribidi0 libgc1 libgcrypt7 libgdbm3 libgnutls10 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-0 libpcap0.7 libpcap0.8 libreiserfs0.3-0 libsasl2 libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lshw lsof ltrace lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.3 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base udev usbutils vim vim-common w3m wget wireless-tools xfsprogs"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"i386")
|
||||
required="$required libc6-i686"
|
||||
base="$base dmidecode memtest86+ libreadline4"
|
||||
;;
|
||||
"powerpc")
|
||||
required="$required libreadline4"
|
||||
base="$base hfsplus hfsutils libhfsp0 mac-fdisk pmac-fdisk powerpc-utils"
|
||||
;;
|
||||
"amd64")
|
||||
base="$base dmidecode libreadline4"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_debs () {
|
||||
first_stage_install
|
||||
second_stage_install
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
baseprog=0
|
||||
bases=7
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
x_core_install debconf
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $required; echo $#)"
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
#on_exit "(in_target_nofail umount /dev/pts) || true"
|
||||
|
||||
smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
bases="$(set -- $base; echo $#)"
|
||||
|
||||
info UNPACKBASE "Unpacking the base system..."
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
|
||||
|
||||
baseprog=0
|
||||
|
||||
info CONFBASE "Configuring the base system..."
|
||||
|
||||
mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL"
|
||||
ln -s /bin/true "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases CONFBASE "Configuring base system"
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
default_mirror http://old-releases.ubuntu.com/ubuntu
|
||||
mirror_style release
|
||||
download_style apt
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin perl-base sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g"
|
||||
|
||||
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
subst_package () {
|
||||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"amd64")
|
||||
;;
|
||||
"i386")
|
||||
;;
|
||||
"powerpc")
|
||||
;;
|
||||
|
||||
# Unsupported architectures:
|
||||
"alpha")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
"ia64")
|
||||
required="$(subst_package "libc6" "libc6.1" "$required")"
|
||||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_debs () {
|
||||
first_stage_install
|
||||
second_stage_install
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
#on_exit "in_target_nofail umount /dev/pts"
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29
|
||||
|
||||
info INSTCORE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTCORE "Installing core packages" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTCORE "Installing core packages" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/wheezy
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/wheezy
Symbolic link
|
@ -0,0 +1 @@
|
|||
sid
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/wily
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/wily
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
203
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/woody
Normal file
203
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/woody
Normal file
|
@ -0,0 +1,203 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils debconf debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libcap1 libc6 libdb2 libdb3 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libperl5.6 libpopt0 libreadline4 libstdc++2.10-glibc2.2 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed shellutils slang1 sysvinit tar textutils util-linux whiptail"
|
||||
|
||||
base="adduser apt apt-utils at base-config bsdmainutils console-common console-tools console-tools-libs console-data cpio cron dhcp-client ed exim fdutils gettext-base groff-base ifupdown info klogd libident libldap2 liblockfile1 libpcre3 libsasl7 libwrap0 logrotate mailx man-db manpages modconf nano net-tools netbase netkit-inetd netkit-ping nvi ppp pppconfig pppoe pppoeconf libpcap0 sysklogd tasksel tcpd telnet"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
|
||||
IPFWTOOL=iptables
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(without_package "libc6" "$required") libc6.1"
|
||||
base="$base setserial aboot pciutils"
|
||||
IPFWTOOL="ipchains"
|
||||
;;
|
||||
"arm")
|
||||
base="$base setserial libgpmg1"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"i386")
|
||||
required="$(without_package "libperl5.6" "$required") mbr"
|
||||
base="$base lilo pciutils setserial syslinux psmisc pcmcia-cs"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"ia64")
|
||||
required="$(without_package "libc6" "$required") libc6.1 gcc-2.96-base"
|
||||
base="$base elilo efibootmgr dosfstools libparted1.4 parted"
|
||||
;;
|
||||
"m68k")
|
||||
base="$base atari-bootstrap atari-fdisk amiga-fdisk eject mac-fdisk pmac-fdisk-cross setserial vmelilo"
|
||||
IPFWTOOL="ipchains"
|
||||
;;
|
||||
"powerpc")
|
||||
base="$base quik mac-fdisk amiga-fdisk psmisc powerpc-utils setserial pciutils hfsutils yaboot pcmcia-cs"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"sparc")
|
||||
base="$base silo eject pciutils sparc-utils"
|
||||
IPFWTOOL="ipchains iptables"
|
||||
;;
|
||||
"mips")
|
||||
base="$base dvhtool pciutils setserial" # pcmcia-cs
|
||||
;;
|
||||
"mipsel")
|
||||
base="$base delo pciutils setserial" # pcmcia-cs
|
||||
;;
|
||||
"hppa")
|
||||
base="$base palo libstdc++3 gcc-3.0-base"
|
||||
required="$(without_package "libstdc++2.10-glibc2.2" "$required")"
|
||||
;;
|
||||
s390|s390x)
|
||||
# base-config depends on console-data and console-common
|
||||
# so we can't exclude them although they are useless on s390
|
||||
base="$base s390-tools telnetd devfsd"
|
||||
base="$(without_package "console-tools" "$base")"
|
||||
base="$(without_package "console-tools-libs" "$base")"
|
||||
base="$(without_package "fdutils" "$base")"
|
||||
base="$(without_package "ppp" "$base")"
|
||||
base="$(without_package "pppconfig" "$base")"
|
||||
base="$(without_package "pppoe" "$base")"
|
||||
base="$(without_package "pppoeconf" "$base")"
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
|
||||
base="$base $IPFWTOOL"
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=Noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #7
|
||||
x_core_install debconf
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #29
|
||||
|
||||
if [ ! -e "$TARGET/etc/exim/exim.conf" ]; then
|
||||
mkdir -p "$TARGET/etc/exim"
|
||||
touch "$TARGET/etc/exim/exim.conf"
|
||||
fi
|
||||
|
||||
info INSTBASE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
ln -sf /bin/true "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
rm -f "$TARGET/usr/sbin/sendmail"
|
||||
ln -sf exim "$TARGET/usr/sbin/sendmail"
|
||||
|
||||
p 9; progress $baseprog $bases INSTBASE "Installing base system" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTBASE "Installing base system" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
mirror_style release
|
||||
download_style apt
|
||||
force_md5
|
||||
|
||||
LIBC=libc6
|
||||
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
|
||||
LIBC="libc6.1"
|
||||
fi
|
||||
|
||||
work_out_debs () {
|
||||
|
||||
required="base-files base-passwd bash bsdutils debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libc6 libcap1 libdb3 libgdbmg1 libncurses5 libpam-modules libpam-runtime libpam0g libperl5.6 libstdc++2.10-glibc2.2 login mawk mount ncurses-base ncurses-bin perl-base sed shellutils slang1 sysvinit tar textutils util-linux"
|
||||
|
||||
base="apt binutils cpio cpp cpp-2.95 debconf dpkg-dev g++ g++-2.95 gcc gcc-2.95 libc6-dev libdb2 libstdc++2.10-dev make patch perl perl-modules"
|
||||
|
||||
without_package () {
|
||||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
|
||||
}
|
||||
|
||||
case $ARCH in
|
||||
"alpha")
|
||||
required="$(without_package "libc6" "$required") libc6.1"
|
||||
base="$(without_package "libc6-dev" "$base") libc6.1-dev"
|
||||
;;
|
||||
"arm")
|
||||
;;
|
||||
"i386")
|
||||
;;
|
||||
"ia64")
|
||||
required="$(without_package "libc6" "$required") libc6.1 gcc-2.96-base libreadline4"
|
||||
base="$(without_package "cpp-2.95" "$base") cpp-2.96"
|
||||
base="$(without_package "gcc-2.95" "$base") gcc-2.96"
|
||||
base="$(without_package "g++-2.95" "$base") g++-2.96"
|
||||
base="$(without_package "libc6-dev" "$base") libc6.1-dev elilo efibootmgr dosfstools libparted1.4 parted"
|
||||
;;
|
||||
"m68k")
|
||||
;;
|
||||
"powerpc")
|
||||
;;
|
||||
"sparc")
|
||||
;;
|
||||
"mips")
|
||||
;;
|
||||
"mipsel")
|
||||
;;
|
||||
"hppa")
|
||||
;;
|
||||
s390|s390x)
|
||||
;;
|
||||
sh*)
|
||||
;;
|
||||
*)
|
||||
# who knows?
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
first_stage_install () {
|
||||
extract $required
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg"
|
||||
: >"$TARGET/var/lib/dpkg/status"
|
||||
echo >"$TARGET/var/lib/dpkg/available"
|
||||
|
||||
setup_etc
|
||||
if [ ! -e "$TARGET/etc/fstab" ]; then
|
||||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
|
||||
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
|
||||
fi
|
||||
|
||||
setup_devices
|
||||
|
||||
x_feign_install () {
|
||||
local pkg="$1"
|
||||
local deb="$(debfor $pkg)"
|
||||
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
|
||||
|
||||
mkdir -p "$TARGET/var/lib/dpkg/info"
|
||||
|
||||
echo \
|
||||
"Package: $pkg
|
||||
Version: $ver
|
||||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
|
||||
|
||||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
|
||||
}
|
||||
|
||||
x_feign_install dpkg
|
||||
}
|
||||
|
||||
second_stage_install () {
|
||||
x_core_install () {
|
||||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
|
||||
}
|
||||
|
||||
p () {
|
||||
baseprog="$(($baseprog + ${1:-1}))"
|
||||
}
|
||||
|
||||
setup_proc
|
||||
in_target /sbin/ldconfig
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
baseprog=0
|
||||
bases=40
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #1
|
||||
info INSTCORE "Installing core packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #2
|
||||
ln -sf mawk "$TARGET/usr/bin/awk"
|
||||
x_core_install base-files base-passwd
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #3
|
||||
x_core_install dpkg
|
||||
|
||||
if [ ! -e "$TARGET/etc/localtime" ]; then
|
||||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
|
||||
fi
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #4
|
||||
x_core_install $LIBC
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #5
|
||||
x_core_install perl-base
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #6
|
||||
rm "$TARGET/usr/bin/awk"
|
||||
x_core_install mawk
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #7
|
||||
|
||||
info UNPACKREQ "Unpacking required packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #8
|
||||
smallyes '' | repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required)
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #18
|
||||
|
||||
info CONFREQ "Configuring required packages..."
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
|
||||
echo \
|
||||
"#!/bin/sh
|
||||
echo
|
||||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
|
||||
chmod 755 "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
setup_dselect_method apt
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #19
|
||||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends
|
||||
p 10; progress $baseprog $bases INSTBASE "Installing base system" #29
|
||||
|
||||
info INSTBASE "Installing base packages..."
|
||||
|
||||
p; progress $baseprog $bases INSTBASE "Installing base system" #30
|
||||
smallyes '' | repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base)
|
||||
|
||||
smallyes '' | repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a
|
||||
|
||||
p 9; progress $baseprog $bases INSTBASE "Installing base system" #39
|
||||
|
||||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
|
||||
|
||||
progress $bases $bases INSTBASE "Installing base system" #40
|
||||
info BASESUCCESS "Base system installed successfully."
|
||||
}
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/xenial
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/xenial
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/yakkety
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/yakkety
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/zesty
Symbolic link
1
cdist/preos/debootstrap/files/devuan-debootstrap/scripts/zesty
Symbolic link
|
@ -0,0 +1 @@
|
|||
gutsy
|
39
cdist/preos/debootstrap/files/init-manifest-debian
Normal file
39
cdist/preos/debootstrap/files/init-manifest-debian
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# basic init manifest for PreOS config
|
||||
|
||||
for pkg in \
|
||||
file \
|
||||
linux-image-amd64 \
|
||||
lsb-release \
|
||||
dosfstools \
|
||||
gdisk \
|
||||
openssh-server curl \
|
||||
pxelinux syslinux-common \
|
||||
gdisk util-linux lvm2 mdadm \
|
||||
btrfs-tools e2fsprogs jfsutils reiser4progs xfsprogs; do
|
||||
__package $pkg --state present
|
||||
done
|
||||
|
||||
# initramfs requires /init
|
||||
__link /init --source /sbin/init --type symbolic
|
||||
|
||||
__file /etc/network/interfaces --source - --mode 0644 << eof
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
eof
|
||||
|
||||
# Steven found this out - coyping it 1:1
|
||||
# fix the bloody 'stdin: is not a tty' problem
|
||||
__line /root/.profile --line 'mesg n' --state absent
|
||||
|
||||
# skipped for now, in case of systemd __hostname uses
|
||||
# hostnamectl for setting hostname and it needs dbus running
|
||||
# __hostname --name preos
|
||||
# hostname setting is currently done before this configuration
|
39
cdist/preos/debootstrap/files/init-manifest-devuan
Normal file
39
cdist/preos/debootstrap/files/init-manifest-devuan
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# basic init manifest for PreOS config
|
||||
|
||||
for pkg in \
|
||||
file \
|
||||
linux-image-amd64 \
|
||||
lsb-release \
|
||||
dosfstools \
|
||||
gdisk \
|
||||
openssh-server curl \
|
||||
pxelinux syslinux-common \
|
||||
gdisk util-linux lvm2 mdadm \
|
||||
btrfs-tools e2fsprogs jfsutils reiser4progs xfsprogs; do
|
||||
__package $pkg --state present
|
||||
done
|
||||
|
||||
# initramfs requires /init
|
||||
__link /init --source /sbin/init --type symbolic
|
||||
|
||||
__file /etc/network/interfaces --source - --mode 0644 << eof
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
eof
|
||||
|
||||
# Steven found this out - coyping it 1:1
|
||||
# fix the bloody 'stdin: is not a tty' problem
|
||||
__line /root/.profile --line 'mesg n' --state absent
|
||||
|
||||
# skipped for now, in case of systemd __hostname uses
|
||||
# hostnamectl for setting hostname and it needs dbus running
|
||||
# __hostname --name preos
|
||||
# hostname setting is currently done before this configuration
|
39
cdist/preos/debootstrap/files/init-manifest-ubuntu
Normal file
39
cdist/preos/debootstrap/files/init-manifest-ubuntu
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# basic init manifest for PreOS config
|
||||
|
||||
for pkg in \
|
||||
file \
|
||||
linux-image-generic \
|
||||
lsb-release \
|
||||
dosfstools \
|
||||
gdisk \
|
||||
openssh-server curl \
|
||||
pxelinux syslinux-common \
|
||||
gdisk util-linux lvm2 mdadm \
|
||||
btrfs-tools e2fsprogs jfsutils reiser4progs xfsprogs; do
|
||||
__package $pkg --state present
|
||||
done
|
||||
|
||||
# initramfs requires /init
|
||||
__link /init --source /sbin/init --type symbolic
|
||||
|
||||
__file /etc/network/interfaces --source - --mode 0644 << eof
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
eof
|
||||
|
||||
# Steven found this out - coyping it 1:1
|
||||
# fix the bloody 'stdin: is not a tty' problem
|
||||
__line /root/.profile --line 'mesg n' --state absent
|
||||
|
||||
# skipped for now, in case of systemd __hostname uses
|
||||
# hostnamectl for setting hostname and it needs dbus running
|
||||
# __hostname --name preos
|
||||
# hostname setting is currently done before this configuration
|
8
cdist/preos/debootstrap/files/remote-copy.sh
Executable file
8
cdist/preos/debootstrap/files/remote-copy.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# echo $@
|
||||
# set -x
|
||||
src=$1; shift
|
||||
dst=$1; shift
|
||||
real_dst=$(echo $dst | sed 's,:,,')
|
||||
cp -L "$src" "$real_dst"
|
24
cdist/preos/debootstrap/files/remote-exec.sh
Executable file
24
cdist/preos/debootstrap/files/remote-exec.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# echo $@
|
||||
# set -x
|
||||
|
||||
chroot="$1"; shift
|
||||
|
||||
script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX")
|
||||
trap cleanup INT TERM EXIT
|
||||
cleanup() {
|
||||
[ $__cdist_debug ] || rm "$script"
|
||||
}
|
||||
|
||||
echo "#!/bin/sh -l" > "$script"
|
||||
echo "$@" >> "$script"
|
||||
chmod +x "$script"
|
||||
|
||||
relative_script="${script#$chroot}"
|
||||
|
||||
# ensure PATH is setup
|
||||
export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
# run in chroot
|
||||
chroot "$chroot" "$relative_script"
|
225
cdist/trigger.py
Normal file
225
cdist/trigger.py
Normal file
|
@ -0,0 +1,225 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 2016 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist 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.
|
||||
#
|
||||
# cdist 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 cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
|
||||
import ipaddress
|
||||
import logging
|
||||
import re
|
||||
import socket
|
||||
import http.server
|
||||
import os
|
||||
import socketserver
|
||||
import shutil
|
||||
|
||||
import cdist.config
|
||||
import cdist.log
|
||||
import cdist.util.ipaddr as ipaddr
|
||||
|
||||
|
||||
class Trigger():
|
||||
"""cdist trigger handling"""
|
||||
|
||||
# Arguments that are only trigger specific
|
||||
triggers_args = ["http_port", "ipv6", "directory", "source", ]
|
||||
|
||||
def __init__(self, http_port=None, dry_run=False, ipv6=False,
|
||||
directory=None, source=None, cdistargs=None):
|
||||
self.dry_run = dry_run
|
||||
self.http_port = int(http_port)
|
||||
self.ipv6 = ipv6
|
||||
self.args = cdistargs
|
||||
|
||||
self.directory = directory
|
||||
self.source = source
|
||||
|
||||
log.debug("IPv6: %s", self.ipv6)
|
||||
|
||||
def run_httpd(self):
|
||||
server_address = ('', self.http_port)
|
||||
|
||||
if self.ipv6:
|
||||
httpdcls = HTTPServerV6
|
||||
else:
|
||||
httpdcls = HTTPServerV4
|
||||
httpd = httpdcls(self.args, self.directory, self.source,
|
||||
server_address, TriggerHttp)
|
||||
|
||||
log.debug("Starting server at port %d", self.http_port)
|
||||
if self.dry_run:
|
||||
log.debug("Running in dry run mode")
|
||||
httpd.serve_forever()
|
||||
|
||||
def run(self):
|
||||
if self.http_port:
|
||||
self.run_httpd()
|
||||
|
||||
@classmethod
|
||||
def commandline(cls, args):
|
||||
global log
|
||||
|
||||
# remove root logger default cdist handler and configure trigger's own
|
||||
logging.getLogger().handlers = []
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s')
|
||||
|
||||
log = logging.getLogger("trigger")
|
||||
ownargs = {}
|
||||
for targ in cls.triggers_args:
|
||||
arg = getattr(args, targ)
|
||||
ownargs[targ] = arg
|
||||
|
||||
del arg
|
||||
|
||||
t = cls(dry_run=args.dry_run, cdistargs=args, **ownargs)
|
||||
t.run()
|
||||
|
||||
|
||||
class TriggerHttp(http.server.BaseHTTPRequestHandler):
|
||||
actions = {
|
||||
"cdist": ["config", "install", ],
|
||||
"file": ["present", "absent", ],
|
||||
}
|
||||
|
||||
def do_HEAD(self):
|
||||
self.dispatch_request()
|
||||
|
||||
def do_POST(self):
|
||||
self.dispatch_request()
|
||||
|
||||
def do_GET(self):
|
||||
self.dispatch_request()
|
||||
|
||||
def _actions_regex(self):
|
||||
regex = ["^/(?P<subsystem>", ]
|
||||
regex.extend("|".join(self.actions.keys()))
|
||||
regex.append(")/(?P<action>")
|
||||
regex.extend("|".join("|".join(self.actions[x]) for x in self.actions))
|
||||
regex.append(")/")
|
||||
|
||||
return "".join(regex)
|
||||
|
||||
def dispatch_request(self):
|
||||
host = self.client_address[0]
|
||||
code = 200
|
||||
message = None
|
||||
|
||||
self.cdistargs = self.server.cdistargs
|
||||
|
||||
actions_regex = self._actions_regex()
|
||||
m = re.match(actions_regex, self.path)
|
||||
|
||||
if m:
|
||||
subsystem = m.group('subsystem')
|
||||
action = m.group('action')
|
||||
handler = getattr(self, "handler_" + subsystem)
|
||||
|
||||
if action not in self.actions[subsystem]:
|
||||
code = 404
|
||||
else:
|
||||
code = 404
|
||||
|
||||
if code == 200:
|
||||
log.debug("Calling {} -> {}".format(subsystem, action))
|
||||
try:
|
||||
handler(action, host)
|
||||
except cdist.Error as e:
|
||||
# cdist is not broken, cdist run is broken
|
||||
code = 599 # use arbitrary unassigned error code
|
||||
message = str(e)
|
||||
except Exception as e:
|
||||
# cdist/trigger server is broken
|
||||
code = 500
|
||||
|
||||
self.send_response(code=code, message=message)
|
||||
self.end_headers()
|
||||
|
||||
def handler_file(self, action, host):
|
||||
if not self.server.directory or not self.server.source:
|
||||
log.info("Cannot serve file request: directory or source "
|
||||
"not setup")
|
||||
return
|
||||
|
||||
try:
|
||||
ipaddress.ip_address(host)
|
||||
except ValueError:
|
||||
log.error("Host is not a valid IP address - aborting")
|
||||
return
|
||||
|
||||
dst = os.path.join(self.server.directory, host)
|
||||
|
||||
if action == "present":
|
||||
shutil.copyfile(self.server.source, dst)
|
||||
if action == "absent":
|
||||
if os.path.exists(dst):
|
||||
os.remove(dst)
|
||||
|
||||
def handler_cdist(self, action, host):
|
||||
log.debug("Running cdist action %s for %s", action, host)
|
||||
|
||||
if self.server.dry_run:
|
||||
log.info("Dry run, skipping cdist execution")
|
||||
return
|
||||
|
||||
cname = action.title()
|
||||
module = getattr(cdist, action)
|
||||
theclass = getattr(module, cname)
|
||||
|
||||
if hasattr(self.cdistargs, 'out_path'):
|
||||
out_path = self.cdistargs.out_path
|
||||
else:
|
||||
out_path = None
|
||||
host_base_path, hostdir = theclass.create_host_base_dirs(
|
||||
host, theclass.create_base_root_path(out_path))
|
||||
theclass.construct_remote_exec_copy_patterns(self.cdistargs)
|
||||
host_tags = None
|
||||
host_name = ipaddr.resolve_target_host_name(host)
|
||||
log.debug('Resolved target host name: %s', host_name)
|
||||
if host_name:
|
||||
target_host = host_name
|
||||
else:
|
||||
target_host = host
|
||||
log.debug('Using target_host: %s', target_host)
|
||||
log.debug("Executing cdist onehost with params: %s, %s, %s, %s, %s, ",
|
||||
target_host, host_tags, host_base_path, hostdir,
|
||||
self.cdistargs)
|
||||
theclass.onehost(target_host, host_tags, host_base_path, hostdir,
|
||||
self.cdistargs, parallel=False)
|
||||
|
||||
|
||||
class HTTPServerV6(socketserver.ForkingMixIn, http.server.HTTPServer):
|
||||
"""
|
||||
Server that listens to both IPv4 and IPv6 requests.
|
||||
"""
|
||||
address_family = socket.AF_INET6
|
||||
|
||||
def __init__(self, cdistargs, directory, source, *args, **kwargs):
|
||||
self.cdistargs = cdistargs
|
||||
self.dry_run = cdistargs.dry_run
|
||||
self.directory = directory
|
||||
self.source = source
|
||||
|
||||
http.server.HTTPServer.__init__(self, *args, **kwargs)
|
||||
|
||||
|
||||
class HTTPServerV4(HTTPServerV6):
|
||||
"""
|
||||
Server that listens to IPv4 requests.
|
||||
"""
|
||||
address_family = socket.AF_INET
|
|
@ -6,7 +6,7 @@ _cdist()
|
|||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||
opts="-h --help -q --quiet -v --verbose -V --version"
|
||||
cmds="banner config install inventory shell"
|
||||
cmds="banner config install inventory preos shell trigger"
|
||||
|
||||
case "${prevprev}" in
|
||||
shell)
|
||||
|
@ -80,6 +80,14 @@ _cdist()
|
|||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
trigger)
|
||||
opts="-h --help -d --debug -v --verbose -b --beta \
|
||||
-C --cache-path-pattern -c --conf-dir -i --initial-manifest \
|
||||
-j --jobs -n --dry-run -o --out-dir --remote-copy \
|
||||
--remote-exec -6 --ipv6 -H --http-port -D --directory -S --source"
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
inventory)
|
||||
cmds="list add-host del-host add-tag del-tag"
|
||||
opts="-h --help -q --quiet -v --verbose"
|
||||
|
|
|
@ -11,7 +11,7 @@ _cdist()
|
|||
|
||||
case $state in
|
||||
opts_cmds)
|
||||
_arguments '1:Options and commands:(banner config install inventory shell -h --help -q --quiet -v --verbose -V --version)'
|
||||
_arguments '1:Options and commands:(banner config install inventory preos shell trigger -h --help -q --quiet -v --verbose -V --version)'
|
||||
;;
|
||||
*)
|
||||
case $words[2] in
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
Changelog
|
||||
---------
|
||||
|
||||
next:
|
||||
* Core: Add preos functionality (Darko Poljak)
|
||||
* Core: Add trigger functionality (Nico Schottelius, Darko Poljak)
|
||||
|
||||
5.0.1: 2019-05-09
|
||||
* Documentation: Add 'Perils of CDIST_ORDER_DEPENDENCY' sub-section (Darko Poljak)
|
||||
* Build: Clean and separate end user targets into Makefile and maintainer targets into build-helper (Darko Poljak)
|
||||
|
|
176
docs/src/cdist-preos.rst
Normal file
176
docs/src/cdist-preos.rst
Normal file
|
@ -0,0 +1,176 @@
|
|||
PreOS
|
||||
=====
|
||||
|
||||
Description
|
||||
-----------
|
||||
With cdist you can install and configure new machines. You can use cdist to
|
||||
create PreOS, minimal OS which purpose is to boot new machine.
|
||||
After PreOS is booted machine is ready for installing desired OS and
|
||||
then it is ready for configuration.
|
||||
|
||||
PreOS creation
|
||||
--------------
|
||||
With cdist you can create PreOS.
|
||||
Currently supported PreOS-es include:
|
||||
|
||||
* debian
|
||||
* ubuntu
|
||||
* devuan.
|
||||
|
||||
PreOS is created using cdist preos command. preos command has subcommands that
|
||||
create the desired PreOS.
|
||||
|
||||
For example, to create ubuntu PreOS:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist preos ubuntu /preos/preos-ubuntu -b -C \
|
||||
-k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu \
|
||||
-t "/usr/bin/curl 192.168.111.5:3000/install/"
|
||||
|
||||
For more info about available options see cdist manual page.
|
||||
|
||||
This will bootstrap (``-b``) ubuntu PreOS in ``/preos/preos-ubuntu`` directory, it
|
||||
will be configured (``-C``) using default built-in initial manifest and with
|
||||
specified ssh authorized key (``-k``) and with specified trigger command (``-t``).
|
||||
After bootstrapping and configuration PXE
|
||||
boot directory will be created (``-p``) in ``/preos/pxe-ubuntu``.
|
||||
|
||||
After PreOS is created new machines can be booted using created PXE (after
|
||||
proper dhcp, tftp setting).
|
||||
|
||||
Since PreOS is configured with ssh authorized key it can be accessed throguh
|
||||
ssh, i.e. it can be further installed and configured with cdist.
|
||||
|
||||
When installing and configuring new machines using cdist's PreOS concept
|
||||
cdist can use triggering for host installation/configuration, which is described
|
||||
in the previous chapter.
|
||||
|
||||
When new machine is booted with PreOS then trigger command is executed.
|
||||
Machine will connect to cdist trigger server. If the request is, for example,
|
||||
for installation then cdist trigger server will start install command for the
|
||||
client host using parameters specified at trigger server startup.
|
||||
|
||||
Implementing new PreOS sub-command
|
||||
----------------------------------
|
||||
preos command is implemented as a plugin system. This plugin system scans for
|
||||
preos subcommands in ``cdist/preos/`` distribution directory and also in
|
||||
``~/.cdist/preos/`` directory if it exists.
|
||||
|
||||
preos subcommand is a module or a class that satisfies the following:
|
||||
|
||||
* it has attribute ``_cdist_preos`` set to ``True``
|
||||
* it has function/method ``commandline``.
|
||||
|
||||
For a module based preos subcommand ``commandline`` function accepts a module
|
||||
object as its first argument and the list of command line
|
||||
arguments (``sys.argv[2:]``).
|
||||
|
||||
For a class preos subcommand ``commandline`` method should be staticmethod and
|
||||
it accepts a class object as its first argument and the list of command line
|
||||
arguments(``sys.argv[2:]``).
|
||||
|
||||
If preos scanning finds a module/class that has ``_cdist_preos`` set
|
||||
to ``True`` and it has function/method ``commandline`` then this module/class is
|
||||
registered to preos subcommands. The name of the command is set to ``_preos_name``
|
||||
attribute if it exists, otherwise it is set to the module/class name, lowercase.
|
||||
When registered preos subcommand is specified as preos command then ``commandline``
|
||||
will be called with first argument set to module/class object and second argument
|
||||
set to ``sys.argv[2:]``.
|
||||
|
||||
Example writing new dummy preos sub-command
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Module based preos:
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#. Create directory ``~/.cdist/preos/`` if it does not exist
|
||||
#. Create ``~/.cdist/preos/netbsd.py`` with the following contents:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
_preos_name = 'netbsd'
|
||||
_cdist_preos = True
|
||||
|
||||
def commandline(cls, args):
|
||||
print("NetBSD PreOS: {}".format(args))
|
||||
|
||||
When you try to run this new preos you will get:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist preos -h
|
||||
usage: cdist preos [-h] preos
|
||||
|
||||
Create PreOS
|
||||
|
||||
positional arguments:
|
||||
preos PreOS to create, one of: {'netbsd', 'debian', 'ubuntu'}
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
$ cdist preos netbsd
|
||||
NetBSD PreOS: []
|
||||
|
||||
Class based preos:
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#. Create directory ``~/.cdist/preos/`` if it does not exist
|
||||
#. Create ``~/.cdist/preos/freebsd.py`` with the following contents:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class FreeBSD(object):
|
||||
_cdist_preos = True
|
||||
|
||||
@classmethod
|
||||
def commandline(cls, args):
|
||||
print("FreeBSD dummy preos: {}".format(args))
|
||||
|
||||
When you try to run this new preos you will get:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist preos -h
|
||||
usage: cdist preos [-h] preos
|
||||
|
||||
Create PreOS
|
||||
|
||||
positional arguments:
|
||||
preos PreOS to create, one of: {'freebsd', 'debian', 'ubuntu'}
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
$ cdist preos freebsd
|
||||
FreeBSD dummy preos: []
|
||||
|
||||
In the ``commandline`` function/method you have all the freedom to actually create
|
||||
PreOS.
|
||||
|
||||
Simple tipical use case for using PreOS and trigger
|
||||
---------------------------------------------------
|
||||
Tipical use case for using PreOS and trigger command include the following steps.
|
||||
|
||||
#. Create PreOS PXE with ssh key and trigger command for installation.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist preos ubuntu /preos/ubuntu -b -C \
|
||||
-k ~/.ssh/id_rsa.pub -p /preos/pxe \
|
||||
-t "/usr/bin/curl 192.168.111.5:3000/install/"
|
||||
|
||||
#. Configure dhcp server and tftp server.
|
||||
|
||||
#. On cdist host (192.168.111.5 from above) start trigger command (it will use
|
||||
default init manifest for installation).
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist trigger -b -v
|
||||
|
||||
#. After all is set up start new machines (PXE boot).
|
||||
|
||||
#. New machine boots and executes trigger command, i.e. triggers installation.
|
||||
|
||||
#. Cdist trigger server starts installing host that has triggered it.
|
||||
|
||||
#. After cdist install is finished new host is installed.
|
|
@ -67,6 +67,9 @@ cdist/inventory/
|
|||
The distribution inventory directory.
|
||||
This path is relative to cdist installation directory.
|
||||
|
||||
cdist/preos/
|
||||
The distribution PreOS plugins directory.
|
||||
|
||||
confdir
|
||||
Cdist will use all available configuration directories and create
|
||||
a temporary confdir containing links to the real configuration directories.
|
||||
|
|
33
docs/src/cdist-trigger.rst
Normal file
33
docs/src/cdist-trigger.rst
Normal file
|
@ -0,0 +1,33 @@
|
|||
Trigger
|
||||
=======
|
||||
|
||||
Description
|
||||
-----------
|
||||
cdist supports triggering for host installation/configuration using trigger command.
|
||||
This command starts trigger server at management node, for example:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cdist trigger -b -v
|
||||
|
||||
This will start cdist trigger server in verbose mode. cdist trigger server accepts
|
||||
simple requests for configuration and for installation:
|
||||
|
||||
* :strong:`/cdist/install/.*` for installation
|
||||
* :strong:`/cdist/config/.*` for configuration.
|
||||
|
||||
Machines can then trigger cdist trigger server with appropriate requests.
|
||||
If the request is, for example, for installation (:strong:`/cdist/install/`)
|
||||
then cdist trigger server will start install command for the client host using
|
||||
parameters specified at trigger server startup. For the above example that means
|
||||
that client will be installed using default initial manifest.
|
||||
|
||||
When triggered cdist will try to reverse DNS lookup for host name and if
|
||||
host name is dervied then it is used for running cdist config. If no
|
||||
host name is resolved then IP address is used.
|
||||
|
||||
This command returns the following response codes to client requests:
|
||||
|
||||
* 200 for success
|
||||
* 599 for cdist run errors
|
||||
* 500 for cdist/server errors.
|
|
@ -31,6 +31,8 @@ is being used in small up to enterprise grade environments.
|
|||
cdist-messaging
|
||||
cdist-parallelization
|
||||
cdist-inventory
|
||||
cdist-trigger
|
||||
cdist-preos
|
||||
cdist-integration
|
||||
cdist-reference
|
||||
cdist-best-practice
|
||||
|
|
|
@ -11,7 +11,7 @@ SYNOPSIS
|
|||
|
||||
::
|
||||
|
||||
cdist [-h] [-V] {banner,config,install,inventory,shell} ...
|
||||
cdist [-h] [-V] {banner,config,install,inventory,preos,shell,trigger} ...
|
||||
|
||||
cdist banner [-h] [-l LOGLEVEL] [-q] [-v]
|
||||
|
||||
|
@ -59,8 +59,41 @@ SYNOPSIS
|
|||
[-I INVENTORY_DIR] [-a] [-f HOSTFILE] [-H] [-t]
|
||||
[host [host ...]]
|
||||
|
||||
cdist preos [-h] preos
|
||||
|
||||
cdist preos debian [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
|
||||
[-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
|
||||
[-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
|
||||
[-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
|
||||
[-S SCRIPT] [-s SUITE] [-t TRIGGER_COMMAND]
|
||||
[-y REMOTE_COPY]
|
||||
target_dir
|
||||
|
||||
cdist preos devuan [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
|
||||
[-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
|
||||
[-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
|
||||
[-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
|
||||
[-S SCRIPT] [-s SUITE] [-t TRIGGER_COMMAND]
|
||||
[-y REMOTE_COPY]
|
||||
target_dir
|
||||
|
||||
cdist preos ubuntu [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
|
||||
[-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
|
||||
[-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
|
||||
[-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
|
||||
[-S SCRIPT] [-s SUITE] [-t TRIGGER_COMMAND]
|
||||
[-y REMOTE_COPY]
|
||||
target_dir
|
||||
|
||||
cdist shell [-h] [-l LOGLEVEL] [-q] [-v] [-s SHELL]
|
||||
|
||||
cdist trigger [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-C CACHE_PATH_PATTERN]
|
||||
[-c CONF_DIR] [-i MANIFEST] [-j [JOBS]] [-n]
|
||||
[-o OUT_PATH] [-R [{tar,tgz,tbz2,txz}]]
|
||||
[-r REMOTE_OUT_PATH] [--remote-copy REMOTE_COPY]
|
||||
[--remote-exec REMOTE_EXEC] [-6] [-D DIRECTORY]
|
||||
[-H HTTP_PORT] [-S SOURCE]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
@ -432,6 +465,143 @@ List inventory database.
|
|||
all hosts that contain any of specified tags.
|
||||
|
||||
|
||||
PREOS
|
||||
-----
|
||||
Create PreOS. Currently, the following PreOS-es are supported:
|
||||
|
||||
* debian
|
||||
* ubuntu
|
||||
* devuan
|
||||
|
||||
|
||||
PREOS DEBIAN/DEVUAN
|
||||
-------------------
|
||||
|
||||
**target_dir**
|
||||
target directory where PreOS will be bootstrapped
|
||||
|
||||
**-a ARCH, --arch ARCH**
|
||||
target debootstrap architecture, by default 'amd64'
|
||||
|
||||
**-B, --bootstrap**
|
||||
do bootstrap step
|
||||
|
||||
**-b, --beta**
|
||||
Enable beta functionality.
|
||||
|
||||
**-C, --configure**
|
||||
do configure step
|
||||
|
||||
**-c CDIST_PARAMS, --cdist-params CDIST_PARAMS**
|
||||
parameters that will be passed to cdist config, by
|
||||
default '-v' is used
|
||||
|
||||
**-D DRIVE, --drive-boot DRIVE**
|
||||
create bootable PreOS on specified drive
|
||||
|
||||
**-e REMOTE_EXEC, --remote-exec REMOTE_EXEC**
|
||||
remote exec that cdist config will use, by default
|
||||
internal script is used
|
||||
|
||||
**-i MANIFEST, --init-manifest MANIFEST**
|
||||
init manifest that cdist config will use, by default
|
||||
internal init manifest is used
|
||||
|
||||
**-k KEYFILE, --keyfile KEYFILE**
|
||||
ssh key files that will be added to cdist config;
|
||||
'``__ssh_authorized_keys root ...``' type is appended to initial manifest
|
||||
|
||||
**-m MIRROR, --mirror MIRROR**
|
||||
use specified mirror for debootstrap
|
||||
|
||||
**-P ROOT_PASSWORD, --root-password ROOT_PASSWORD**
|
||||
Set specified password for root, generated by default
|
||||
|
||||
**-p PXE_BOOT_DIR, --pxe-boot-dir PXE_BOOT_DIR**
|
||||
PXE boot directory
|
||||
|
||||
**-r, --rm-bootstrap-dir**
|
||||
remove target directory after finishing
|
||||
|
||||
**-S SCRIPT, --script SCRIPT**
|
||||
use specified script for debootstrap
|
||||
|
||||
**-s SUITE, --suite SUITE**
|
||||
suite used for debootstrap, by default 'stable'
|
||||
|
||||
**-t TRIGGER_COMMAND, --trigger-command TRIGGER_COMMAND**
|
||||
trigger command that will be added to cdist config;
|
||||
'``__cdist_preos_trigger http ...``' type is appended to initial manifest
|
||||
|
||||
**-y REMOTE_COPY, --remote-copy REMOTE_COPY**
|
||||
remote copy that cdist config will use, by default
|
||||
internal script is used
|
||||
|
||||
|
||||
PREOS UBUNTU
|
||||
------------
|
||||
|
||||
**target_dir**
|
||||
target directory where PreOS will be bootstrapped
|
||||
|
||||
**-a ARCH, --arch ARCH**
|
||||
target debootstrap architecture, by default 'amd64'
|
||||
|
||||
**-B, --bootstrap**
|
||||
do bootstrap step
|
||||
|
||||
**-b, --beta**
|
||||
Enable beta functionality.
|
||||
|
||||
**-C, --configure**
|
||||
do configure step
|
||||
|
||||
**-c CDIST_PARAMS, --cdist-params CDIST_PARAMS**
|
||||
parameters that will be passed to cdist config, by
|
||||
default '-v' is used
|
||||
|
||||
**-D DRIVE, --drive-boot DRIVE**
|
||||
create bootable PreOS on specified drive
|
||||
|
||||
**-e REMOTE_EXEC, --remote-exec REMOTE_EXEC**
|
||||
remote exec that cdist config will use, by default
|
||||
internal script is used
|
||||
|
||||
**-i MANIFEST, --init-manifest MANIFEST**
|
||||
init manifest that cdist config will use, by default
|
||||
internal init manifest is used
|
||||
|
||||
**-k KEYFILE, --keyfile KEYFILE**
|
||||
ssh key files that will be added to cdist config;
|
||||
'``__ssh_authorized_keys root ...``' type is appended to initial manifest
|
||||
|
||||
**-m MIRROR, --mirror MIRROR**
|
||||
use specified mirror for debootstrap
|
||||
|
||||
**-P ROOT_PASSWORD, --root-password ROOT_PASSWORD**
|
||||
Set specified password for root, generated by default
|
||||
|
||||
**-p PXE_BOOT_DIR, --pxe-boot-dir PXE_BOOT_DIR**
|
||||
PXE boot directory
|
||||
|
||||
**-r, --rm-bootstrap-dir**
|
||||
remove target directory after finishing
|
||||
|
||||
**-S SCRIPT, --script SCRIPT**
|
||||
use specified script for debootstrap
|
||||
|
||||
**-s SUITE, --suite SUITE**
|
||||
suite used for debootstrap, by default 'xenial'
|
||||
|
||||
**-t TRIGGER_COMMAND, --trigger-command TRIGGER_COMMAND**
|
||||
trigger command that will be added to cdist config;
|
||||
'``__cdist_preos_trigger http ...``' type is appended to initial manifest
|
||||
|
||||
**-y REMOTE_COPY, --remote-copy REMOTE_COPY**
|
||||
remote copy that cdist config will use, by default
|
||||
internal script is used
|
||||
|
||||
|
||||
SHELL
|
||||
-----
|
||||
This command allows you to spawn a shell that enables access
|
||||
|
@ -444,6 +614,84 @@ usage. Its primary use is for debugging type parameters.
|
|||
be POSIX compatible shell.
|
||||
|
||||
|
||||
TRIGGER
|
||||
-------
|
||||
Start trigger (simple http server) that waits for connections. When host
|
||||
connects then it triggers config or install command and then cdist
|
||||
config/install is executed which configures/installs host.
|
||||
When triggered cdist will try to reverse DNS lookup for host name and if
|
||||
host name is dervied then it is used for running cdist config. If no
|
||||
host name is resolved then IP address is used.
|
||||
Request path recognizes following requests:
|
||||
|
||||
* :strong:`/cdist/config/.*` for config
|
||||
* :strong:`/cdist/install/.*` for install.
|
||||
|
||||
This command returns the following response codes to client requests:
|
||||
|
||||
* 200 for success
|
||||
* 599 for cdist run errors
|
||||
* 500 for cdist/server errors.
|
||||
|
||||
|
||||
**-6, --ipv6**
|
||||
|
||||
Listen to both IPv4 and IPv6 (instead of only IPv4)
|
||||
|
||||
**-b, --beta**
|
||||
|
||||
Enable beta functionality.
|
||||
|
||||
**-C CACHE_PATH_PATTERN, --cache-path-pattern CACHE_PATH_PATTERN**
|
||||
|
||||
Sepcify custom cache path pattern. It can also be set by
|
||||
CDIST_CACHE_PATH_PATTERN environment variable. If it is not set then
|
||||
default hostdir is used. For more info on format see
|
||||
:strong:`CACHE PATH PATTERN FORMAT` below.
|
||||
|
||||
**-c CONF_DIR, --conf-dir CONF_DIR**
|
||||
|
||||
Add configuration directory (can be repeated, last one wins)
|
||||
|
||||
**-D DIRECTORY, --directory DIRECTORY**
|
||||
Where to create local files
|
||||
|
||||
**-H HTTP_PORT, --http-port HTTP_PORT**
|
||||
|
||||
Create trigger listener via http on specified port
|
||||
|
||||
**-i MANIFEST, --initial-manifest MANIFEST**
|
||||
|
||||
path to a cdist manifest or '-' to read from stdin.
|
||||
|
||||
**-j [JOBS], --jobs [JOBS]**
|
||||
|
||||
Specify the maximum number of parallel jobs, currently
|
||||
only global explorers are supported
|
||||
|
||||
**-n, --dry-run**
|
||||
|
||||
do not execute code
|
||||
|
||||
**-o OUT_PATH, --out-dir OUT_PATH**
|
||||
|
||||
directory to save cdist output in
|
||||
|
||||
**-r REMOTE_OUT_PATH, --remote-out-dir REMOTE_OUT_PATH**
|
||||
|
||||
Directory to save cdist output in on the target host
|
||||
|
||||
**--remote-copy REMOTE_COPY**
|
||||
|
||||
Command to use for remote copy (should behave like scp)
|
||||
|
||||
**--remote-exec REMOTE_EXEC**
|
||||
|
||||
Command to use for remote execution (should behave like ssh)
|
||||
|
||||
**-S SOURCE, --source SOURCE**
|
||||
Which file to copy for creation
|
||||
|
||||
CONFIGURATION
|
||||
-------------
|
||||
cdist obtains configuration data from the following sources in the following
|
||||
|
@ -540,12 +788,16 @@ FILES
|
|||
~/.cdist/inventory
|
||||
The home inventory directory. If ~/.cdist exists it will be used as
|
||||
default inventory directory.
|
||||
~/.cdist/preos
|
||||
PreOS plugins directory, if existing.
|
||||
cdist/conf
|
||||
The distribution configuration directory. It contains official types and
|
||||
explorers. This path is relative to cdist installation directory.
|
||||
cdist/inventory
|
||||
The distribution inventory directory.
|
||||
This path is relative to cdist installation directory.
|
||||
cdist/preos
|
||||
The distribution PreOS plugins directory.
|
||||
/etc/cdist.cfg
|
||||
Global cdist configuration file, if exists.
|
||||
~/.cdist.cfg or $XDG_CONFIG_HOME/cdist/cdist.cfg
|
||||
|
@ -635,6 +887,28 @@ EXAMPLES
|
|||
# Configure all hosts from inventory db
|
||||
$ cdist config -b -A
|
||||
|
||||
# Create default debian PreOS in debug mode with config
|
||||
# trigger command
|
||||
$ cdist preos debian /preos/preos-debian -b -vvvv -C \
|
||||
-k ~/.ssh/id_rsa.pub -p /preos/pxe-debian \
|
||||
-t "/usr/bin/curl 192.168.111.5:3000/config/"
|
||||
|
||||
# Create ubuntu PreOS with install trigger command
|
||||
$ cdist preos ubuntu /preos/preos-ubuntu -b -C \
|
||||
-k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu \
|
||||
-t "/usr/bin/curl 192.168.111.5:3000/install/"
|
||||
|
||||
# Create ubuntu PreOS on drive /dev/sdb with install trigger command
|
||||
# and set root password to 'password'.
|
||||
$ cdist preos ubuntu /mnt -b -B -C \
|
||||
-k ~/.ssh/id_rsa.pub -D /dev/sdb \
|
||||
-t "/usr/bin/curl 192.168.111.5:3000/install/" \
|
||||
-P password
|
||||
|
||||
# Start trigger in verbose mode that will configure host using specified
|
||||
# init manifest
|
||||
% cdist trigger -b -v -i ~/.cdist/manifest/init-for-triggered
|
||||
|
||||
|
||||
ENVIRONMENT
|
||||
-----------
|
||||
|
|
32
hacking/preos-sh/init
Normal file
32
hacking/preos-sh/init
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
for pkg in \
|
||||
file \
|
||||
linux-image-amd64 \
|
||||
lsb-release \
|
||||
openssh-server curl \
|
||||
pxelinux syslinux-common grub2 \
|
||||
gdisk util-linux lvm2 mdadm \
|
||||
btrfs-tools e2fsprogs jfsutils reiser4progs xfsprogs; do
|
||||
__package $pkg --state present
|
||||
done
|
||||
|
||||
# initramfs requires /init
|
||||
__link /init --source /sbin/init --type symbolic
|
||||
|
||||
__file /etc/network/interfaces --source - --mode 0644 << eof
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
eof
|
||||
|
||||
# Steven found this out - coyping it 1:1
|
||||
# fix the bloody 'stdin: is not a tty' problem
|
||||
__line /root/.profile --line 'mesg n' --state absent
|
||||
|
||||
__hostname --name preos
|
31
hacking/preos-sh/preos.sh
Normal file
31
hacking/preos-sh/preos.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
TARGET_DIR="$1"
|
||||
PXE_BOOT_DIR="$2"
|
||||
|
||||
debootstrap --include=openssh-server --arch=amd64 stable $TARGET_DIR
|
||||
chroot $TARGET_DIR /usr/bin/apt-get update
|
||||
|
||||
# Configure the OS
|
||||
cdist config -i init --remote-exec remote-exec.sh --remote-copy remote-exec.sh $TARGET_DIR
|
||||
|
||||
# Cleanup chroot
|
||||
chroot $TARGET_DIR /usr/bin/apt-get autoclean
|
||||
chroot $TARGET_DIR /usr/bin/apt-get clean
|
||||
chroot $TARGET_DIR /usr/bin/apt-get autoremove
|
||||
|
||||
# Output pxe files
|
||||
cp $TARGET_DIR/boot/vmlinuz-* $PXE_BOOT_DIR/kernel
|
||||
|
||||
cd $TARGET_DIR
|
||||
find . -print0 | cpio --null -o --format=newc | gzip -9 > $PXE_BOOT_DIR/initramfs
|
||||
|
||||
cat << EOF > $PXE_BOOT_DIR/pxelinux.cfg/default
|
||||
DEFAULT preos
|
||||
LABEL preos
|
||||
KERNEL kernel
|
||||
INITRD initramfs
|
||||
EOF
|
||||
|
||||
cp $TARGET_DIR/usr/lib/PXELINUX/pxelinux.0 $PXE_BOOT_DIR/pxelinux.0
|
||||
cp $TARGET_DIR/usr/lib/syslinux/modules/bios/ldlinux.c32 $PXE_BOOT_DIR/ldlinux.c32
|
8
hacking/preos-sh/remote-copy.sh
Normal file
8
hacking/preos-sh/remote-copy.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# echo $@
|
||||
# set -x
|
||||
src=$1; shift
|
||||
dst=$1; shift
|
||||
real_dst=$(echo $dst | sed 's,:,,')
|
||||
cp -L "$src" "$real_dst"
|
24
hacking/preos-sh/remote-exec.sh
Normal file
24
hacking/preos-sh/remote-exec.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# echo $@
|
||||
# set -x
|
||||
|
||||
chroot="$1"; shift
|
||||
|
||||
script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX")
|
||||
trap cleanup INT TERM EXIT
|
||||
cleanup() {
|
||||
[ $__cdist_debug ] || rm "$script"
|
||||
}
|
||||
|
||||
echo "#!/bin/sh -l" > "$script"
|
||||
echo "$@" >> "$script"
|
||||
chmod +x "$script"
|
||||
|
||||
relative_script="${script#$chroot}"
|
||||
|
||||
# ensure PATH is setup
|
||||
export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
# run in chroot
|
||||
chroot "$chroot" "$relative_script"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue