Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General Script Improvements #3

Open
e-dong opened this issue Sep 11, 2022 · 2 comments
Open

General Script Improvements #3

e-dong opened this issue Sep 11, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@e-dong
Copy link

e-dong commented Sep 11, 2022

This is a very nice script! These are just some improvements to make it better.

General Comments

t would be better to capture the status code of a command or bash function with $?. This will let you early exit and provide an error message rather than attempting to go to the next step of the installation.
E.g. metis-sideload

displayArt
settingFont
checkingConnection
updateMirrors
diskPartition
baseCompleted
kernelCompleted
generatingFstab
copyingConfig
firstphaseCompleted

It might make sense to chain the each value of $? and check if it is equal to 0 before calling the next function.

Specific Comments

metis-sideload

It would be nice if we could edit the partition again after quitting the specified tool in case the user wants to makes further edits, otherwise the user has to start up metis-sideload again and run through the steps again.

post_install.sh

When adding the user in addingUser(), there should be input validation loops for the username and password. Currently the function will fail if given an incorrect username syntax or failing to input the password correctly 2 times. Once it fails, the script will go to the next step, sudoAccess().

final.sh

In the pointsToRemember() function:

pointToRemember() {
    sleep 2s
    clear
    echo "After Reboting into newly installed metis linux system, you must select xinitrc in login screen."
    echo "There's are options like Dwm, shell and xinitrc above the username field. Strictly select xinitrc, then enter your username and password and login."
    echo " "
    sleep 15s
}

Reboting, should be rebooting.

@whoisYoges
Copy link
Contributor

Thank you for the feedbacks!
But,

  1. I think we don't need to capture the status code in
displayArt
settingFont
checkingConnection
updateMirrors
diskPartition
baseCompleted
kernelCompleted
generatingFstab
copyingConfig
firstphaseCompleted

cause all the tasks inside these functions are being checked and if something wrong goes inside it, it'll exit with status code 1.

Example: If you see checkingConnection;

checkingConnection() {
  sleep 2s
  clear
  echo "Checking internet connection..."
  ping -c 3 metislinux.org || networkError
  echo  "Cool! Internet connection available. Getting ready for installation..."
  sleep 3s
}

If ping exits with non zero status code; it'll run networkError function which is

networkError() {
  sleep 2s
  clear
  echo -e "Could not connect to the internet.\nCheck your internet connection and please try again.\nExiting...\nReport any bugs or errors to https://github.com/metis-os/reports/issues"
  sleep 2s
  exit 1
}

And It'll exit the script with certain error message.

If you think using the status code and giving error after each function make the script better we can do that as well. Other than that you do have good, valid improvment points.

It will take us some time to make changes cause we're working on the disc encryption (many people were demanding it) so, if you do have some time and want to contribute; why don't you open a PR?

@whoisYoges whoisYoges added the enhancement New feature or request label Sep 18, 2022
@e-dong
Copy link
Author

e-dong commented Sep 19, 2022

Thank you for your response! What's the process for contributing? I only have been coding for work and personal projects and I haven't done any open source contributions before. I'm assuming I have to fork the repo instead of cloning and creating a branch?

I also saw your post about leaving github for codeberg. Will the metis repos be migrated on that platform. If so, I can create an account on codeberg for contributions 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants