diff options
| author | Lars Müller | 2006-12-15 20:15:22 +0100 |
|---|---|---|
| committer | Lars Müller | 2006-12-15 20:15:22 +0100 |
| commit | 602a0ca8eb7433f6067ed65cee0bc5bbfdcfb26b (patch) | |
| tree | 5d3386baa3cf52052dac1d57fadb55a14ffaa0d9 /installer | |
| parent | Added new busybox in new place (tools, Makefile, ...) Busybox has (diff) | |
| download | core-602a0ca8eb7433f6067ed65cee0bc5bbfdcfb26b.tar.gz core-602a0ca8eb7433f6067ed65cee0bc5bbfdcfb26b.tar.xz core-602a0ca8eb7433f6067ed65cee0bc5bbfdcfb26b.zip | |
slxossetup is a prototype of an OS setup script. At the moment
slxossetup is able to install openSUSE 10.2 from any installation source
useable by smart.
See the example from systems/opensuse102/settings. This file is
intended to be installed as the default. As with the config demuxer
we're able to apply local settings in settings.local.
As I did not find a way to create base files out of shell variables I
added a hack to copy template files.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@537 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
| -rwxr-xr-x | installer/slxossetup | 141 | ||||
| -rw-r--r-- | installer/systems/README | 10 | ||||
| -rw-r--r-- | installer/systems/opensuse102/BASE_FILE_etc__group | 33 | ||||
| -rw-r--r-- | installer/systems/opensuse102/BASE_FILE_etc__passwd | 14 | ||||
| -rw-r--r-- | installer/systems/opensuse102/BASE_FILE_etc__shadow | 14 | ||||
| -rw-r--r-- | installer/systems/opensuse102/settings | 16 | ||||
| -rw-r--r-- | installer/systems/opensuse102/settings.local | 12 |
7 files changed, 240 insertions, 0 deletions
diff --git a/installer/slxossetup b/installer/slxossetup new file mode 100755 index 00000000..61fccdc5 --- /dev/null +++ b/installer/slxossetup @@ -0,0 +1,141 @@ +#! /bin/bash +# +# slxossetup - OpenSLX script for OS setup +# +# (c) 2006 - OpenSLX.com +# +# Lars Müller <lm@openslx.com> +# + +: ${SLX_CONFIG_PATH:=/etc/opt/openslx} +: ${SLX_PRIVATE_PATH:=/var/opt/openslx} + +SLX_SYSTEM_NAME=$1 +test "$2" && \ + SLX_OSSETUP_MODE=$2 || + SLX_OSSETUP_MODE="install" + +PATH="/bin:/usr/bin" + +if test -z "${SLX_SYSTEM_NAME}"; then + echo "$0: Error, <system-name> not provided! " + exit 1 +fi +SLX_SYSTEM_BASENAME="${SLX_SYSTEM_NAME%%-*}" +SLX_SYSTEM_VARIANTNAME="${SLX_SYSTEM_NAME##*-}" +test "${SLX_SYSTEM_VARIANTNAME}" = "${SLX_SYSTEM_BASENAME}" && \ + unset SLX_SYSTEM_VARIANTNAME +SLX_SYSTEM_CONFIG_PATH="${SLX_CONFIG_PATH}/systems/${SLX_SYSTEM_BASENAME}" + +# Read config files for a particular system +for suffix in "" local ${SLX_SYSTEM_VARIANTNAME}; do + test -f "${SLX_SYSTEM_CONFIG_PATH}/settings${suffix:+.$suffix}" && \ + . "${SLX_SYSTEM_CONFIG_PATH}/settings${suffix:+.$suffix}" +done + +function slxossetup_rpm_suse() +{ + SLX_METADATA_PATH="${SLX_PRIVATE_PATH}/metadata/${SLX_SYSTEM_NAME}" + SLX_STAGE1_PATH="${SLX_PRIVATE_PATH}/stage1/${SLX_SYSTEM_NAME}" + + for dir in ${SLX_METADATA_PATH} ${SLX_STAGE1_PATH}; do + if test -d "${dir}"; then + echo "$0: Error, ${dir} already exists! " + exit 1 + fi + done + + smart --data-dir="${SLX_METADATA_PATH}" \ + config \ + --set \ + rpm-root="${SLX_STAGE1_PATH}" + + for variable in ${!SLX_INST_SOURCE_BASEURL_*}; do + # Unset SMART_* to let smart fail if they are not set for a particular + # channel; unset PACKAGEKEYS to prevent adding them multiple times. + unset SMART_NAME SMART_TYPE PACKAGEKEYS + SMART_CHANNEL="${variable##*_}" + SMART_BASEURL=$( eval echo \$$variable) + SMART_NAME=$( eval echo \$SLX_INST_SOURCE_NAME_${SMART_CHANNEL}) + SMART_TYPE=$( eval echo \$SLX_INST_SOURCE_TYPE_${SMART_CHANNEL}) + PACKAGEKEYS=$( eval echo \$SLX_INST_SOURCE_PACKAGEKEYS_${SMART_CHANNEL}) + + smart --data-dir="${SLX_METADATA_PATH}" \ + channel \ + --add "${SMART_CHANNEL}" \ + name="${SMART_NAME}" \ + type="${SMART_TYPE}" \ + baseurl=${SMART_BASEURL} \ + -y + + for packagekey in ${PACKAGEKEYS}; do + case "${packagekey}" in + */*) ;; + *) packagekey="${SMART_BASEURL}/${packagekey}" ;; + esac + rpm --root="${SLX_STAGE1_PATH}" \ + --import "${packagekey}" + done + done + + smart --data-dir="${SLX_METADATA_PATH}" \ + update + + # Download and unpack prerequired packages before any package installation + SLX_PACKAGE_PATH="${SLX_METADATA_PATH}/packages" + test -d "${SLX_PACKAGE_PATH}" || \ + mkdir -p "${SLX_PACKAGE_PATH}" + pushd "${SLX_PACKAGE_PATH}" >/dev/null + smart --data-dir="${SLX_METADATA_PATH}" \ + download \ + "${SLX_BASE_PREREQ_PACKAGES}" + popd >/dev/null + + test -d "${SLX_STAGE1_PATH}" || \ + mkdir -p "${SLX_STAGE1_PATH}" + pushd "${SLX_STAGE1_PATH}" >/dev/null + for package in "${SLX_PACKAGE_PATH}/*.rpm"; do + rpm2cpio ${package} | cpio -i --make-directories + done + # Cleanup etc to prevent .rpnnew files + # FIXME: This should be controled by the config file. + find etc/ -type f -print0 | \ + xargs -0 rm -f + + # Install base system files + for file in ${SLX_SYSTEM_CONFIG_PATH}/BASE_FILE_*; do + suffix="${file#${SLX_SYSTEM_CONFIG_PATH}/BASE_FILE_}" + dest_path=${suffix%__*} + dest_path="${dest_path//__//}" + dest_file="${suffix//__//}" + test -d ""${SLX_STAGE1_PATH}/${dest_path}" || \ + mkdir ""${SLX_STAGE1_PATH}/${dest_path}" + cp -p "${file}" "${SLX_STAGE1_PATH}/${dest_file}" + done + + unset packagelist + for variable in ${!SLX_INSTALL_PACKAGES_*}; do + packagelist="${packagelist} $( eval echo \$$variable)" + done + + # Inform SUSE RPMs that we're doing installation + export YAST_IS_RUNNING="instsys" + + smart --data-dir="${SLX_METADATA_PATH}" \ + install \ + ${packagelist} \ + -y +} + +function slxossetup() +{ + case "${SLX_SYSTEM_BASENAME}" in + *suse*) slxossetup_rpm_suse ;; + *) echo "$0: Error, unkown system ${SLX_SYSTEM_BASENAME}" ;; + esac +} + +case "${SLX_OSSETUP_MODE}" in + install) slxossetup ;; + *) echo "Usage: $0 system-name [install]" ;; +esac diff --git a/installer/systems/README b/installer/systems/README new file mode 100644 index 00000000..ae3a7a63 --- /dev/null +++ b/installer/systems/README @@ -0,0 +1,10 @@ +In this sub directory of /etc/opt/openslx/ we store the configuration files +for operating systems installed with slxossetup. + +Any file named BASE_FILE_* is installed into the destination directory before +any package install action takes place. + +Therfore the suffix of BASE_FILE has the destination path encoded in the +filename. Any __ is replaced by a single /. Therfore BASE_FILE_etc__passwd +for example will be copied to the destination, stage1 directory, +/var/opt/openslx/stage1/<system-name>/etc/passwd diff --git a/installer/systems/opensuse102/BASE_FILE_etc__group b/installer/systems/opensuse102/BASE_FILE_etc__group new file mode 100644 index 00000000..505cb221 --- /dev/null +++ b/installer/systems/opensuse102/BASE_FILE_etc__group @@ -0,0 +1,33 @@ +root:x:0: +bin:x:1:daemon +daemon:x:2: +sys:x:3: +tty:x:5: +disk:x:6: +lp:x:7: +www:x:8: +kmem:x:9: +wheel:x:10: +mail:x:12: +news:x:13: +uucp:x:14: +shadow:x:15: +dialout:x:16: +audio:x:17: +floppy:x:19: +cdrom:x:20: +console:x:21: +utmp:x:22: +public:x:32: +video:x:33: +games:x:40: +xok:x:41: +trusted:x:42: +modem:x:43: +ftp:x:49: +man:x:62: +users:x:100: +nobody:x:65533: +nogroup:x:65534:nobody +messagebus:!:101: +haldaemon:!:102: diff --git a/installer/systems/opensuse102/BASE_FILE_etc__passwd b/installer/systems/opensuse102/BASE_FILE_etc__passwd new file mode 100644 index 00000000..9b8fc4fe --- /dev/null +++ b/installer/systems/opensuse102/BASE_FILE_etc__passwd @@ -0,0 +1,14 @@ +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/bin:/bin/bash +daemon:x:2:2:Daemon:/sbin:/bin/bash +lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash +mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false +news:x:9:13:News system:/etc/news:/bin/bash +uucp:x:10:14:Unix-to-Unix CoPy system:/etc/uucp:/bin/bash +games:x:12:100:Games account:/var/games:/bin/bash +man:x:13:62:Manual pages viewer:/var/cache/man:/bin/bash +wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false +ftp:x:40:49:FTP account:/srv/ftp:/bin/bash +nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash +messagebus:x:100:101:User for D-Bus:/var/run/dbus:/bin/false +haldaemon:x:101:102:User for haldaemon:/var/run/hal:/bin/false diff --git a/installer/systems/opensuse102/BASE_FILE_etc__shadow b/installer/systems/opensuse102/BASE_FILE_etc__shadow new file mode 100644 index 00000000..cd100a5a --- /dev/null +++ b/installer/systems/opensuse102/BASE_FILE_etc__shadow @@ -0,0 +1,14 @@ +root::13481:::::: +bin:*:13481:::::: +daemon:*:13481:::::: +lp:*:13481:::::: +mail:*:13481:::::: +news:*:13481:::::: +uucp:*:13481:::::: +games:*:13481:::::: +man:*:13481:::::: +wwwrun:*:13481:::::: +ftp:*:13481:::::: +nobody:*:13481:::::: +messagebus:!:13481:0::7::: +haldaemon:!:13481:0::7::: diff --git a/installer/systems/opensuse102/settings b/installer/systems/opensuse102/settings new file mode 100644 index 00000000..4b899014 --- /dev/null +++ b/installer/systems/opensuse102/settings @@ -0,0 +1,16 @@ +SLX_INST_SOURCE_BASEURL_opensuse102="http://ftp.gwdg.de/pub/opensuse/distribution/10.2/repo/oss" +SLX_INST_SOURCE_PACKAGEKEYS_opensuse102=" +gpg-pubkey-0dfb3188-41ed929b.asc +gpg-pubkey-307e3d54-44201d5d.asc +gpg-pubkey-3d25d3d9-36e12d04.asc +gpg-pubkey-7e2e3b05-44748aba.asc +gpg-pubkey-9c800aca-40d8063e.asc +gpg-pubkey-a1912208-446a0899.asc +" +SLX_INST_SOURCE_NAME_opensuse102="openSUSE 10.2" +SLX_INST_SOURCE_TYPE_opensuse102="yast2" +SLX_INST_SOURCE_BASEURL_opensuse102update="http://ftp.gwdg.de/pub/suse/update/10.2" +SLX_INST_SOURCE_NAME_opensuse102update="openSUSE 10.2 updates" +SLX_INST_SOURCE_TYPE_opensuse102update="rpm-md" +SLX_BASE_PREREQ_PACKAGES="glibc" +SLX_INSTALL_PACKAGES_MAIN="kernel-default bash" diff --git a/installer/systems/opensuse102/settings.local b/installer/systems/opensuse102/settings.local new file mode 100644 index 00000000..01cb8aa3 --- /dev/null +++ b/installer/systems/opensuse102/settings.local @@ -0,0 +1,12 @@ +# Settings made here overwrite values from the settings file in the same +# directory. +# It's also possible to define addditional values here. + +# Use a local installation source. +SLX_INST_SOURCE_BASEURL_opensuse102="ftp://gab/pub/opensuse/distribution/10.2/repo/oss" +SLX_INST_SOURCE_BASEURL_opensuse102update="ftp://gab/pub/suse/update/10.2" +# Add more packages. +# It's possible to habe more than one SLX_INSTALL_PACKAGES_* variable defined. +# All SLX_INSTALL_PACKAGES_* are combined to one package list which is +# in one step. +SLX_INSTALL_PACKAGES_KDEPIM="kdepim3" |
