Skip to content

Commit

Permalink
Rewrite the install script
Browse files Browse the repository at this point in the history
[Prehistory]

The profile script was no more usable due to a undocumented behavior
of "dconf resulting in whether overriden profiles or error messages.
The logic of the script worked previously, but the "dconf" or
"gsettings" API changed breaking the script (forks of "terminal.sexy"(1))
which's logic is used by almost all GNOME Terminal theme projects.

I've reported #789056 to the official GNOME bug tracker for the "dconf
component which got closed with the following reason:

> This is simply an error in your script: you're using dconf to read keys
that have never been written to. You need to use the gsettings tool
instead, which takes into account the schema so it can return the default
value in that case.

I tried to find the documentation where this behavior of "dconf" is
described, but it seems like this knowledge is only documented in the
code itself or internal developer documents.

[Description]

Since the script was never really optimized I decided to rewrite it to
fix issues like GH-12 and GH-3 and implement the following additional
features:

  * Profile Handling - the script is now able to detect available
  profiles and
    * clone the default profile if no specific profile has been
    specified - The script is able to get the UUID of the "default"
    profile and clone it
    * install the theme for a specific profile - the user can pass the
    name of the profile the theme should be installed to
    * handle already existing "Nord" profiles via version comparison -
    if the "Nord" profile already exists and the script version is less
    than the installed version the user must confirm whether to override
    the theme of abort the installation, otherwise the profile will be
      * updated if the script version is greater than the installed
        version
      * reinstalled if the installed version is equal to the script
        version
  * Log Level - the script now provides a option to allow the user to
    define the log level. Available log levels are
      * 0 - ERROR
      * 1 - WARNING
      * 2 - SUCCESS (default)
      * 3 - INFO
      * 4 - DEBUG
  * Dependency Management -  the script is able to validate all required
    dependencies to ensure the script can run on the executive
    environment which includes
    * dconf (dconf)
    * expr (coreutils)
    * gsettings (glib2)
    * uuidgen (util-linux)

References:
  (1) https://terminal.sexy
  (2) https://bugzilla.gnome.org/show_bug.cgi?id=789056

Fixes GH-12 and GH-3

GH-13
  • Loading branch information
arcticicestudio committed Oct 28, 2017
1 parent 1023a87 commit 50dcc94
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 147 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img src="https://cdn.rawgit.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/nord-gnome-terminal-banner.svg"/></p>
<p align="center"><img src="https://cdn.rawgit.com/arcticicestudio/nord-gnome-terminal/develop/assets/nord-gnome-terminal-banner.svg"/></p>

<p align="center"><img src="https://assets-cdn.github.com/favicon.ico" width=24 height=24/> <a href="https://github.com/arcticicestudio/nord-gnome-terminal/releases/latest"><img src="https://img.shields.io/github/release/arcticicestudio/nord-gnome-terminal.svg?style=flat-square"/></a> <a href="https://github.com/arcticicestudio/nord/releases/tag/v0.2.0"><img src="https://img.shields.io/badge/Nord-v0.2.0-88C0D0.svg?style=flat-square"/></a></p>

Expand All @@ -10,7 +10,7 @@ Implemented the main shell script theme file [`nord.sh`](https://github.com/arct

Detailed information about features and install instructions can be found in the [README](https://github.com/arcticicestudio/nord-gnome-terminal/blob/develop/README.md#installation) and in the [project wiki](https://github.com/arcticicestudio/nord-gnome-terminal/wiki).

<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-colortest.png"/><br><strong>htop</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-htop.png"/></p>
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-colortest.png"/><br><strong>htop</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-htop.png"/></p>

# 0.0.0 (2016-12-22)
**Project Initialization**
53 changes: 47 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img src="https://cdn.rawgit.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/nord-gnome-terminal-banner.svg"/></p>
<p align="center"><img src="https://cdn.rawgit.com/arcticicestudio/nord-gnome-terminal/develop/assets/nord-gnome-terminal-banner.svg"/></p>

<p align="center"><img src="https://assets-cdn.github.com/favicon.ico" width=24 height=24/> <a href="https://github.com/arcticicestudio/nord-gnome-terminal/releases/latest"><img src="https://img.shields.io/github/release/arcticicestudio/nord-gnome-terminal.svg?style=flat-square"/></a> <a href="https://github.com/arcticicestudio/nord/releases/tag/v0.2.0"><img src="https://img.shields.io/badge/Nord-v0.2.0-88C0D0.svg?style=flat-square"/></a></p>

Expand All @@ -9,7 +9,7 @@ Based on the <a href="https://github.com/arcticicestudio/nord">Nord</a> color pa

---

<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-colortest.png"/><blockquote>Font: <a href="https://adobe-fonts.github.io/source-code-pro">Source Code Pro</a> 12px.</blockquote></p>
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-colortest.png"/><blockquote>Font: <a href="https://adobe-fonts.github.io/source-code-pro">Source Code Pro</a> 12px.</blockquote></p>

## Getting started

Expand All @@ -28,9 +28,50 @@ Some distributions may require additional package(s):
The packages should be available for all distributions using the GNOME Terminal by default.

### Installation
Run the [`nord.sh`](https://github.com/arcticicestudio/nord-gnome-terminal/blob/develop/src/sh/nord.sh) shell script to create the `Nord` GNOME Terminal profile.

Run the [`nord.sh`](https://github.com/arcticicestudio/nord-gnome-terminal/blob/develop/src/nord.sh) shell script to start the automated installation.

A list of available options can be shown with `-h`, ``--help`.

```sh
./nord.sh --help
```

**Usage**: `nord.sh [OPTIONS]`

* `-h`, `--help` - Shows the help
* `-l`, `--loglevel <LOG_LEVEL>`, `--loglevel=<LOG_LEVEL>` - Set the log level
* `0` *ERROR*
* `1` *WARNING*
* `2` *SUCCESS* (default)
* `3` *INFO*
* `4` *DEBUG*
* `-p`, `--profile <PROFILE_NAME>`, `--profile=<PROFILE_NAME>` - The name of the profile to use for the theme. If not specified a new profile as clone of the *default* profile will be created.

<!-- TODO: It will create a `Nord` GNOME Terminal profile. -->

### Profile Handling

The script detects available profiles and

* **clones the default profile if no specific profile has been specified** - this ensures that no custom profile colors are overriden
* **allows to install the theme for a specific profile** - the name of the profile the theme should be installed to can be passed using the `-p`/`--profile` option
* **handles already existing Nord profiles via version comparison** - if the *Nord* profile already exists and the script version is less than the installed version a confirmation is shown whether to override the theme of abort the installation, otherwise the profile will be
* **updated** if the script version is **greater than** the installed version
* **reinstalled** if the installed version is **equal to** the script version

### Log Level

The script provides a `-l`/`--loglevel` option to allow to define the log level. Available levels are

* `0` *ERROR* - The script will run in *silent mode*, only error messages are shown
* `1` *WARNING* - Shows *warning* messages
* `2` *SUCCESS* (default) - Shows *success* messages
* `3` *INFO* - Shows additional *information* messages
* `4` *DEBUG* - Runs the script in *debug mode* showing additional debug messages

### Activation

#### Set as default profile
1. Open the *Preferences*
2. Switch to the *Profiles* tab
Expand All @@ -45,7 +86,7 @@ Run the [`nord.sh`](https://github.com/arcticicestudio/nord-gnome-terminal/blob/
![][scrot-readme-lazy-profile-change]

## Screenshots
<p align="center"><strong>htop</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-htop.png"/></p>
<p align="center"><strong>htop</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-htop.png"/></p>

## Development
[![](https://img.shields.io/badge/Changelog-0.1.0-81A1C1.svg?style=flat-square)](https://github.com/arcticicestudio/nord-gnome-terminal/blob/v0.1.0/CHANGELOG.md) [![](https://img.shields.io/badge/Workflow-gitflow--branching--model-81A1C1.svg?style=flat-square)](http://nvie.com/posts/a-successful-git-branching-model) [![](https://img.shields.io/badge/Versioning-ArcVer_0.8.0-81A1C1.svg?style=flat-square)](https://github.com/arcticicestudio/arcver)
Expand All @@ -70,8 +111,8 @@ Please report issues/bugs, feature requests and suggestions for improvements to
[mint-dconf-service]: https://community.linuxmint.com/software/view/dconf-service
[mint-dconf-tools]: https://community.linuxmint.com/software/view/dconf-tools
[mint-uuid-runtime]: https://community.linuxmint.com/software/view/uuid-runtime
[scrot-readme-default-profile]: https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-readme-default-profile.png
[scrot-readme-lazy-profile-change]: https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/src/assets/scrot-readme-lazy-profile-change.png
[scrot-readme-default-profile]: https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-readme-default-profile.png
[scrot-readme-lazy-profile-change]: https://raw.githubusercontent.com/arcticicestudio/nord-gnome-terminal/develop/assets/scrot-readme-lazy-profile-change.png
[ubuntu-dconf-cli]: https://packages.ubuntu.com/search?keywords=dconf-cli
[ubuntu-dconf-gsettings-backend]: https://packages.ubuntu.com/search?keywords=dconf-gsettings-backend
[ubuntu-dconf-service]: https://packages.ubuntu.com/search?keywords=dconf-service
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit 50dcc94

Please sign in to comment.