Giter Club home page Giter Club logo

Comments (9)

PJ-Singh-001 avatar PJ-Singh-001 commented on August 16, 2024 1

This a bit of a hack, but here is how you can achieve what you want to do...

  1. Create a file named cubic.template, add the following contents, and save it.

    [Project]
    cubic_version = CUBIC_VERSION
    create_date = TIME_STAMP
    modify_date = TIME_STAMP
    directory = PROJECT_DIRECTORY
    
    [Original]
    iso_file_name = ORIGINAL_ISO_FILE
    iso_directory = ORIGINAL_ISO_DIRECTORY
    iso_volume_id = Unknown
    iso_release_name = 
    iso_disk_name = 
    
    [Custom]
    iso_version_number = MY_ISO_VERSION_NUMBER
    iso_file_name = MY_ISO_FILE_NAME
    iso_directory = MY_ISO_DIRECTORY
    iso_volume_id = MY_ISO_VOLUME_ID
    iso_release_name = MY_ISO_RELEASE_NAME
    iso_disk_name = MY_ISO_DISK_NAME
    
    [Status]
    is_success_copy = False
    is_success_extract = False
    iso_template = 
    casper_directory = 
    squashfs_file_name = 
    iso_checksum = 
    iso_checksum_file_name = 
    
    [Options]
    update_os_release = True
    boot_configurations = boot/grub/grub.cfg,boot/grub/loopback.cfg,isolinux/txt.cfg
    compression = xz
    
  2. You can execute the following steps on the command line or add them to your script.

  3. Set the following variables.

    CUBIC_VERSION=`dpkg-query --showformat='${Version}\n' --show cubic`
    TIME_STAMP=$(date '+%Y-%m-%d %H:%M')
    
  4. Set the following variables with your desired values.

    PROJECT_DIRECTORY='/home/pico/Documents/Linux Mint 20.3 Cinnamon Updated 2022.01.12'
    ORIGINAL_ISO_FILE='linuxmint-20.3-cinnamon-64bit.iso'
    ORIGINAL_ISO_DIRECTORY='/home/pico/Documents'
    
    MY_ISO_VERSION_NUMBER='2022.01.12'
    MY_ISO_FILE_NAME='linuxmint-20.3-cinnamon-64bit-updated-22.01.12.iso'
    MY_ISO_DIRECTORY="$PROJECT_DIRECTORY"
    MY_ISO_VOLUME_ID='Linux Mint 20.3 Cinnamon 64-bit'
    MY_ISO_RELEASE_NAME='Una - Updated 2022.01.12'
    MY_ISO_DISK_NAME='Linux Mint 20.3 Cinnamon 64-bit "Una - Updated 2022.01.12"'
    MY_ISO_RELEASE_NOTES_URL='https://www.linuxmint.com/rel_una_cinnamon.php'
    
  5. Create an empty project directory and copy the template into it.

    mkdir "$PROJECT_DIRECTORY"
    cp cubic.template "$PROJECT_DIRECTORY/cubic.conf"
    
  6. Update the template with your desired values from step 3 above.

    sed -i "s|CUBIC_VERSION|$CUBIC_VERSION|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|TIME_STAMP|$TIME_STAMP|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|PROJECT_DIRECTORY|$PROJECT_DIRECTORY|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|ORIGINAL_ISO_FILE|$ORIGINAL_ISO_FILE|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|ORIGINAL_ISO_DIRECTORY|$ORIGINAL_ISO_DIRECTORY|g" "$PROJECT_DIRECTORY/cubic.conf"
    
    sed -i "s|MY_ISO_VERSION_NUMBER|$MY_ISO_VERSION_NUMBER|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|MY_ISO_FILE_NAME|$MY_ISO_FILE_NAME|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|MY_ISO_DIRECTORY|$MY_ISO_DIRECTORY|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|MY_ISO_VOLUME_ID|$MY_ISO_VOLUME_ID|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|MY_ISO_RELEASE_NAME|$MY_ISO_RELEASE_NAME|g" "$PROJECT_DIRECTORY/cubic.conf"
    sed -i "s|MY_ISO_DISK_NAME|$MY_ISO_DISK_NAME|g" "$PROJECT_DIRECTORY/cubic.conf"
    
    cat "$PROJECT_DIRECTORY/cubic.conf"
    
  7. Set the ISO release notes URL.

    mkdir --parents "$PROJECT_DIRECTORY/custom-disk/.disk"
    echo "$MY_ISO_RELEASE_NOTES_URL" | tee "$PROJECT_DIRECTORY/custom-disk/.disk/release_notes_url"
    
  8. Run Cubic.

    Take advantage of the enhancement #13 in order to pass the project directory to Cubic as a command line argument.

    cubic "$PROJECT_DIRECTORY"
    

from cubic.

PJ-Singh-001 avatar PJ-Singh-001 commented on August 16, 2024 1

With this approach, we are simulating an existing project. For existing projects, the original ISO information is read from the cubic.conf file and is not extracted from the original ISO. (The reason for this is that the user may no longer have the original ISO handy when they want to update an existing project). As a result, you will notice that some of the Original ISO fields are blank or not available. Nevertheless, this will not adversely affect your customizations.

Screenshot from 2022-01-15 22-39-38

from cubic.

PicoMitchell avatar PicoMitchell commented on August 16, 2024 1

Thanks for this info, I've updated by new Cubic project creation script to hardcode a known compatible Cubic version!

Also, here is how I'm currently setting up a new customized Cubic project in case it's interesting to you or useful for anyone in the future:

#!/bin/bash

os_version='20.3'
os_codename='Una'
build_date="$(date '+%y.%m.%d')"

cubic_project_parent_path="${HOME}/Documents"
cubic_project_path="${cubic_project_parent_path}/Linux Mint ${os_version} Cinnamon Updated 20${build_date}"
cubic_project_disk_path="${cubic_project_path}/custom-disk"

if [[ ! -f "${cubic_project_path}/cubic.conf" ]]; then
    # Create new project template based on these instructions: https://github.com/PJ-Singh-001/Cubic/issues/12#issuecomment-1013804874

    mkdir -p "${cubic_project_path}"

    cubic_conf_version='2022.01-69-release~202201160230~ubuntu20.04.1'
    # IMPORTANT: This cubic_conf_version should be set to a version of Cubic that is known the be compatible with the following "cubic.conf" format.
    # The currently installed Cubic version can be retrieved with "dpkg-query --show cubic" (or by copy-and-pasting it from a new "cubic.conf" file made by Cubic).
    # If the "cubic.conf" format is ever changed in the future, having this previous Cubic version listed in the "cubic.conf" file will let Cubic know that it needs to be migrated (and will show a screen like this: https://github.com/PJ-Singh-001/Cubic/wiki/Migrate-Page).
    # If this happens, and a future version of Cubic needs to migrate this "cubic.conf" format, this script should be updated with the new format and a new compatible Cubic version so that migration is not necessary for each new project.
    # Reference: https://github.com/PJ-Singh-001/Cubic/issues/12#issuecomment-1015001654

    current_timestamp="$(date '+%F %H:%M')"

    cat << CUBIC_CONF_EOF > "${cubic_project_path}/cubic.conf"
[Project]
cubic_version = ${cubic_conf_version}
create_date = ${current_timestamp}
modify_date = ${current_timestamp}
directory = ${cubic_project_path}

[Original]
iso_file_name = linuxmint-${os_version}-cinnamon-64bit.iso
iso_directory = ${cubic_project_parent_path}
iso_volume_id = Linux Mint ${os_version} Cinnamon 64-bit
iso_release_name = ${os_codename}
iso_disk_name = Linux Mint ${os_version} "${os_codename}" - Release amd64

[Custom]
iso_version_number = 20${build_date}
iso_file_name = linuxmint-${os_version}-cinnamon-64bit-updated-${build_date}.iso
iso_directory = ${cubic_project_path}
iso_volume_id = Linux Mint ${os_version} Cinnamon 64-bit
iso_release_name = ${os_codename} - Updated 20${build_date}
iso_disk_name = Linux Mint ${os_version} Cinnamon 64-bit "${os_codename} - Updated 20${build_date}"

[Status]
is_success_copy = False
is_success_extract = False
iso_template = 
casper_directory = 
squashfs_file_name = 
iso_checksum = 
iso_checksum_file_name = 

[Options]
update_os_release = False
boot_configurations = boot/grub/grub.cfg,boot/grub/loopback.cfg,isolinux/isolinux.cfg
compression = xz
CUBIC_CONF_EOF

    mkdir -p "${cubic_project_disk_path}/.disk"
    echo "http://www.linuxmint.com/rel_${os_codename,,}_cinnamon.php" > "${cubic_project_disk_path}/.disk/release_notes_url"
fi

nohup cubic "${cubic_project_path}" &> /dev/null & disown

from cubic.

PJ-Singh-001 avatar PJ-Singh-001 commented on August 16, 2024

Would you please share which fields on the Project page you need to customize/change for each β€œnew” project?

from cubic.

PJ-Singh-001 avatar PJ-Singh-001 commented on August 16, 2024

Also, let me know which fields you have attempted to change in the cubic.conf file?

from cubic.

PicoMitchell avatar PicoMitchell commented on August 16, 2024

Ideally, I would like to be able to supply a partial cubic.conf file for a new project like this (which would be created dynamically with a script to have all the current date and specified version etc):

[Original]
iso_file_name = linuxmint-20.3-cinnamon-64bit.iso
iso_directory = /home/pico/Documents

[Custom]
iso_version_number = 2022.01.12
iso_file_name = linuxmint-20.3-cinnamon-64bit-updated-22.01.12.iso
iso_directory = /home/pico/Documents/Linux Mint 20.3 Cinnamon Updated 2022.01.12
iso_volume_id = Linux Mint 20.3 Cinnamon 64-bit
iso_release_name = Una - Updated 2022.01.12
iso_disk_name = Linux Mint 20.3 Cinnamon 64-bit "Una - Updated 2022.01.12"

[Options]
update_os_release = False
boot_configurations = boot/grub/grub.cfg,boot/grub/loopback.cfg,isolinux/isolinux.cfg
compression = xz

Then, Cubic could fill in the rest and treat is as if I just selected that specified iso file for the first time. I didn't mention the [Original] section in my original request, but it would be nice to be able to specify part of that section as well without needing to manually fill in the other iso_volume_id, iso_release_name, and iso_disk_name keys in that section.

Trying to start a new project with this partial cubic.conf file hit exceptions because the [Project] sections were missing. I was able to fill more and more to be able to get to the project customization page, but then I got more exceptions because the [Status] section was missing since I'm assuming Cubic didn't realize it needed to do that part since the cubic.conf file already existed.

I'm envisioning that I could have a create-new-cubic-project.sh type script that would create the /home/pico/Documents/Linux Mint 20.3 Cinnamon Updated 2022.01.12 folder and create this partial cubic.conf file in it. Then, I would just open Cubic and select that folder and start the process without needing to fill any of those customization fields out manually.

from cubic.

PicoMitchell avatar PicoMitchell commented on August 16, 2024

This is awesome, thank you so much for this info!

Looking forward to setting up some new project automation first thing on Monday!

from cubic.

PicoMitchell avatar PicoMitchell commented on August 16, 2024

This customized new project setup is working great and makes creating new updated iso's so much smoother with Cubic! Thank you again for this info and for Cubic!

I am curious about a future-proofing consideration though...

If Cubic's configuration is ever changed again in the future, would Cubic detect if migration is necessary based on the version listed in the cubic.conf file? Or would it be based on the other contents of the cubic.conf file or some other indicator in the structure of the project?

Since this current setup always sets the cubic_version attribute in the [Project] section to the currently installed version, I'm wondering if that could cause an issue with any necessary migration in the future. Would it be safer to set the cubic_version attribute to a current version that I know works with this cubic.conf structure so that any necessary future migration is triggered, or would this cubic_version attribute not matter in that case?

from cubic.

PJ-Singh-001 avatar PJ-Singh-001 commented on August 16, 2024

You are right, the cubic_version attribute in the [Project] section of the cubic.conf file is used to determine if migration is necessary.

If there is a significant change, you would need to update the template to match the new version.

To avoid this, your idea to use a known version makes sense. (When you run Cubic, it will automatically update the cubic_version value in cubic.conf to the currently running version of Cubic any way. This helps keep track of which version of Cubic was last used on your project).

So go ahead and use the output of dpkg -l cubic (i.e. 2022.01-69-release~202201...) as a hard coded value, since you know that the cubic.template file works with this version of Cubic.

from cubic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.