install text %include /tmp/source.ks reboot --eject lang en_US.UTF-8 keyboard us rootpw r00tme timezone --utc Etc/UTC firewall --disabled selinux --disabled # ignore unsupported hardware warning unsupported_hardware # SKIP CONFIGURING X skipx # NEVER ever place zerombr here, it breaks automated installation %include /tmp/bootloader.ks %include /tmp/partition.ks # PREINSTALL SECTION # HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE # INSTALLATION PROCESS ITSELF %pre #!/bin/sh # hard drives drives="" removable_drives="" for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do if !(blkid | grep -q "${drv}.*Fuel"); then if (grep -q 0 /sys/block/${drv}/removable); then drives="${drives} ${drv}" else removable_drives="${removable_drives} ${drv}" fi fi done default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` installdrive=${installdrive:-undefined} forceformat=${forceformat:-no} for I in $(cat /proc/cmdline); do case "$I" in *=*) if ! [[ "${I}" =~ "." ]]; then eval "$I"; fi ;; esac done set ${drives} ${removable_drives} numdrives=`echo $#` tgtdrive="${installdrive}" function confirm_format { check_drive="$1" local confirm_format="no" if [[ "$forceformat" == "yes" ]] ; then return 0 fi if parted -s /dev/$check_drive print &>/dev/null ; then echo echo "$check_drive drive contains partition table:" parted -s /dev/$check_drive print echo read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then return 0 else return 1 fi else return 0 fi } format_confirmed="no" if [ $numdrives -lt 1 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* There is no suitable media available for installation. *' echo '* Please attach a drive and try again. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to shut down the system: " _ poweroff fi if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 while [ "${tgtdrive}" = "undefined" ]; do clear echo echo '********************************************************************************' echo '* W A R N I N G *' echo '* *' echo '* Which of the detected hard drives do you want to be used as *' echo '* the installation target? *' echo '* *' echo '********************************************************************************' echo echo "Possible choices" echo "Persistent drives: ${drives}" echo "Removable drives: ${removable_drives}" echo if [ `echo ${drives} | wc -w` -eq 1 ] ; then read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive else read -p "Choose hard drive: " tgtdrive fi match="no" for drive in ${drives[@]} ${removable_drives[@]}; do if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then if confirm_format $tgtdrive ; then format_confirmed="yes" break else tgtdrive="undefined" read -p "You may select another disk. Press Enter to continue." _ fi fi done if [[ "$match" == "no" ]]; then tgtdrive="undefined" read -p "Invalid choice. Press Enter to continue." _ fi done clear chvt 1 else tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"` fi if [ "$format_confirmed" != "yes" ] ; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 if ! confirm_format $tgtdrive ; then clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* Disk $tgtdrive contains active partition(s). *' echo '* Installation cannot continue without confirmation. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to restart: " _ reboot fi chvt 1 fi # verify tgtdrive is at least 41GB tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) if [ $tgtdrivesize -lt 41984 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* Your disk is under 41GB in size. Installation cannot continue. *' echo '* Restart installation with a larger disk. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to restart: " _ reboot fi # paths in /dev have "/" instead of "!" for cciss devices tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') # source if test -e /dev/disk/by-label/"OpenStack_Fuel"; then echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks else echo "cdrom" > /tmp/source.ks fi vgremove -ff os dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10 sleep 3 hdparm -z /dev/${tgtdrive} parted -s /dev/${tgtdrive} mklabel gpt parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24 parted -s /dev/${tgtdrive} set 1 bios_grub on parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224 parted -s /dev/${tgtdrive} set 2 boot on parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424 sleep 3 hdparm -z /dev/${tgtdrive} # partition # This adds support for the p seperator required for cciss devices if echo ${tgtdrive} | grep -q -e cciss ; then bootdev=${tgtdrive}p else bootdev=${tgtdr
# Copyright (c) 2017 Intel Corporation
#
# 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.
import argparse
import collections
import os
from packaging import version as pkg_version
import sys
from openstack_requirements import requirement
PROJECT_REQUIREMENTS_FILES = ['requirements.txt']
QUALIFIER_CHARS = ['<', '>', '!', '=']
def _grab_args():
"""Grab and return arguments"""
parser = argparse.ArgumentParser(
description='Check if project requirements have changed')
parser.add_argument('env_dir', help='tox environment directory')
return parser.parse_args()
def _extract_reqs(file_name, blacklist=None):
blacklist = blacklist or {}
content = open(file_name, 'rt').read()
reqs = collections.defaultdict(tuple)
parsed = requirement.parse(content)
for name, entries in ((name, entries) for (name, entries) in parsed.items()
if (name and name not in blacklist)):
list_reqs = [r for (r, line) in entries]
# Strip the comments out before checking if there are duplicates
list_reqs_stripped = [r