diff options
Diffstat (limited to 'resources/tools/disk-image-builder/centos/scripts-remote')
6 files changed, 0 insertions, 325 deletions
diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/cleanup.sh b/resources/tools/disk-image-builder/centos/scripts-remote/cleanup.sh deleted file mode 100644 index 850c6958fb..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/cleanup.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -echo "********** CLEANING UP **********" - -# Clean up host keys only if we're using cloud-init -# (which will generate new keys upon next boot). This -# currently applies to Qemu build only. - -if dpkg -s cloud-init > /dev/null 2>&1 -then - rm -f /etc/ssh/ssh_host_* -fi - -# Remove root's password, old resolv.conf and DHCP lease -passwd -d root -passwd -l root -rm -f /etc/resolv.conf -pkill dhclient -rm -f /var/lib/dhcp/*leases - -echo "********** SCHEDULING SHUTDOWN IN 1 MINUTE **********" -sync -shutdown -h +1 -exit diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/disable_ipv6.sh b/resources/tools/disk-image-builder/centos/scripts-remote/disable_ipv6.sh deleted file mode 100644 index 43e59787a7..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/disable_ipv6.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -echo "********** Disabling IPv6 ***********" -# Disable on all existing interfaces -echo net.ipv6.conf.all.IPv6_disable=1 > /etc/sysctl.d/10-IPv6_disable.conf -# Disable by default for any new interfaces -echo net.ipv6.conf.default.IPv6_disable=1 >> /etc/sysctl.d/10-IPv6_disable.conf
\ No newline at end of file diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/post-install.sh b/resources/tools/disk-image-builder/centos/scripts-remote/post-install.sh deleted file mode 100644 index fdaeebd58c..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/post-install.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -TEMP_PATH="/root/temp" - -echo ==========================Remove NetworkManager============================ -systemctl disable NetworkManager -systemctl enable network -yum -y remove NetworkManager - -cat - > /etc/sysconfig/network-scripts/ifcfg-eth0 <<"_EOF" -DEVICE=eth0 -BOOTPROTO=dhcp -ONBOOT=yes -_EOF -echo =======================End Remove NetworkManager=========================== - -### -### RPMs -### -echo "********** INSTALLING RPMs **********" - -# If it exists, copy in a specific Centos Repo for the Centos version for this image . - -# Attempt up to five cycles of unpack/configure. There may be dependency -# problems during the first one(s). -echo ==========================yum repos============================== -if [ -f ${TEMP_PATH}/rpm/Centos-Vault.repo ] ; then - echo ==========================Install specific yum repo====================== - sed -i '/gpgcheck=1/s/.*/&\nenabled=0/' /etc/yum.repos.d/CentOS-Base.repo - cp -f ${TEMP_PATH}/rpm/Centos-Vault.repo /etc/yum.repos.d -else - echo ==========================Update from base repo and updates================ - : ; -fi -attempt=1 -MAX_ATTEMPTS=3 -try_again=1 - -RPM_FILE=${TEMP_PATH}/rpm/rpm-packages.txt -while [ $attempt -le $MAX_ATTEMPTS ] && [ $try_again -eq 1 ] -do - try_again=0 - while read name url - do - # use rpm command if url is present in the package file - if [ ! -z $url ] ; then - rpm -i $url$name.rpm || try_again=1 - else - yum install -y $name || try_again=1 - fi - done < $RPM_FILE - attempt=$(( $attempt + 1 )) -done - -if [[ ( $try_again == 1 ) ]] -then - echo "Still encountered errors after ${MAX_ATTEMPTS} attempts." -fi - -## -## PIP -## -echo "********** INSTALLING PIP PACKAGES **********" -pip install --no-index --find-links ${TEMP_PATH}/pip/ -r ${TEMP_PATH}/requirements.txt - - -echo "********** CREATING HISTORIC LINK FOR QEMU, COPY NESTED VM IMAGE **********" -mkdir -p /opt/qemu/bin -ln -s /usr/bin/qemu-system-x86_64 /opt/qemu/bin/qemu-system-x86_64 - -mkdir -p /var/lib/vm - -echo "Embedding nested VM image on this image" -mkdir /var/lib/vm/images -cp ${TEMP_PATH}/nested-vm/* /var/lib/vm/images/ -# There should only be one file at this time -ln -s /var/lib/vm/images/* /var/lib/vm/vhost-nested.img - -ls -lR /var/lib/vm - -# Mount hugepages directory for nested VM -mkdir -p /mnt/huge -echo 'hugetlbfs /mnt/huge hugetlbfs mode=1770,gid=111 0 0' >> /etc/fstab - -## -## Java -## -echo "********** CREATING JAVA SHELL PROFILE **********" -mkdir -p /etc/profile.d -echo 'export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64' > /etc/profile.d/java.sh -echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile.d/java.sh - - -## -## Changelog -## -echo "********** MOVING CHANGELOG AND VERSION FILES **********" - -mv ${TEMP_PATH}/VERSION / -mv ${TEMP_PATH}/CHANGELOG / - -echo "********** CLEANING UP **********" -rm -fr ${TEMP_PATH} diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/serial-console-centos-7-1511.sh b/resources/tools/disk-image-builder/centos/scripts-remote/serial-console-centos-7-1511.sh deleted file mode 100644 index 6107db99dc..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/serial-console-centos-7-1511.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -## -## Serial console -## -echo "********** CONFIGURING SERIAL CONSOLE **********" -cat - > /etc/systemd/system/serial-getty-digi@.service <<"_EOF" -# ttyS0 - getty -# -# This service maintains a getty on ttyS0 from the point the system is -# started until it is shut down again. -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -[Service] -ExecStart=-/sbin/agetty -L %I 115200 -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target -_EOF - -cat - > /etc/default/grub <<"_EOF" -# If you change this file, run 'update-grub' afterwards to update -# /boot/grub/grub.cfg. -# For full documentation of the options in this file, see: -# info -f grub -n 'Simple configuration' - -GRUB_DEFAULT=0 -GRUB_TIMEOUT=5 -GRUB_DISABLE_SUBMENU=true -GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" -GRUB_CMDLINE_LINUX="rhgb quiet console=tty0 console=ttyS0,115200n8" - -GRUB_TERMINAL=serial -GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1" - -# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux -#GRUB_DISABLE_LINUX_UUID=true - -# Uncomment to disable generation of recovery mode menu entries -#GRUB_DISABLE_RECOVERY="true" - -# Uncomment to get a beep at grub start -#GRUB_INIT_TUNE="480 440 1" -_EOF - -grub2-mkconfig -o /boot/grub2/grub.cfg -sudo systemctl enable serial-getty-digi@ttyS0.service -sudo systemctl start serial-getty-digi@ttyS0.service diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-guestadditions.sh b/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-guestadditions.sh deleted file mode 100644 index ec1c064437..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-guestadditions.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -echo "********** Installing VirtualBox Guest Additions (sigh) **********" -mkdir /mnt/VBoxGuestAdditions -mount VBoxGuestAdditions.iso /mnt/VBoxGuestAdditions/ -/mnt/VBoxGuestAdditions/VBoxLinuxAdditions.run -umount /mnt/VBoxGuestAdditions -rmdir /mnt/VBoxGuestAdditions/ -rm -f VBoxGuestAdditions.iso diff --git a/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-user.sh b/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-user.sh deleted file mode 100644 index 31ef17f147..0000000000 --- a/resources/tools/disk-image-builder/centos/scripts-remote/vagrant-user.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -e - -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -echo "********** Adding Vagrant user ***********" -# Remove cloud-init as this will slow down the Vagrant boot -export DEBIAN_FRONTEND=noninteractive -apt-get purge -y cloud-init - -# Add Vagrant user -useradd -c "Vagrant User" -m -s /bin/bash vagrant - -mkdir /home/vagrant/.ssh -cat - > /home/vagrant/.ssh/authorized_keys <<_EOF -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key -_EOF - -chown -R vagrant.vagrant /home/vagrant/.ssh -chmod 700 /home/vagrant/.ssh - -mkdir -p /etc/sudoers.d -cat - > /etc/sudoers.d/vagrant <<_EOF -vagrant ALL=(root) NOPASSWD:ALL -_EOF -chmod 440 /etc/sudoers.d/vagrant - -echo "********** Rebooting with new kernel **********" -reboot -sleep 60 |