33# ###############################################################################
44# Name : make_iso.sh #
55# Author : Ibrahim Musayev #
6- # Purpose : creates a new ISO image named CentOS-7 -x86_64.iso and includes #
6+ # Purpose : creates a new ISO image named Rocky-8 -x86_64.iso and includes #
77# latest version of kickstart script. Also, The script provides #
88# an interactive menu for the user to choose between generating #
99# a new kickstart script or proceeding with an existing one. #
1010# History : 15.05.23 Ibrahim Musayev, creation #
1111# ###############################################################################
1212
13- iso_file=" CentOS-7 -x86_64-Everything-2009 .iso"
14- new_iso_name=" CentOS-7- x86_64.iso"
13+ iso_file=" Rocky-8.9 -x86_64-minimal .iso"
14+ new_iso_name=" Rocky-8-9- x86_64-dvd .iso"
1515downloads_dir=" $HOME /Downloads"
1616new_iso_dir=$downloads_dir /iso
1717mnt_iso_dir=" /mnt/iso"
1818tmp_workdir=" /tmp/workdir"
1919tmp_workdir_iso=" $tmp_workdir /iso"
2020kickstart_dir=" $tmp_workdir_iso /kickstart"
2121python_replace_parameters=" replace_parameters_in_ks_cfg.py"
22- ks_cfg=$1
22+ ks_cfg=" iad1-ks-physical.cfg"
23+ isolinux_cfg=" isolinux-rocky.cfg"
24+ user_mod=$( whoami)
2325
2426detect_python_command () {
2527 if command -v python3 & > /dev/null; then
@@ -43,10 +45,13 @@ generate_new_kickstart_script() {
4345proceed_with_existing_kickstart_script () {
4446 echo " Proceeding with existing kickstart script..."
4547 # Check if the kickstart script name is provided
46- if [ -z " $1 " ]; then
47- read -p " Please provide the name of the kickstart script: " ks_cfg
48+ if [ -z " $ks_cfg " ]; then
49+ read -p " Please provide the name of the kickstart script: " ks_cfg
4850 else
49- ks_cfg=$1
51+ read -p " The kickstart script is currently set to '$ks_cfg '. Are you sure you want to continue with this script? (y/n): " confirm
52+ if [ " $confirm " != " y" ]; then
53+ read -p " Please provide a new name for the kickstart script: " ks_cfg
54+ fi
5055 fi
5156}
5257
@@ -110,17 +115,19 @@ if [ -f "$downloads_dir/$iso_file" ]; then
110115 echo " The $kickstart_dir directory doesn't exist. Creating it..."
111116 sudo mkdir -p " $kickstart_dir "
112117 sudo cp -p " $ks_cfg " " $kickstart_dir /ks.cfg"
113- sudo cp -p " isolinux.cfg " " $tmp_workdir_iso /isolinux/isolinux.cfg"
118+ sudo cp -p " $isolinux_cfg " " $tmp_workdir_iso /isolinux/isolinux.cfg"
114119 # Check if the copy operation was successful
115120 if [ $? -eq 0 ]; then
116121 echo " Kickstart script copied successfully."
117122 echo " Creating a $new_iso_name File" && cd $tmp_workdir_iso
118- sudo genisoimage -o $new_iso_name -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V " CentOS 7 x86_64" -R -J -v -T .
123+ sudo genisoimage -o $new_iso_name -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V " Rocky 8 x86_64" -R -J -v -T .
119124 if [ $? -eq 0 ]; then
120125 echo " $new_iso_name File successfully created..."
121126 sudo mv $new_iso_name $new_iso_dir
122127 echo " The new file is moved to the $new_iso_dir directory..."
123128 sudo umount " $mnt_iso_dir " 2> /dev/null
129+ sudo chmod -R 755 $new_iso_dir
130+ sudo chown -R $user_mod :$user_mod $new_iso_dir
124131 else
125132 echo " $new_iso_name File creation failed. Exiting..."
126133 exit 1
@@ -135,6 +142,6 @@ if [ -f "$downloads_dir/$iso_file" ]; then
135142 fi
136143else
137144 echo " Please download the ISO file: $iso_file "
138- echo " First you need a CentOS-7 ISO --> https://www.centos .org/download/"
145+ echo " First you need a Rocky-8 ISO --> https://rockylinux .org/download/"
139146 exit 1
140147fi
0 commit comments