GithubHelp home page GithubHelp logo

milovangudelj / doyourthing-og Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 8.38 MB

A script that installs for me all my programs and packages as well as some system configurations.

Home Page: https://doyourthing.dev

Shell 37.25% CMake 7.79% C++ 47.07% JavaScript 1.65% TypeScript 6.03% CSS 0.21%

doyourthing-og's Introduction

Do Your Thing

A script that installs for me all my programs and packages as well as some system configurations.

Why?

As a linux user you'll inevitably have to reinstall your OS at some point. Whether it is because you messed up something while tinkering with it and you don't know how to fix it, or because you need more disk space and you placed the partition at the end of the disk, it will happen. And when that happens you will want to reinstall and setup everything as fast as possible without having to manually type in every single command that you ran throughout your previous run. And for that I present to you my installer script.

The script

It's long, but simple. It has a couple of useful helper functions (title(), theend()) for printing pretty output and a function (dyt()) that executes your install/config commands.

It's divided into sections:

- Colors

I set up some ANSI/VT100 terminal color and control codes as reusable variables (e.g. GREEN="\033[32m")

- Functions / Counter

Here you'll find success/fail counter variables along with the aforementioned funcitions' declarations. More on that later.

- Execution

This is the boring section. It's just a bunch of calls to dyt() with the steps to install/configure everything. The good thing is that you'll have to type this out only once unless you decide to change something later on.

Funtions

This is the fun part.

dyt()

It accepts two or more arguments, the first being a descriptive title of the operation you're trying to perform and the remaining ones represent a list of commands that you want to execute for that particular operation.

For example, let's say you want to install Node.js. This would be the command that you'd put in the file:

# Node.js
dyt "Node.js (npm)" "dnf module install nodejs:16"

For complete automation I would also add in a couple of dnf flags like -q -y -C to suppress output, accept everything and use chached repo metadata (provided that you updated it beforehand). Every command passed in is evaluated and depending on its outcome a success or failure counter is updated. At the end of the script a message will be printed with the two counters color coded for easy access.

title()

It accepts one argument and it prints it as a section title. Useful for easy text formatting on all titles.

title "Installing packages..."

By default it outputs the given text in bold with a couple of new line characters after it.

theend()

It accepts two arguments:

  • An optional message to be printed on script completion or termination along with the count of successful and failed installs. If not provided it will default to "\n${BOLD}* Done! *${RESET}"

  • An optional seed for the message colors that will be passed to lolcat. If not provided it will default to 175 (a greenish gradient)

theend "\n${BOLD}* Done! *${RESET}" 175

The message will be printed along with the count of successful installs.

Output example

TODO

  • Complete the functions documentation
  • Make the second theend() argument optional
  • Update README to reflect latest changes and implementation in C++

doyourthing-og's People

Contributors

milovangudelj avatar

Stargazers

 avatar

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.