diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/README | 2 | ||||
-rwxr-xr-x | utils/add-gpl | 33 | ||||
-rwxr-xr-x | utils/add-slack-required | 63 | ||||
-rwxr-xr-x | utils/build | 54 | ||||
-rwxr-xr-x | utils/convert-template-scheme | 35 | ||||
-rwxr-xr-x | utils/enable-mkbuild-section | 44 | ||||
-rwxr-xr-x | utils/merge-template | 37 | ||||
-rwxr-xr-x | utils/metapkg | 72 | ||||
-rwxr-xr-x | utils/repos | 87 | ||||
-rwxr-xr-x | utils/searchpkg | 36 | ||||
-rwxr-xr-x | utils/slackbuild-versions | 30 |
11 files changed, 493 insertions, 0 deletions
diff --git a/utils/README b/utils/README new file mode 100644 index 0000000..ac139ad --- /dev/null +++ b/utils/README @@ -0,0 +1,2 @@ +The scripts in this folder are just snippets used during the development or +code not maintained anymore. They're not included in the simplepkg package. diff --git a/utils/add-gpl b/utils/add-gpl new file mode 100755 index 0000000..0a261e2 --- /dev/null +++ b/utils/add-gpl @@ -0,0 +1,33 @@ +#!/bin/bash +# +# add-gpl 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 any later version. +# +# add-gpl 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# This script should be used to add a license in scripts. +# + +script="SlackBuild" +#script="build" + +for file in `find -name "*.$script"`; do + + echo Changing $file... + package="`basename $file .$script`" + slackbuild="`basename $file`" + + string="\#\!\/bin\/bash\n\#\n# $slackbuild is free software; you can redistribute it and\/or modify it under the\n# terms of the GNU General Public License as published by the Free Software\n# Foundation; either version 2 of the License, or any later version.\n#\n# $slackbuild is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along with\n# this program; if not, write to the Free Software Foundation, Inc., 59 Temple\n# Place - Suite 330, Boston, MA 02111-1307, USA" + + sed -e "s/\#\!\/bin\/bash/$string/" $file > $file.new + cat $file.new > $file + rm $file.new + +done diff --git a/utils/add-slack-required b/utils/add-slack-required new file mode 100755 index 0000000..c1e25ca --- /dev/null +++ b/utils/add-slack-required @@ -0,0 +1,63 @@ +#!/bin/bash +# +# add-slack-required 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 any later version. +# +# add-slack-required 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# add slack-required files in an existing repository +# by rhatto at riseup.net +# + +COMMON="/usr/libexec/simplepkg/common.sh" +BASENAME="`basename $0`" + +if [ -z "$2" ]; then + echo "usage: $BASENAME /path/to/slackbuilds /path/to/packages" + exit 1 +elif [ ! -d "$1" ]; then + echo "$BASENAME: folder not found: $1" + exit 1 +elif [ ! -d "$2" ]; then + echo "$BASENAME: folder not found: $2" + exit 1 +fi + +slackbuild="$1" +repository="$2" + +# we need the function package_name +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + exit 1 +fi + +function search_and_copy_slackbuild { + + if [ -f "$1" ]; then + echo Copying `basename $1` to `dirname $package`/$pack.slack-required + cp $1 `dirname $package`/$pack.slack-required + svn add `dirname $package`/$pack.slack-required 2> /dev/null + fi + +} + +for package in `find $repository/ $(pkg_ext_find)`; do + pack="`package_name $package`" + for build_script in `find $slackbuild/ -name $pack.SlackBuild`; do + + search_and_copy_slackbuild `dirname $build_script`/slack-required + search_and_copy_slackbuild `dirname $build_script`/$pack.slack-required + + done +done + diff --git a/utils/build b/utils/build new file mode 100755 index 0000000..748ca3d --- /dev/null +++ b/utils/build @@ -0,0 +1,54 @@ +#!/bin/bash +# +# build 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 any later version. +# +# build 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# + +BASENAME="`basename $0`" +COMMON="/usr/libexec/simplepkg/common.sh" + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + exit 1 +fi + +ARCH="`default_arch`" +LIBDIR="/usr/lib" +if [ "$ARCH" = "x86_64" ]; then + FPIC="export CFLAGS=-fPIC" + LDFLAGS='export LDFLAGS="-L/lib64 -L/usr/lib64"' + LIBDIR="/usr/lib64" +fi + +CONF="./configure --prefix=/usr --sysconfdir=/etc --libdir=$LIBDIR" +INSTALL="make DESTDIR=`pwd`/installation/ install" +HELP="./configure --help | less" +MAKE="make" + +case $1 in + "--conf") $CONF ;; + "--fpic") $FPIC ;; + "--ld") $LDFLAGS ;; + "--make") $MAKE ;; + "--install") $INSTALL ;; + "--help") $HELP ;; + "--show") + echo $FPIC + echo $LDFLAGS + echo $CONF + echo $INSTALL + ;; + *) $CONF ; $MAKE ;; +esac + diff --git a/utils/convert-template-scheme b/utils/convert-template-scheme new file mode 100755 index 0000000..de7e507 --- /dev/null +++ b/utils/convert-template-scheme @@ -0,0 +1,35 @@ +#!/bin/bash +# +# This software 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 any later version. +# +# This software 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# script for converting simplepkg templates +# to the 0.5 own-folder format +# + +cwd="/etc/simplepkg" +cd $cwd + +for file in `ls *.template`; do + cd $cwd + template="`echo $file | cut -d . -f 1`" + mkdir templates/$template + mv $template.d templates/$template/ + mv $template.s templates/$templates/ + mv $template.template templates/$template/ + cd templates/$template/$template.s + # optional step + # if [ "$template" != "vserver" ]; then + # ln -sf ../../../defaults/templatesvserver/vserver.s/vserver.sh + # fi +done + diff --git a/utils/enable-mkbuild-section b/utils/enable-mkbuild-section new file mode 100755 index 0000000..17efd77 --- /dev/null +++ b/utils/enable-mkbuild-section @@ -0,0 +1,44 @@ +#!/bin/bash +# +# add-slack-required 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 any later version. +# +# add-slack-required 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# enable a given mkbuild section +# by rhatto at riseup.net +# + +CWD="`pwd`" +BASE="/data/projetos/code/mkbuilds" +MATCH=": manifest_check" # example parameter +ADD_BEFORE=": untar_source" # example section +INCLUDE=" on: manifest_check" # example section + +cd $BASE +FILES="` grep -l -R -L -e "$MATCH" * | grep -v .svn`" # match criteria +#FILES="`grep -R "$MATCH" * | grep -v .svn | grep -v '""' | cut -d : -f 1 | uniq`" # unmatch criteria + +for file in $FILES; do + if [ "`basename $file .mkbuild`" != "`basename $file`" ]; then + echo processing $file + LINES="`wc -l $file | awk '{ print $1 }'`" + CENTER="`sed = $file | sed 'N;s/\n/\t/' | grep "$ADD_BEFORE" | awk '{ print $1 }'`" + CENTER="`echo $(($CENTER -1))`" + END="`echo $(($LINES - $CENTER))`" + head -n $CENTER $file > $file.new + echo "$INCLUDE" >> $file.new + tail -n $END $file >> $file.new + cat $file.new > $file + rm $file.new + fi +done + +cd $CWD diff --git a/utils/merge-template b/utils/merge-template new file mode 100755 index 0000000..cee1790 --- /dev/null +++ b/utils/merge-template @@ -0,0 +1,37 @@ +#!/bin/bash +# +# This software 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 any later version. +# +# This software 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# tip: to assemble a template from all slack tagfiles: +# +# for diskset in a ap d e f k l n t tcl x xap y; do +# lynx -dump http://url/to/slackware/$diskset/tagfile >> slack.template +# done +# + +if [ -z "$2" ]; then + echo "usage: `basename $0` <template> <base-template>" + exit 1 +elif [ ! -f "$1" ] || [ ! -f "$2" ]; then + echo error: $1 ou $2 not found + exit 1 +fi + +cp $2 $1.new + +cat $1 | while read line; do + pack="`echo $line | cut -d : -f 1`" + if ! grep -qe "^$pack:" $2; then + echo $line >> $1.new + fi +done diff --git a/utils/metapkg b/utils/metapkg new file mode 100755 index 0000000..e3db602 --- /dev/null +++ b/utils/metapkg @@ -0,0 +1,72 @@ +#!/bin/bash +# +# metapkg v0.1: install or remove a pkgtool metapackage +# +# feedback: rhatto at riseup.net | GPL +# +# Metapkg 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 any later version. +# +# Metapkg 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# A metapackage is a file containing a list of packages. +# This script just installs all the packages in a metapackage. +# Remeber that mkjail template == metapkg metapackage. +# + +# +# TODO +# +# In the mean term, metapkg will not be developed, but the code will rest +# until someone need it. Some ideas to think for the future of metapkg would +# be a better integration with simplepkg structure, like: +# +# - By default metapkg searches by a slack-required in the package/slackbuilds repos +# - With -f, metapkg uses a local file (template, slack-required or tagfile) +# + +COMMON="/usr/libexec/simplepkg/common.sh" +BASENAME="`basename $0`" +ROOT="/" + +function usage { + echo "usage: [ROOT=/otherroot] $BASENAME --option [metapackage]" + echo "options: --install, --remove" + exit 1 +} + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your `basename $0` installation" + exit 1 +fi + +if [ -z "$2" ]; then + usage +else + eval_config $BASENAME -u +fi + +if [ ! -f "$BASE_CONF/$2.template" ]; then + echo error: template $2 not found + exit 1 +else + TEMPLATE="$BASE_CONF/$2.template" + unset server +fi + +if [ "$1" == "--install" ] || [ "$1" == "install" ]; then + install_packages +elif [ "$1" == "--remove" ] || [ "$1" == "remove" ]; then + remove_packages +else + usage +fi diff --git a/utils/repos b/utils/repos new file mode 100755 index 0000000..57ecdff --- /dev/null +++ b/utils/repos @@ -0,0 +1,87 @@ +#!/bin/bash +# +# repos script got from +# http://software.jaos.org/BUILD/slapt-get/FAQ.html#slgFAQ17 +# +# 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 +# any later version. +# +# Changes by rhatto at riseup.net to fit http://slack.sarava.org needs +# + +BASENAME="`basename $0`" +REPOS_CONF="/etc/simplepkg/repos.conf" +COMMON="/usr/libexec/simplepkg/common.sh" + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + exit 1 +fi + +function usage { + + echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" + +} + +function do_all { + + for pkg in `find . -type f $(pkg_ext_find) -print`; do + gen_meta $pkg + done + $0 PACKAGESTXT + $0 FILELIST + $0 MD5 + +} + +# --------------------------------- +# main +# --------------------------------- + +case "$1" in + pkg) + if [ -n "$2" ]; then + gen_meta $2 + else + usage + fi + ;; + all) + do_all + ;; + new) + for pkg in `find . -type f $(pkg_ext_find) -print`; do + if [ ! -f $(strip_pkg_ext $pkg).meta ]; then + gen_meta $pkg + fi + done + ;; + svnmeta) + svn_add_meta + ;; + PACKAGESTXT) + gen_packages_txt . + gen_packages_txt patches + ;; + FILELIST) + gen_filelist + gen_patches_filelist patches + ;; + MD5) + gen_md5_checksums . + gen_md5_checksums patches + ;; + usage) + usage + ;; + *) + do_all + svn_add_meta + ;; +esac + diff --git a/utils/searchpkg b/utils/searchpkg new file mode 100755 index 0000000..1986e00 --- /dev/null +++ b/utils/searchpkg @@ -0,0 +1,36 @@ +#!/bin/bash +# +# This software 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 any later version. +# +# This software 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, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# searchpkg: search packages inside a local slackware-like repository +# this is part of simplepkg +# feedback: rhatto at riseup.net | gpl +# + +# find . -type f -exec ls -l {} \; > FILELIST.TXT + +if [[ $# != 1 && $# != 2 ]]; then + echo "usage: $0 [-1] <repository> [package-name]" + echo "package-name can be either the full package file name, just its prefix or so" + echo "option -1 show just the first matching package" + exit 1 +fi + +FILELIST="$1/FILELIST.TXT" +PACKAGE_FIELD="8" + +if [ -z "$2" ]; then + grep -E -e "$(pkg_ext_grep)" $FILELIST +else + grep -e "$2" $FILELIST | grep -E -e "$(pkg_ext_grep)" | awk "{ print \$$PACKAGE_FIELD }" +fi diff --git a/utils/slackbuild-versions b/utils/slackbuild-versions new file mode 100755 index 0000000..1d7bc92 --- /dev/null +++ b/utils/slackbuild-versions @@ -0,0 +1,30 @@ +#!/bin/bash +# (ir)responsavel: rafael (at) riseup (dot) net + +echo "<html>" +echo "<head>" +echo "<title>" +echo "Versões dos SlackBuilds" +echo "</title>" +echo "</head>" +echo "<body>" +echo "<br><br>" +echo "Atenção:<br><br>" +echo "Quando o software possui algum número de versão, isso " +echo "significa que essa versão é a versão hardcoded " +echo "do SlackBuild. Vamos mantê-las atualizadas ;) " +echo "<br><br>" + +rm .versions.temp + +for i in $(createpkg -l| grep SlackBuild| cut -d " " -f 7- | cut -d . -f 1); do echo $i >> .versions.temp; done + +for i in $(sort .versions.temp); do echo $i; echo "<br>"; for u in $(createpkg --search $i); do grep "VERSION=" $u; echo "<br><br>"; done; done + +rm .versions.temp + +echo "<br><br>SlackBuilds feitos pelo Projeto <a href=\"http://slack.sarava.org/\">slack.sarava.org</a><br>" +echo "</body>" +echo "</html>" + + |