Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
jijisa
/
porch
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a7bcd0ba
authored
Mar 24, 2017
by
Heechul Kim
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updated
parent
7b698eb4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
19 deletions
srv/fai/config/scripts/CENTOS/40-install-grub
srv/fai/config/scripts/CENTOS/60-network-scripts
srv/fai/config/scripts/DEBIAN/30-interface
srv/fai/config/scripts/PORCH/10-sshkey
srv/fai/config/scripts/CENTOS/40-install-grub
View file @
a7bcd0ba
...
...
@@ -37,9 +37,17 @@ fi
mount
-o
bind
/dev
$target
/dev
cat
>
$target
/etc/default/grub
<<-
EOF
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 console=tty0 console=ttyS0,115200"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no"
GRUB_DISABLE_RECOVERY="true"
EOF
if
[
-f
$target
/usr/sbin/grub2-install
]
;
then
# CentOS 7
$ROOTCMD
grub2-install
--no-floppy
"
$BOOT_DEVICE
"
$ROOTCMD
grub2-mkconfig
--output
=
/boot/grub2/grub.cfg
...
...
srv/fai/config/scripts/CENTOS/60-network-scripts
View file @
a7bcd0ba
...
...
@@ -9,25 +9,37 @@ error=0 ; trap "error=$((error|1))" ERR
if
[
$FAI_ACTION
!=
"softupdate"
]
then
ainsl
-v
/etc/sysconfig/network
"^GATEWAY=
$GATEWAYS_1
\$
"
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/sysconfig/network-scripts/ifcfg-
eth0
<<-
EOF
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/sysconfig/network-scripts/ifcfg-
$NIC1
<<-
EOF
# generated by FAI
DEVICE=
eth0
DEVICE=
$NIC1
BOOTPROTO=static
ONBOOT=yes
HWADDR=`ip l sh dev
eth0
| tail -1 | cut -d" " -f6`
HWADDR=`ip l sh dev
$NIC1
| tail -1 | cut -d" " -f6`
IPADDR=
$IPADDR
NETMASK=
$NETMASK
GATEWAY=
$GATEWAYS
EOF
# Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf
# from within the chroot. The following hack puts it in there
# so that Kudzu doesn't overwrite our config on first boot.
if
[
-f
$target
/sbin/kudzu
]
;
then
grep
eth
0
$target
/etc/sysconfig/hwconf
||
$ROOTCMD
kudzu
-c
NETWORK
-p
\
grep
eth
1
$target
/etc/sysconfig/hwconf
||
$ROOTCMD
kudzu
-c
NETWORK
-p
\
>>
$target
/etc/sysconfig/hwconf
fi
fi
# Add service network interface
if
[
-f
$FAI
/svc-interface
]
then
echo
"Add service interface"
# Get NIC name
SVC_NIC
=
$(
grep
'^DEVICE='
$FAI
/svc-interface|cut
-d
'='
-f2
)
cp
$FAI
/svc-interface
$target
/etc/sysconfig/network-scripts/ifcfg-
$SVC_NIC
else
echo
"No svc-interface. So set gateway on NIC1."
echo
"GATEWAY=
$GATEWAYS
"
>>
$target
/etc/sysconfig/network-scripts/ifcfg-
$NIC1
fi
# Set hostname
[
-n
"
$HOSTNAME
"
]
&&
echo
$HOSTNAME
>
$target
/etc/hostname
...
...
srv/fai/config/scripts/DEBIAN/30-interface
View file @
a7bcd0ba
...
...
@@ -2,17 +2,18 @@
error
=
0
;
trap
'error=$(($?>$error?$?:$error))'
ERR
# save maximum error code
if
ifclass DHCPC
&&
[
$FAI_ACTION
=
"install"
-o
$FAI_ACTION
=
"dirinstall"
]
then
cat
>
$target
/etc/network/interfaces
<<-
EOF
# generated by FAI
auto lo
$NIC1
iface lo inet loopback
iface
$NIC1
inet dhcp
EOF
elif
[
$FAI_ACTION
=
"install"
-o
$FAI_ACTION
=
"dirinstall"
]
then
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/network/interfaces
<<-
EOF
#if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
#then
# cat > $target/etc/network/interfaces <<-EOF
# # generated by FAI
# auto lo $NIC1
# iface lo inet loopback
# iface $NIC1 inet dhcp
#EOF
#elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
#then
# PXE network config.
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/network/interfaces
<<-
EOF
# generated by FAI
auto lo
$NIC1
iface lo inet loopback
...
...
@@ -20,12 +21,21 @@ then
address
$IPADDR
netmask
$NETMASK
broadcast
$BROADCAST
gateway
$GATEWAYS
EOF
[
-n
"
$NETWORK
"
]
&&
echo
"localnet
$NETWORK
"
>
$target
/etc/networks
if
[
!
-L
$target
/etc/resolv.conf
-a
-e
/etc/resolv.conf
]
;
then
cp
-p
/etc/resolv.conf
$target
/etc
fi
#fi
# Add service network interface (fixed to 'eth1' for now)
if
[
-f
$FAI
/svc-interface
]
then
echo
"Add service interface"
cat
$FAI
/svc-interface
>>
$target
/etc/network/interfaces
else
echo
"No svc-interface. So set gateway on NIC1."
echo
" gateway
$GATEWAY
"
>>
$target
/etc/network/interfaces
fi
# here fcopy is mostly used, when installing a client for running in a
...
...
srv/fai/config/scripts/PORCH/10-sshkey
View file @
a7bcd0ba
...
...
@@ -11,7 +11,7 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
if
[
-f
$FAI
/pubkeys/authorized_keys
]
then
# lock the root password
$ROOTCMD
usermod
-L
root
#
$ROOTCMD usermod -L root
mkdir
-p
$target
/root/.ssh
&&
chmod 700
$target
/root/.ssh
cat
$FAI
/pubkeys/authorized_keys
>
$target
/root/.ssh/authorized_keys
chmod 600
$target
/root/.ssh/authorized_keys
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment