From d4a42ee34928970141b8299c104d47c0f3faecd0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 Nov 2009 00:34:00 -0500 Subject: add copyright notices, and start to autoconfiscate --- pkgthing/.sh | 48 +++++++++++++++++++++++++++ pkgthing/config | 2 ++ pkgthing/find | 58 -------------------------------- pkgthing/init | 48 --------------------------- pkgthing/main.mk.in | 5 +-- pkgthing/pkgthing | 14 -------- pkgthing/pkgthing.mk | 41 ----------------------- pkgthing/search | 19 ----------- pkgthing/src/libexec/find.sh | 75 ++++++++++++++++++++++++++++++++++++++++++ pkgthing/src/libexec/search.sh | 36 ++++++++++++++++++++ pkgthing/src/pkgthing.mk.in | 59 +++++++++++++++++++++++++++++++++ pkgthing/src/pkgthing.sh | 15 +++++++++ 12 files changed, 238 insertions(+), 182 deletions(-) create mode 100644 pkgthing/.sh create mode 100644 pkgthing/config delete mode 100644 pkgthing/find delete mode 100644 pkgthing/init delete mode 100755 pkgthing/pkgthing delete mode 100644 pkgthing/pkgthing.mk delete mode 100644 pkgthing/search create mode 100644 pkgthing/src/libexec/find.sh create mode 100644 pkgthing/src/libexec/search.sh create mode 100644 pkgthing/src/pkgthing.mk.in create mode 100644 pkgthing/src/pkgthing.sh (limited to 'pkgthing') diff --git a/pkgthing/.sh b/pkgthing/.sh new file mode 100644 index 0000000..4f5f784 --- /dev/null +++ b/pkgthing/.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +lst=$1 + +error() { + echo "$0:$@" + exit 1 +} + +useVar() { + var=$1 + val=$2 + case "$var" in + \$name) _name="$val";; + \$union) echo 'union feature not yet implemented';; + esac +} + +setsrc() { + mount_point=$1 + dev=$2 + case "$dev" in + file://*) ln -s "${dev#file://}" "$mount_point";; + ftp://*) ln -s "/$dev" "$mount_point";; + *) error "I don't know which protocol to use for \`$dev'.";; + esac +} + +# parse files +_name='oops' +while read line; do + if [ -n "$line" ]; then + case "$line" in + \#*) :;; # comment, do nothing + \$*) # setting a variable + var=${line%%=*} + val=${line#$var=} + useVar "$var" "$val" + :;; + *) # setting a source + grp=`echo "$line" | cut -f 1` + src=`echo "$line" | cut -f 2` + mkdir -p "$_name" + setsrc "$_name/$grp" "$src" + :;; + esac + fi +done < "$lst" diff --git a/pkgthing/config b/pkgthing/config new file mode 100644 index 0000000..f9d61de --- /dev/null +++ b/pkgthing/config @@ -0,0 +1,2 @@ +_ver=`cat $_srcdir/Version` +vars="$vars ver" diff --git a/pkgthing/find b/pkgthing/find deleted file mode 100644 index 4b33612..0000000 --- a/pkgthing/find +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# option handling -case "$1" in - -v|-q) volume=$1; prog=$2;; - *) prog="$1";; -esac - -# core -error() { - echo "$0:$@" - exit 1 -} - -checkList() { - prog=$1 - src=$2 - file=$3 - sed -n "s/^\($prog\) \.* \(.*\)/\1\t\2/p" "$src/$file" | \ - while read line; do - _prg=`echo "$line" | cut -f 1` - _pkg=`echo "$line" | cut -f 2` - echo "\`$_prg' is in the $src package \`$_pkg'" - if [ "$volume" == '-v' ]; then - pkgthing search "$_pkg" "$src" | sed 's/^\(.\)/ \1/g' - fi - done -} - -useVar() { - var=$1 - val=$2 - case "$var" in - \$name) _name="$val";; - \$union) :;; - \$progs) - checkList "$prog" "$_name" "$val" - :;; - esac -} - -# parse files -for lst in *.lst; do - _name='oops' - while read line; do - if [ -n "$line" ]; then - case "$line" in - \#*) :;; # comment, do nothing - \$*) # setting a variable - var=${line%%=*} - val=${line#$var=} - useVar "$var" "$val" - :;; - *) :;; # setting a source - esac - fi - done < "$lst" -done diff --git a/pkgthing/init b/pkgthing/init deleted file mode 100644 index 4f5f784..0000000 --- a/pkgthing/init +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -lst=$1 - -error() { - echo "$0:$@" - exit 1 -} - -useVar() { - var=$1 - val=$2 - case "$var" in - \$name) _name="$val";; - \$union) echo 'union feature not yet implemented';; - esac -} - -setsrc() { - mount_point=$1 - dev=$2 - case "$dev" in - file://*) ln -s "${dev#file://}" "$mount_point";; - ftp://*) ln -s "/$dev" "$mount_point";; - *) error "I don't know which protocol to use for \`$dev'.";; - esac -} - -# parse files -_name='oops' -while read line; do - if [ -n "$line" ]; then - case "$line" in - \#*) :;; # comment, do nothing - \$*) # setting a variable - var=${line%%=*} - val=${line#$var=} - useVar "$var" "$val" - :;; - *) # setting a source - grp=`echo "$line" | cut -f 1` - src=`echo "$line" | cut -f 2` - mkdir -p "$_name" - setsrc "$_name/$grp" "$src" - :;; - esac - fi -done < "$lst" diff --git a/pkgthing/main.mk.in b/pkgthing/main.mk.in index 7048bbc..f17ab76 100644 --- a/pkgthing/main.mk.in +++ b/pkgthing/main.mk.in @@ -14,10 +14,11 @@ ver = 0.0 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; see the file COPYIN +# along with this program; see the file COPYING. +# If not, see . # general stuffs ##################################################### -all : pget +all : src/libexec/find src/libexec/search src/pkgthing src/pkgthing.mk .SUFFIXES : VPATH = $(srcdir) filelist = \ diff --git a/pkgthing/pkgthing b/pkgthing/pkgthing deleted file mode 100755 index 9439461..0000000 --- a/pkgthing/pkgthing +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -name='pkgthing' -export datadir=/usr/src/local/pkgthing - -srcdir=/usr/src - -case "$1" in - find) shift; bash $datadir/find $@;; - search) shift; bash $datadir/search $@;; - - -v|-V|--version) make -C "$srcdir" version;; - -h|-H|--help) make -C "$srcdir" help;; - *) make -C "$srcdir" $1;; -esac diff --git a/pkgthing/pkgthing.mk b/pkgthing/pkgthing.mk deleted file mode 100644 index 29322b6..0000000 --- a/pkgthing/pkgthing.mk +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/make -f -name = pkgthing -ver = 2.9.0 - -usage = Usage: make [-C /usr/src] TARGET -email = LukeShu@sbcglobal.net - -datadir = /usr/src/local/pkgthing - -.PHONY: shorthelp help version -shorthelp: - # $(name): please specify an action - # $(usage) - # - # Try `make -C /usr/src help' for more options - -help: - # $(name) $(ver), package thing(y) - THing Is Not GNU (yet?) - # $(usage) - # - # ... - # - # Mail bug reports and suggestions to <$(email)> - -version: - # $(name) $(ver) - # - # Copyright (C) 2009 Luke Shumaker, Inc. - # Licence GPLv2+: GNU GPL version 2 or later - # . - # This is free software: you are free to change and redistribute it. - # There is NO WARRANTY, to the extent permitted by law. - # - # Originally written by Luke Shumaker <$(email)> - -#.PHONY: init $(addprefix init-,$(shell echo *.lst)) -init: $(addprefix init-,$(shell echo *.lst)) - -init-%: % - # loading `$<'... - bash $(datadir)/init "$<" diff --git a/pkgthing/search b/pkgthing/search deleted file mode 100644 index a9aade0..0000000 --- a/pkgthing/search +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -pkg=$1 -src=${2-*} - -printname() { - name=$1 - echo -n "$name" - if [ -L "${name%/}" ]; then - echo -n ' -> ' - printname `readlink "${name%/}"` - else - echo '' # or, rather: putchar('\n'); - fi -} - -for i in $src/*/"$pkg/" $src/*/"$pkg.README"; do - if [ -e "$i" ]; then printname "$i"; fi -done diff --git a/pkgthing/src/libexec/find.sh b/pkgthing/src/libexec/find.sh new file mode 100644 index 0000000..82d8f3a --- /dev/null +++ b/pkgthing/src/libexec/find.sh @@ -0,0 +1,75 @@ +#!/bin/bash +#name=pkgthing program finder +#version=??? +# Copyright (C) 2009 Luke Shumaker +# +# 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 2 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; see the file COPYING. +# If not, see . + +# option handling +case "$1" in + -v|-q) volume=$1; prog=$2;; + *) prog="$1";; +esac + +# core +error() { + echo "$0:$@" + exit 1 +} + +checkList() { + prog=$1 + src=$2 + file=$3 + sed -n "s/^\($prog\) \.* \(.*\)/\1\t\2/p" "$src/$file" | \ + while read line; do + _prg=`echo "$line" | cut -f 1` + _pkg=`echo "$line" | cut -f 2` + echo "\`$_prg' is in the $src package \`$_pkg'" + if [ "$volume" == '-v' ]; then + pkgthing search "$_pkg" "$src" | sed 's/^\(.\)/ \1/g' + fi + done +} + +useVar() { + var=$1 + val=$2 + case "$var" in + \$name) _name="$val";; + \$union) :;; + \$progs) + checkList "$prog" "$_name" "$val" + :;; + esac +} + +# parse files +for lst in *.lst; do + _name='oops' + while read line; do + if [ -n "$line" ]; then + case "$line" in + \#*) :;; # comment, do nothing + \$*) # setting a variable + var=${line%%=*} + val=${line#$var=} + useVar "$var" "$val" + :;; + *) :;; # setting a source + esac + fi + done < "$lst" +done diff --git a/pkgthing/src/libexec/search.sh b/pkgthing/src/libexec/search.sh new file mode 100644 index 0000000..7df0541 --- /dev/null +++ b/pkgthing/src/libexec/search.sh @@ -0,0 +1,36 @@ +#!/bin/sh +#name=pkgthing package search +#version=??? +# Copyright (C) 2009 Luke Shumaker +# +# 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 2 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; see the file COPYING. +# If not, see . + +pkg=$1 +src=${2-*} + +printname() { + name=$1 + echo -n "$name" + if [ -L "${name%/}" ]; then + echo -n ' -> ' + printname `readlink "${name%/}"` + else + echo '' # or, rather: putchar('\n'); + fi +} + +for i in $src/*/"$pkg/" $src/*/"$pkg.README"; do + if [ -e "$i" ]; then printname "$i"; fi +done diff --git a/pkgthing/src/pkgthing.mk.in b/pkgthing/src/pkgthing.mk.in new file mode 100644 index 0000000..ae56543 --- /dev/null +++ b/pkgthing/src/pkgthing.mk.in @@ -0,0 +1,59 @@ +#!/usr/bin/make -f +_pkg_name = pkgthing # name of the program, duh +_pkg_ver = @ver@ # version number +# Copyright (C) 2009 Luke Shumaker +# +# 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 2 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; see the file COPYING. +# If not, see . + +#for use in messages +_pkg_usage = Usage: make [-C /usr/src] TARGET +_pkg_email = LukeShu@sbcglobal.net + +_pkg_libexecdir = @libexecdir@/$(_pkg_name) # the location of helper-scripts +_pkg_update = update # the make target to update package lists + +.PHONY: shorthelp help version +shorthelp: + # $(_pkg_name): please specify an action + # $(_pkg_usage) + # + # Try `make -C /usr/src help' for more options + +help: + # $(_pkg_name) $(_pkg_ver), package thing(y) - THing Is Not GNU (Yet?) + # $(_pkg_usage) + # + # ... + # + # Mail bug reports and suggestions to <$(_pkg_email)> + +version: + # $(_pkg_name) $(_pkg_ver) + # + # Copyright (C) 2009 Luke Shumaker, Inc. + # Licence GPLv2+: GNU GPL version 2 or later + # . + # This is free software: you are free to change and redistribute it. + # There is NO WARRANTY, to the extent permitted by law. + # + # Originally written by Luke Shumaker <$(_pkg_email)> + +#.PHONY: $(_pkg_update) $(addprefix $(_pkg_update)-,$(shell echo *.lst)) + $(_pkg_update): $(addprefix $(_pkg_update)-,$(shell echo *.lst)) + +$(_pkg_update)-%: % + # loading `$<'... + bash $(_pkg_libexecdir)/init "$<" + diff --git a/pkgthing/src/pkgthing.sh b/pkgthing/src/pkgthing.sh new file mode 100644 index 0000000..38c5ae5 --- /dev/null +++ b/pkgthing/src/pkgthing.sh @@ -0,0 +1,15 @@ +#!/bin/sh +name='pkgthing' +ver=@ver@ +export libexecdir=@libexecdir@ + +srcdir=/usr/src + +case "$1" in + find) shift; bash $datadir/find $@;; + search) shift; bash $datadir/search $@;; + + -v|-V|--version) make -C "$srcdir" version;; + -h|-H|--help) make -C "$srcdir" help;; + *) make -C "$srcdir" $1;; +esac -- cgit v1.2.3-2-g168b