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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
18 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
...
@@ -37,9 +37,17 @@ fi
mount
-o
bind
/dev
$target
/dev
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
if
[
-f
$target
/usr/sbin/grub2-install
]
;
then
# CentOS 7
# CentOS 7
$ROOTCMD
grub2-install
--no-floppy
"
$BOOT_DEVICE
"
$ROOTCMD
grub2-install
--no-floppy
"
$BOOT_DEVICE
"
$ROOTCMD
grub2-mkconfig
--output
=
/boot/grub2/grub.cfg
$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
...
@@ -9,25 +9,37 @@ error=0 ; trap "error=$((error|1))" ERR
if
[
$FAI_ACTION
!=
"softupdate"
]
if
[
$FAI_ACTION
!=
"softupdate"
]
then
then
ainsl
-v
/etc/sysconfig/network
"^GATEWAY=
$GATEWAYS_1
\$
"
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
# generated by FAI
DEVICE=
eth0
DEVICE=
$NIC1
BOOTPROTO=static
BOOTPROTO=static
ONBOOT=yes
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
IPADDR=
$IPADDR
NETMASK=
$NETMASK
NETMASK=
$NETMASK
GATEWAY=
$GATEWAYS
EOF
EOF
# Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf
# Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf
# from within the chroot. The following hack puts it in there
# from within the chroot. The following hack puts it in there
# so that Kudzu doesn't overwrite our config on first boot.
# so that Kudzu doesn't overwrite our config on first boot.
if
[
-f
$target
/sbin/kudzu
]
;
then
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
>>
$target
/etc/sysconfig/hwconf
fi
fi
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
# Set hostname
[
-n
"
$HOSTNAME
"
]
&&
echo
$HOSTNAME
>
$target
/etc/hostname
[
-n
"
$HOSTNAME
"
]
&&
echo
$HOSTNAME
>
$target
/etc/hostname
...
...
srv/fai/config/scripts/DEBIAN/30-interface
View file @
a7bcd0ba
...
@@ -2,16 +2,17 @@
...
@@ -2,16 +2,17 @@
error
=
0
;
trap
'error=$(($?>$error?$?:$error))'
ERR
# save maximum error code
error
=
0
;
trap
'error=$(($?>$error?$?:$error))'
ERR
# save maximum error code
if
ifclass DHCPC
&&
[
$FAI_ACTION
=
"install"
-o
$FAI_ACTION
=
"dirinstall"
]
#if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
then
#then
cat
>
$target
/etc/network/interfaces
<<-
EOF
# cat > $target/etc/network/interfaces <<-EOF
# generated by FAI
# # generated by FAI
auto lo
$NIC1
# auto lo $NIC1
iface lo inet loopback
# iface lo inet loopback
iface
$NIC1
inet dhcp
# iface $NIC1 inet dhcp
EOF
#EOF
elif
[
$FAI_ACTION
=
"install"
-o
$FAI_ACTION
=
"dirinstall"
]
#elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
then
#then
# PXE network config.
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/network/interfaces
<<-
EOF
[
-n
"
$IPADDR
"
]
&&
cat
>
$target
/etc/network/interfaces
<<-
EOF
# generated by FAI
# generated by FAI
auto lo
$NIC1
auto lo
$NIC1
...
@@ -20,12 +21,21 @@ then
...
@@ -20,12 +21,21 @@ then
address
$IPADDR
address
$IPADDR
netmask
$NETMASK
netmask
$NETMASK
broadcast
$BROADCAST
broadcast
$BROADCAST
gateway
$GATEWAYS
EOF
EOF
[
-n
"
$NETWORK
"
]
&&
echo
"localnet
$NETWORK
"
>
$target
/etc/networks
[
-n
"
$NETWORK
"
]
&&
echo
"localnet
$NETWORK
"
>
$target
/etc/networks
if
[
!
-L
$target
/etc/resolv.conf
-a
-e
/etc/resolv.conf
]
;
then
if
[
!
-L
$target
/etc/resolv.conf
-a
-e
/etc/resolv.conf
]
;
then
cp
-p
/etc/resolv.conf
$target
/etc
cp
-p
/etc/resolv.conf
$target
/etc
fi
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
fi
# here fcopy is mostly used, when installing a client for running in a
# 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
...
@@ -11,7 +11,7 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
if
[
-f
$FAI
/pubkeys/authorized_keys
]
if
[
-f
$FAI
/pubkeys/authorized_keys
]
then
then
# lock the root password
# lock the root password
$ROOTCMD
usermod
-L
root
#
$ROOTCMD usermod -L root
mkdir
-p
$target
/root/.ssh
&&
chmod 700
$target
/root/.ssh
mkdir
-p
$target
/root/.ssh
&&
chmod 700
$target
/root/.ssh
cat
$FAI
/pubkeys/authorized_keys
>
$target
/root/.ssh/authorized_keys
cat
$FAI
/pubkeys/authorized_keys
>
$target
/root/.ssh/authorized_keys
chmod 600
$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