Giter VIP home page Giter VIP logo

Comments (3)

HokieGeek avatar HokieGeek commented on August 27, 2024

Format

json

{
    "groups": {
        "group": {
            "id": "0",
            "name": "NAME OF GROUP",
            "enabled": true,
            "installer": "yaourt",
            "packages": ["pkg1", "pkg2", "pkgN"]
        }
    }
}

Yaml

groups:
    group:
        id: 0
        name: NAME OF GROUP
        enabled: true
        installer: yaourt
        packages:
            - pkg1
            - pkg2
            - pkgN

from distro-config.

HokieGeek avatar HokieGeek commented on August 27, 2024

Code

Ultimately, whatever I do will follow the following pseudocode:

file.load("path")
foreach group in file
    if (group.enabled)
        print "Installing: " + group.name
        command(group.installer+" -S --needed "+group.packages)
        recordInstalledGroup(group.id)
    else
        print "Skipping: " + group.name

Python

json

import json
json.load(open('/tmp/config.json'))
# TODO

Yaml

http://pyyaml.org/wiki/PyYAMLDocumentation

import yaml
config = yaml.load(file("path/to/config.yml"))
# TODO

go

json

# TODO

Yaml

# TODO

from distro-config.

HokieGeek avatar HokieGeek commented on August 27, 2024

Ok, the above might be a little over-engineered. So how about this:

Format

  • Each file is a group. The filename is the group's name
  • Each line is in the file is a set of packages to install
  • Files which start with a dash (-) are skipped

Code

#!/bin/bash

if [ $# -le 0 ]; then
    echo "USAGE: `basename $0` directory ..."
    exit 1
fi

here=$(cd `dirname $0`; pwd)
directories="$@"
rootMnt=TODO

for dir in ${directories}; do
    pushd ${dir} >/dev/null 2>&1

    # Install AUR packages
    echo "====> Installing AUR packages"
    for aur-file in `ls -1 *.aur`; do
        for pkg in `cat ${aur-file} | egrep -v '^#'`; do
            echo ":: Installing ${pkg}"
            ${here}/installAUR.sh ${pkg} ${rootMnt}
        done
    done

    # Install all other packages
    echo "====> Installing all packages"
    for file in `ls -1 | grep -v .aur`; do
        if [ "${file:0:1}" == "-" ]; then
            echo ":: Skipping: ${file:1}"
        else
            echo ":: Installing ${file}"
            ${installer} -S --needed `cat ${file} | egrep -v '^#' | xargs` -r ${rootMnt}
        fi
    end

    popd >/dev/null 2>&1
end

from distro-config.

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.