whip

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

README

Whip

The whip tool was born with the mission to simplify the integration of the actions to follow after the installation of a package and/or to manage OS checks.

It uses YAML to handle the triggers/hooks to run.

In the Gentoo/Funtoo worlds this means for the post-install phase to execute the commands now available inside the ebuilds in the postinst section.

Specifications

Hereinafter, an example of the YAML content of the actions to run:


hooks:
  elogind_postinst:
    remediate: elogind_setup
    check: elogind_valid
    description: | 
      blah blah blah. This is what it does. This is why it is needed.
    keywords:
      - core
      - elogind
    actions:
      # Action executed in &&.
      - do something
  elogind_postrm:
    remediate: elogind_postrm
    check: elogind_cleanup
    description: | 
      blah blah blah. This is what it does. This is why it is needed.
    actions:
      # Action executed in &&.
      - do something
    depends:
      - hooks_1
    keywords:
      - core
      - elogind

  mime_update:
    remediate: x_setup
    check: xorg_valid
    description: |
      Update mime and gdk database/cache.
    actions:
      - source /etc/profile && update-mime-database /usr/share/mime
      - source /etc/profile && gdk-pixbuf-query-loaders --update-cache
    keywords:
      - x

  gtk_update:
    remediate: x_setup
    check: xorg_valid
    description: |
      Update gdk and glib database/schemas.
    actions:
      # Fix gnome icons caches
      - rm -f /usr/share/icons/hicolor/icon-theme.cache
      - source /etc/profile && gtk-update-icon-cache -f /usr/share/icons/*
      - source /etc/profile && glib-compile-schemas /usr/share/glib-2.0/schemas
    keywords:
      - x

  fonts_create_scale:
    remediate: x_setup
    check: xorg_valid
    description: |
      Create fonts.scale file
    envs:
      # Required envs
      - FONT_DIR
    actions:
      - >-
        if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
        echo "Generating fonts.scale for ${FONT_DIR}" ;
        mkfontscale
        -a "${EROOT}/usr/share/fonts/encodings/encodings.dir"
        -- "${EROOT}/usr/share/fonts/${FONT_DIR}" ;
        fi

    keywords:
      - x
      - fonts

  fonts_create_dir:
    remediate: x_setup
    check: xorg_valid
    description: |
      Create fonts dir.
    envs:
      # Required envs
      - FONT_DIR
    actions:
      - >-
        echo "Generating fonts.dir for ${FONT_DIR}"
        mkfontdir
        -e "${EROOT}"/usr/share/fonts/encodings
        -e "${EROOT}"/usr/share/fonts/encodings/large
        -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
    keywords:
      - x
      - fonts

  fonts_setup:
    remediate: x_setup
    check: xorg_valid
    description: |
      Setup all available fonts
    actions:
      - >-
        for i in $(ls ${EROOT}/usr/share/fonts/) ; do
        if [ $i != "encoding" ] ; then
        FONT_DIR=$i whip hook fonts_create_scale ;
        FONT_DIR=$i whip hook fonts_create_dir ;
        fi ;
        done
    keywords:
      - x
      - fonts

Commands

# will call all hooks with remediate x_setup
$> whip remediate x_setup

# Will call a specific hook
$> whip hook elogind.elogind_postrm

Documentation

Overview

Copyright (C) 2021 Daniele Rondina <geaaru@sabayonlinux.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL