Skip to content

Instantly share code, notes, and snippets.

@Rorosha
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rorosha/55746a17738343c920d7 to your computer and use it in GitHub Desktop.
Save Rorosha/55746a17738343c920d7 to your computer and use it in GitHub Desktop.
convert cloud instance to a server product
#!/bin/sh
#
# Script to migrate a cloud instance (cattle) to a server (pet).
# Ported from the cloudtoserver [0] written in python.
#
# [0] https://github.com/fedora-cloud/cloudtoserver
#
# Author: Mike Ruckman (roshi AT fedoraproject.org)
convertToServer () {
# Change the fedora-release-cloud package to the correct server package
echo "Swapping fedora-release product packages..."
yum -y swap -- install fedora-release-server -- remove fedora-release-cloud \
firewalld-config-standard
}
installServerProduct () {
# Install the Server product environment
echo "Installing the server product..."
yum install @^server-product-environment -y
systemctl enable cockpit.service
}
stopCloudInit () {
# Stop cloud-init from running on reboot
systemctl disable cloud-init.service
}
echo "We will now attempt to transition to the Fedora Server Product."
echo "Are you sure you want to continue? (y/N):"
read accept
if [ $accept = 'Y' ] || [ $accept = 'y' ]; then
convertToServer
installServerProduct
else
echo "User has declined."
exit
fi
echo "Do you want to stop cloud init? (y/N):"
read cloudoff
if [ $cloudoff = 'Y' ] || [ $cloudoff = 'y' ]; then
stopCloudInit
else
echo "Leaving cloud-init running."
fi
# This is a kludge to fix the growroot bug
# https://bugzilla.redhat.com/show_bug.cgi?id=1147998
echo "Running workaround for BZ1147998..."
dd if=/usr/share/syslinux/mbr.bin of=/dev/vda
echo "Done! Your cloud instance is now a Server Product!"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment