integrate-distro.sh: Ongoing improvements

- Add some more kernel modules
  - Add option copy-source-dir
  - Remove /dev/sda2 from fstab
  - Fix bootsrv:/var/cores mount
  - Disable insserved services jux and juxearly
  - Make insserv-mechanism systemd-aware
  - Fix: passwd now doesn't understand --stdin anylonger
  - Not copying /etc/pam.d over from host system anylonger

Signed-off-by: Jan Lindemann <jan@jannet.de>
This commit is contained in:
Jan Lindemann 2013-04-07 09:40:23 +00:00 committed by Jan Lindemann
commit 57a43cf371

View file

@ -6,7 +6,44 @@ arch=`uname -m`
suse_version=12.3 suse_version=12.3
o_name=suse-$suse_version o_name=suse-$suse_version
cmd=install cmd=install
initrd_modules="aufs via-rhine e1000 e1000e myri10ge forcedeth usbcore ohci-hcd ehci-hcd uhci-hcd hid usbhid ahci 8139too sata_nv"
initrd_modules="
via-rhine
r8169
e1000
e1000e
myri10ge
forcedeth
8139too
sata_nv
nfs
nfs_acl
auth_rpcgss
nfsv3
nfsv4
fscache
lockd
sunrpc
sis
edd
sisfb
evdev
shpchp
sis_agp
hwmon
aufs
ahci
libahci
usbhid
hid
uhci_hcd
ohci_hcd
ehci_hcd
usbcore
hid-generic
"
kernel_flavour=-default kernel_flavour=-default
case $suse_version in case $suse_version in
@ -72,6 +109,7 @@ case $suse_version in
payload_pkgs=" payload_pkgs="
nscd nscd
usbutils
" "
kernel_version=3.7.10-jng12-default kernel_version=3.7.10-jng12-default
@ -205,13 +243,14 @@ usage()
-n target-name -n target-name
-p file with root password -p file with root password
-a architecture -a architecture
-c copy-source-dir
" "
[ "$1" ] && exit $1 [ "$1" ] && exit $1
} }
get_opts() get_opts()
{ {
set -- `getopt 'hd:n:a:p:' $*` set -- `getopt 'hd:n:a:p:c:' $*`
while [ "$1" != -- ] ; do while [ "$1" != -- ] ; do
case "$1" in case "$1" in
-h) -h)
@ -233,6 +272,10 @@ get_opts()
root_password_file=$2 root_password_file=$2
shift shift
;; ;;
-c)
copy_source_dir=$2
shift
;;
*) *)
usage 1 usage 1
;; ;;
@ -483,9 +526,9 @@ make_etc_fstab()
|debugfs /sys/kernel/debug debugfs noauto 0 0 |debugfs /sys/kernel/debug debugfs noauto 0 0
|usbfs /proc/bus/usb usbfs noauto 0 0 |usbfs /proc/bus/usb usbfs noauto 0 0
|devpts /dev/pts devpts mode=0620,gid=5 0 0 |devpts /dev/pts devpts mode=0620,gid=5 0 0
|/dev/sda2 /boot auto defaults 0 0
|/usr/share/syslinux /srv/nfs/boot/pxe/bin auto bind 0 0 |/usr/share/syslinux /srv/nfs/boot/pxe/bin auto bind 0 0
EOT EOT
#|/dev/sda2 /boot auto defaults 0 0
} }
make_etc_sysctl_conf() make_etc_sysctl_conf()
@ -592,7 +635,7 @@ make_netboot_etc_fstab()
_cat<<EOT _cat<<EOT
| |
|# netboot client |# netboot client
|/var/cores bootsrv:/var/cores nfs rw,rsize=8192,wsize=8192,async 0 0 |bootsrv:/var/cores /var/cores nfs rw,rsize=8192,wsize=8192,async 0 0
EOT EOT
} }
@ -791,8 +834,19 @@ insserv_all()
sshd sshd
jux jux
" "
services="
sshd
"
run_chroot /sbin/insserv -de $services case $suse_version in
11.4)
run_chroot /sbin/insserv -de $services;;
*)
local s
for s in $services; do
run_chroot systemctl enable $s.service
done
esac
} }
set_sysconf_value() set_sysconf_value()
@ -874,6 +928,12 @@ cmd_install()
# chroot $root zypper $zypper_global_opts -t srcpackage --download-only $payload_pkgs # chroot $root zypper $zypper_global_opts -t srcpackage --download-only $payload_pkgs
#kernel_version=`readlink -f $root/boot/vmlinuz 2>/dev/null | xargs basename | sed 's/vmlinuz-//'` #kernel_version=`readlink -f $root/boot/vmlinuz 2>/dev/null | xargs basename | sed 's/vmlinuz-//'`
[ "$copy_source_dir" ] && {
echo "=== copying over dir $copy_source_dir"
cp -rLp $copy_source_dir/* $root/
chroot $root /sbin/mkinitrd_setup # TODO remove this
}
# seed the ldap database # seed the ldap database
# FIXME: this does not work off a netboot distro # FIXME: this does not work off a netboot distro
slapcat | chroot $root /usr/sbin/slapadd -qw slapcat | chroot $root /usr/sbin/slapadd -qw
@ -889,7 +949,16 @@ cmd_install()
set_sysconf_value etc/sysconfig/dhcpd DHCPD_CONF_INCLUDE_FILES \ set_sysconf_value etc/sysconfig/dhcpd DHCPD_CONF_INCLUDE_FILES \
"/etc/hosts /etc/ldap.conf /etc/openldap/ldap.conf /etc/certs /etc/nsswitch.conf /etc/dhcpd.conf.d" "/etc/hosts /etc/ldap.conf /etc/openldap/ldap.conf /etc/certs /etc/nsswitch.conf /etc/dhcpd.conf.d"
cat $root_password_file | chroot $root /usr/bin/passwd --stdin echo "=== using root password file $root_password_file"
case $suse_version in
11.4)
cat $root_password_file | chroot $root /usr/bin/passwd --stdin
;;
*)
echo -n root: | cat - $root_password_file | chroot $root /usr/sbin/chpasswd
;;
esac
chroot $root /sbin/ldconfig chroot $root /sbin/ldconfig
chroot $root /sbin/SuSEconfig chroot $root /sbin/SuSEconfig
chroot $root /opt/jux/bin/jux-init-namespace.sh chroot $root /opt/jux/bin/jux-init-namespace.sh
@ -898,11 +967,14 @@ cmd_install()
install -m 777 -d $root/srv/nfs/var/cores install -m 777 -d $root/srv/nfs/var/cores
install -m 777 -d $root/var/cores install -m 777 -d $root/var/cores
for c in \ chroot $root /usr/sbin/pam-config -c
/etc/pam.d/* \ chroot $root /usr/sbin/pam-config -a --ldap
; do
cp -rp $c $root$c # for c in \
done # /etc/pam.d/* \
# ; do
# cp -rp $c $root$c
# done
unmount_devices unmount_devices
[ -w "$install_dev" ] || { [ -w "$install_dev" ] || {