Merge pull request #7 from gmkurtzer/configure_adds
I've been testing this and it is working well at this point.
This commit is contained in:
2
Makefile
2
Makefile
@@ -53,6 +53,8 @@ files: all
|
||||
# restorecon -r /var/lib/tftpboot/warewulf
|
||||
cp -r overlays /var/warewulf/
|
||||
chmod +x /var/warewulf/overlays/system/default/init.ww
|
||||
chmod 600 /var/warewulf/overlays/system/default/etc/ssh/ssh*
|
||||
chmod 644 /var/warewulf/overlays/system/default/etc/ssh/ssh*.pub.ww
|
||||
mkdir -p /var/warewulf/overlays/system/default/warewulf/bin/
|
||||
cp wwclient /var/warewulf/overlays/system/default/warewulf/bin/
|
||||
|
||||
|
||||
14
etc/hosts.tmpl
Normal file
14
etc/hosts.tmpl
Normal file
@@ -0,0 +1,14 @@
|
||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
||||
|
||||
|
||||
{{range $node := $.AllNodes}}
|
||||
# Entry for {{$node.Id.Get}}
|
||||
{{- range $devname, $netdev := $node.NetDevs}}
|
||||
{{- if $netdev.Default}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}
|
||||
{{- else}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}-{{$devname}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{end}}
|
||||
@@ -14,3 +14,8 @@ tftp:
|
||||
enabled: true
|
||||
tftproot: /var/lib/tftpboot
|
||||
systemd name: tftp
|
||||
nfs:
|
||||
systemd name: nfs-server
|
||||
exports:
|
||||
- /home
|
||||
- /var/warewulf
|
||||
@@ -2,13 +2,11 @@ package dhcp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/brotherpowers/ipsubnet"
|
||||
"github.com/hpcng/warewulf/internal/pkg/node"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@@ -99,14 +97,9 @@ func Configure(show bool) error {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
mask := net.IPMask(net.ParseIP(controller.Netmask).To4())
|
||||
size, _ := mask.Size()
|
||||
|
||||
sub := ipsubnet.SubnetCalculator(controller.Ipaddr, size)
|
||||
|
||||
d.Ipaddr = controller.Ipaddr
|
||||
d.Network = sub.GetNetworkPortion()
|
||||
d.Netmask = sub.GetSubnetMask()
|
||||
d.Network = controller.Network
|
||||
d.Netmask = controller.Netmask
|
||||
d.RangeStart = controller.Dhcp.RangeStart
|
||||
d.RangeEnd = controller.Dhcp.RangeEnd
|
||||
|
||||
|
||||
74
internal/app/wwctl/configure/hosts/main.go
Normal file
74
internal/app/wwctl/configure/hosts/main.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package hosts
|
||||
|
||||
import (
|
||||
"github.com/hpcng/warewulf/internal/pkg/node"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type TemplateStruct struct {
|
||||
Ipaddr string
|
||||
Fqdn string
|
||||
AllNodes []node.NodeInfo
|
||||
}
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
var replace TemplateStruct
|
||||
|
||||
if util.IsFile("/etc/warewulf/hosts.tmpl") == false {
|
||||
wwlog.Printf(wwlog.WARN, "Template not found, not updating host file\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
controller, err := warewulfconf.New()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
n, err := node.New()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not open node configuration: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
tmpl, err := template.ParseFiles("/etc/warewulf/hosts.tmpl")
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not parse hosts template: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
w, err := os.OpenFile("/etc/hosts", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer w.Close()
|
||||
|
||||
nodes, _ := n.FindAllNodes()
|
||||
|
||||
replace.AllNodes = nodes
|
||||
replace.Ipaddr = controller.Ipaddr
|
||||
replace.Fqdn = controller.Fqdn
|
||||
|
||||
if SetShow == false {
|
||||
err = tmpl.Execute(w, replace)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
} else {
|
||||
err = tmpl.Execute(os.Stdout, replace)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
22
internal/app/wwctl/configure/hosts/root.go
Normal file
22
internal/app/wwctl/configure/hosts/root.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package hosts
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "hosts",
|
||||
Short: "NFS configuration",
|
||||
Long: "NFS Config",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
SetShow bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
79
internal/app/wwctl/configure/nfs/main.go
Normal file
79
internal/app/wwctl/configure/nfs/main.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package nfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
controller, err := warewulfconf.New()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if controller.Network == "" {
|
||||
wwlog.Printf(wwlog.ERROR, "Network must be defined in warewulf.conf to configure NFS\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
if controller.Netmask == "" {
|
||||
wwlog.Printf(wwlog.ERROR, "Netmask must be defined in warewulf.conf to configure NFS\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if SetShow == false {
|
||||
exports, err := os.OpenFile("/etc/exports", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer exports.Close()
|
||||
|
||||
fstab, err := os.OpenFile("/var/warewulf/overlays/system/default/etc/fstab", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer fstab.Close()
|
||||
|
||||
fmt.Fprintf(exports, "# This file was written by Warewulf (wwctl configure nfs)\n")
|
||||
fmt.Fprintf(fstab, "# This file was written by Warewulf (wwctl configure nfs)\n")
|
||||
|
||||
fmt.Fprintf(fstab, "rootfs / tmpfs defaults 0 0\n")
|
||||
fmt.Fprintf(fstab, "devpts /dev/pts devpts gid=5,mode=620 0 0\n")
|
||||
fmt.Fprintf(fstab, "tmpfs /run/shm tmpfs defaults 0 0\n")
|
||||
fmt.Fprintf(fstab, "sysfs /sys sysfs defaults 0 0\n")
|
||||
fmt.Fprintf(fstab, "proc /proc proc defaults 0 0\n")
|
||||
|
||||
for _, export := range controller.Nfs.Exports {
|
||||
fmt.Fprintf(exports, "%s %s/%s(sync)\n", export, controller.Network, controller.Netmask)
|
||||
fmt.Fprintf(fstab, "%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export, export)
|
||||
}
|
||||
|
||||
fmt.Printf("Enabling and restarting the NFS services\n")
|
||||
if controller.Nfs.SystemdName == "" {
|
||||
util.SystemdStart("nfs-server")
|
||||
} else {
|
||||
util.SystemdStart(controller.Nfs.SystemdName)
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.Printf("/etc/exports:\n")
|
||||
for _, export := range controller.Nfs.Exports {
|
||||
fmt.Printf("%s %s/%s\n", export, controller.Network, controller.Netmask)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("SYSTEM OVERLAY: default/etc/fstab:\n")
|
||||
for _, export := range controller.Nfs.Exports {
|
||||
fmt.Printf("%s:%s %s nfs defaults 0 0\n", controller.Ipaddr, export, export)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
22
internal/app/wwctl/configure/nfs/root.go
Normal file
22
internal/app/wwctl/configure/nfs/root.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package nfs
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var (
|
||||
baseCmd = &cobra.Command{
|
||||
Use: "nfs",
|
||||
Short: "NFS configuration",
|
||||
Long: "NFS Config",
|
||||
RunE: CobraRunE,
|
||||
}
|
||||
SetShow bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
baseCmd.PersistentFlags().BoolVarP(&SetShow, "show", "s", false, "Show configuration (don't update)")
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
func GetCommand() *cobra.Command {
|
||||
return baseCmd
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package configure
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/configure/dhcp"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/configure/hosts"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/configure/nfs"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/configure/ssh"
|
||||
"github.com/hpcng/warewulf/internal/app/wwctl/configure/tftp"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
@@ -21,6 +24,10 @@ var (
|
||||
func init() {
|
||||
baseCmd.AddCommand(dhcp.GetCommand())
|
||||
baseCmd.AddCommand(tftp.GetCommand())
|
||||
baseCmd.AddCommand(hosts.GetCommand())
|
||||
baseCmd.AddCommand(ssh.GetCommand())
|
||||
baseCmd.AddCommand(nfs.GetCommand())
|
||||
|
||||
baseCmd.PersistentFlags().BoolVarP(&SetDoAll, "all", "a", false, "Configure all services")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,48 @@
|
||||
package ssh
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
err := os.MkdirAll("/etc/warewulf/keys", 0755)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not create base directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if util.IsFile("/etc/warewulf/keys/ssh_host_rsa_key") == false {
|
||||
fmt.Printf("Setting up key: ssh_host_rsa_key\n")
|
||||
util.ExecInteractive("ssh-keygen", "-q", "-t", "rsa", "-f", "/etc/warewulf/keys/ssh_host_rsa_key", "-C", "", "-N", "")
|
||||
} else {
|
||||
fmt.Printf("Skipping, key already exists: ssh_host_rsa_key\n")
|
||||
}
|
||||
|
||||
if util.IsFile("/etc/warewulf/keys/ssh_host_dsa_key") == false {
|
||||
fmt.Printf("Setting up key: ssh_host_dsa_key\n")
|
||||
util.ExecInteractive("ssh-keygen", "-q", "-t", "dsa", "-f", "/etc/warewulf/keys/ssh_host_dsa_key", "-C", "", "-N", "")
|
||||
} else {
|
||||
fmt.Printf("Skipping, key already exists: ssh_host_dsa_key\n")
|
||||
}
|
||||
|
||||
if util.IsFile("/etc/warewulf/keys/ssh_host_ecdsa_key") == false {
|
||||
fmt.Printf("Setting up key: ssh_host_ecdsa_key\n")
|
||||
util.ExecInteractive("ssh-keygen", "-q", "-t", "ecdsa", "-f", "/etc/warewulf/keys/ssh_host_ecdsa_key", "-C", "", "-N", "")
|
||||
} else {
|
||||
fmt.Printf("Skipping, key already exists: ssh_host_ecdsa_key\n")
|
||||
}
|
||||
|
||||
if util.IsFile("/etc/warewulf/keys/ssh_host_ed25519_key") == false {
|
||||
fmt.Printf("Setting up key: ssh_host_ed25519_key\n")
|
||||
util.ExecInteractive("ssh-keygen", "-q", "-t", "ed25519", "-f", "/etc/warewulf/keys/ssh_host_ed25519_key", "-C", "", "-N", "")
|
||||
} else {
|
||||
fmt.Printf("Skipping, key already exists: ssh_host_ed25519_key\n")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
ps1string := fmt.Sprintf("[%s] Warewulf> ", containerName)
|
||||
os.Setenv("PS1", ps1string)
|
||||
os.Setenv("HISTFILE", "/dev/null")
|
||||
|
||||
err := syscall.Exec(args[1], args[1:], os.Environ())
|
||||
if err != nil {
|
||||
|
||||
@@ -29,8 +29,8 @@ type NodeConf struct {
|
||||
IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"`
|
||||
IpmiNetmask string `yaml:"ipmi netmask,omitempty"`
|
||||
IpmiGateway string `yaml:"ipmi gateway,omitempty"`
|
||||
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
|
||||
SystemOverlay string `yaml:"system overlay files,omitempty"`
|
||||
RuntimeOverlay string `yaml:"runtime overlay,omitempty"`
|
||||
SystemOverlay string `yaml:"system overlay,omitempty"`
|
||||
Init string `yaml:"init,omitempty"`
|
||||
Discoverable bool `yaml:"discoverable,omitempty"`
|
||||
Profiles []string `yaml:"profiles,omitempty"`
|
||||
|
||||
@@ -12,7 +12,7 @@ func templateFileInclude(path string) string {
|
||||
wwlog.Printf(wwlog.DEBUG, "Including file into template: %s\n", path)
|
||||
content, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.WARN, "Could not include file into template: %s\n", err)
|
||||
wwlog.Printf(wwlog.VERBOSE, "Could not include file into template: %s\n", err)
|
||||
}
|
||||
return strings.TrimSuffix(string(content), "\n")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ package warewulfconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/brotherpowers/ipsubnet"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
)
|
||||
|
||||
func New() (ControllerConf, error) {
|
||||
@@ -23,6 +25,22 @@ func New() (ControllerConf, error) {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
if ret.Ipaddr == "" {
|
||||
wwlog.Printf(wwlog.WARN, "IP address is not configured in warewulfd.conf\n")
|
||||
}
|
||||
if ret.Netmask == "" {
|
||||
wwlog.Printf(wwlog.WARN, "Netmask is not configured in warewulfd.conf\n")
|
||||
}
|
||||
|
||||
if ret.Network == "" {
|
||||
mask := net.IPMask(net.ParseIP(ret.Netmask).To4())
|
||||
size, _ := mask.Size()
|
||||
|
||||
sub := ipsubnet.SubnetCalculator(ret.Ipaddr, size)
|
||||
|
||||
ret.Network = sub.GetNetworkPortion()
|
||||
}
|
||||
|
||||
if ret.Warewulf.Port == 0 {
|
||||
ret.Warewulf.Port = 9873
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ type ControllerConf struct {
|
||||
Comment string `yaml:"comment"`
|
||||
Ipaddr string `yaml:"ipaddr"`
|
||||
Netmask string `yaml:"netmask"`
|
||||
Network string `yaml:"network,omitempty"`
|
||||
Fqdn string `yaml:"fqdn,omitempty"`
|
||||
Warewulf *WarewulfConf `yaml:"warewulf"`
|
||||
Dhcp *DhcpConf `yaml:"dhcp"`
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
|
||||
{{range $node := $.AllNodes}}
|
||||
# Entry for {{$node.Id}}
|
||||
# Entry for {{$node.Id.Get}}
|
||||
{{- range $devname, $netdev := $node.NetDevs}}
|
||||
{{- if $netdev.Default}}
|
||||
{{$netdev.Ipaddr}} {{$node.Id}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}
|
||||
{{- else}}
|
||||
{{$netdev.Ipaddr}} {{$node.Fqdn}}-{{$devname}}
|
||||
{{$netdev.Ipaddr.Get}} {{$node.Id.Get}}-{{$devname}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{end}}
|
||||
|
||||
1
overlays/system/default/etc/ssh/ssh_host_dsa_key.pub.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_dsa_key.pub.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_dsa_key.pub"}}
|
||||
1
overlays/system/default/etc/ssh/ssh_host_dsa_key.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_dsa_key.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_dsa_key"}}
|
||||
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key.pub"}}
|
||||
1
overlays/system/default/etc/ssh/ssh_host_ecdsa_key.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_ecdsa_key.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key"}}
|
||||
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ed25519_key.pub"}}
|
||||
1
overlays/system/default/etc/ssh/ssh_host_ed25519_key.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_ed25519_key.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_ed25519_key"}}
|
||||
1
overlays/system/default/etc/ssh/ssh_host_rsa_key.pub.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_rsa_key.pub.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_rsa_key.pub"}}
|
||||
1
overlays/system/default/etc/ssh/ssh_host_rsa_key.ww
Normal file
1
overlays/system/default/etc/ssh/ssh_host_rsa_key.ww
Normal file
@@ -0,0 +1 @@
|
||||
{{Include "/etc/warewulf/keys/ssh_host_rsa_key"}}
|
||||
@@ -4,10 +4,62 @@
|
||||
# know what you are doing and even then you should make a backup.
|
||||
#
|
||||
# Edit at your own risk! DANGER DANGER.
|
||||
mkdir /newroot
|
||||
mount wwroot /newroot -t tmpfs
|
||||
|
||||
cat <<EOF >/newroot/wwinit
|
||||
#!/bin/sh
|
||||
|
||||
mount -t proc none /proc
|
||||
mount -t sysfs none /sys
|
||||
mount -t devtmpfs devtmpfs /dev
|
||||
|
||||
# This will eventually be optional
|
||||
if true; then
|
||||
if [ -f "/etc/pam.d/system-auth" ]; then
|
||||
sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/system-auth
|
||||
fi
|
||||
|
||||
if [ -f "/etc/pam.d/password-auth" ]; then
|
||||
sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/password-auth
|
||||
fi
|
||||
|
||||
if [ -f "/etc/pam.d/common-account" ]; then
|
||||
sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/common-account
|
||||
fi
|
||||
fi
|
||||
|
||||
/sbin/ip link set dev lo up
|
||||
|
||||
nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
|
||||
|
||||
if test -x /sbin/load_policy && test -x /sbin/restorecon; then
|
||||
/sbin/load_policy -i
|
||||
/sbin/restorecon -r /
|
||||
fi
|
||||
|
||||
echo "Calling {{$.Init}}..."
|
||||
echo
|
||||
|
||||
rm /wwinit
|
||||
chmod 755 /
|
||||
|
||||
sleep 2
|
||||
exec {{$.Init}}
|
||||
EOF
|
||||
chmod 755 /newroot/wwinit
|
||||
|
||||
tar -cf - --exclude /proc --exclude /sys --exclude /dev --exclude /newroot . | tar -xf - -C /newroot
|
||||
mount proc /proc -t proc
|
||||
exec /sbin/switch_root /newroot /wwinit
|
||||
|
||||
|
||||
|
||||
echo "Warewulf v4 is now booting"
|
||||
|
||||
|
||||
|
||||
|
||||
/bin/bash
|
||||
|
||||
# Considering what to do if we are operating on a read only root
|
||||
if false; then
|
||||
@@ -25,16 +77,11 @@ if false; then
|
||||
|
||||
fi
|
||||
|
||||
mount -t proc none /proc
|
||||
mount -t sysfs none /sys
|
||||
mount -t devtmpfs devtmpfs /dev
|
||||
|
||||
/sbin/ip link set dev lo up
|
||||
|
||||
nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
|
||||
|
||||
nohup /ipmi >/var/log/ipmi.log 2>&1 </dev/null &
|
||||
|
||||
chmod 755 /
|
||||
echo "Calling {{$.Init}}..."
|
||||
echo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user