aboutsummaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-07-31 20:54:39 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-07-31 20:54:39 +0000
commit546354758b9a532912651b047fab6a23f0cb0a3c (patch)
treec4108b4022d6e77cd4a1d02c78860b884178efa0 /old
downloadsimplepkg-546354758b9a532912651b047fab6a23f0cb0a3c.tar.gz
simplepkg-546354758b9a532912651b047fab6a23f0cb0a3c.tar.bz2
initial import
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@1 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'old')
-rwxr-xr-xold/lspkg.old31
-rwxr-xr-xold/merge-template.sh27
-rwxr-xr-xold/mkjail.old76
-rwxr-xr-xold/searchpkg24
-rwxr-xr-xold/templatepkg.old64
-rw-r--r--old/teste132
6 files changed, 354 insertions, 0 deletions
diff --git a/old/lspkg.old b/old/lspkg.old
new file mode 100755
index 0000000..fe28a65
--- /dev/null
+++ b/old/lspkg.old
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# lspkg
+# feedback: rhatto at riseup.net | gpl
+#
+# todo:
+#
+# -r, --remove: remove matching packages
+# -d, --description: show matching packages' descriptions
+# -s, --search: search a file under the matching packages
+# -p, --print: print the contents of a package file
+#
+
+function usage {
+ echo usage: $0 [-v|-d|-s|-p expression]
+ exit 1
+}
+
+if [[ "$1" == "-v" ]]; then
+ if [[ ! -z "$2" ]]; then
+ less $(ls /var/log/packages/$2*)
+ else
+ usage
+ fi
+elif [[ $1 = -p ]]; then
+ if [ -f $2 ]; then
+ tar ztvf $2
+ fi
+else
+ ls /var/log/packages/$1*
+fi
diff --git a/old/merge-template.sh b/old/merge-template.sh
new file mode 100755
index 0000000..b3eaf5c
--- /dev/null
+++ b/old/merge-template.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+
+#
+# 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://slack.sarava.org/slackware/slackware-10.2/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/old/mkjail.old b/old/mkjail.old
new file mode 100755
index 0000000..b6caac5
--- /dev/null
+++ b/old/mkjail.old
@@ -0,0 +1,76 @@
+#!/bin/bash
+#
+# mkjail v0.4: chroot jail maker
+# feedback: rhatto at riseup.net | GPL
+#
+
+BASE_CONF=/etc/mkjail
+CONF=$BASE_CONF/mkjail.conf
+
+# under the config file, adjust this to where your things live
+# PACKAGES="/storage/vserver/slack/"
+# DEVICES="/storage/vserver/devices.tar.gz"
+# SCRIPTS="/storage/vserver/etc/"
+# GPGKEY="/storage/vserver/slack/GPG-KEY"
+# SKEL="/storage/vserver/skel.conf"
+
+if [ -f "$CONF" ]; then
+ source $CONF
+else
+ echo $0 error: config file $CONFIG not found
+ exit 1
+elif (($# != 1)); then
+ echo "usage: $0 <jail-name> [template]"
+ exit 1
+elif [ -d "/vservers/$1" ]; then
+ echo $0 error: vserver $1 already exists
+ exit 1
+fi
+
+if [[ ! -z "$2" && -f "$BASE_CONF/$2.template"]]; then
+ TEMPLATE="$BASE_CONF/$2.template"
+elif [ -f "$BASE_CONF/default.template" ]
+ echo template $2 not found, using default template
+else
+ echo $0 error: no templates found
+ echo please create a template using templatepkg
+ exit 1
+fi
+
+server=$1
+mkdir /vservers/$server
+
+echo "instaling packages..."
+
+for pack in `cat $TEMPLATE`; do
+ installpkg --root /vservers/$server `searchpkg -1 $pack`
+done
+
+echo "creating /etc/ and copying init scripts"
+
+if [ -d "$BASE_CONF/$template" ]; then
+ rsync -Cav $BASE_CONF/$template/ /vservers/$server/
+fi
+
+cp /etc/resolv.conf /vservers/$server/etc/
+cp /etc/localtime /vservers/$server/etc/
+echo /dev/hdv1 / ext2 defaults 1 1 > /vservers/$server/etc/fstab
+echo /dev/hdv1 / ext2 rw 0 0 > /vservers/$server/etc/mtab
+
+echo "creating devices and dependencies"
+cd /vservers/$server/
+tar zxvf $DEVICES
+chroot /vservers/$server/ sbin/ldconfig
+
+echo "creating /etc/vservers/$server.conf"
+cp $SKEL /etc/vservers/$server.conf
+
+echo "importing slack gpg pubkey"
+mkdir /vservers/$server/root/.gnupg
+gpg --homedir /vservers/$server/root/.gnupg --import $GPGKEY
+
+# todo: add rebootmgr
+echo "done; now edit /etc/vservers/$server.conf"
+echo "then, set iptables rules and start $server vserver"
+echo "dont forget to change root's password"
+
diff --git a/old/searchpkg b/old/searchpkg
new file mode 100755
index 0000000..5f272a3
--- /dev/null
+++ b/old/searchpkg
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# 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 .tgz $FILELIST
+else
+ grep -e "$2" $FILELIST | grep tgz | awk "{ print \$$PACKAGE_FIELD }"
+fi
diff --git a/old/templatepkg.old b/old/templatepkg.old
new file mode 100755
index 0000000..51a4fc2
--- /dev/null
+++ b/old/templatepkg.old
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# templatepkg: create a simplepkg package list from
+# a legacy slackware /var/log/packages
+#
+
+# pkgtool stuff
+package_name() {
+ STRING=`basename $1 .tgz`
+ # Check for old style package name with one segment:
+ if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then
+ echo $STRING
+ else # has more than one dash delimited segment
+ # Count number of segments:
+ INDEX=1
+ while [ ! "`echo $STRING | cut -f $INDEX -d -`" = "" ]; do
+ INDEX=`expr $INDEX + 1`
+ done
+ INDEX=`expr $INDEX - 1` # don't include the null value
+ # If we don't have four segments, return the old-style (or out of spec) package name:
+ if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then
+ echo $STRING
+ else # we have four or more segments, so we'll consider this a new-style name:
+ NAME=`expr $INDEX - 3`
+ NAME="`echo $STRING | cut -f 1-$NAME -d -`"
+ echo $NAME
+ fi
+ fi
+}
+
+if [[ ! -z "$3" && "$1" == "-o" ]]; then
+ ROOT="$2"
+ TEMPLATE="$3"
+ OPTION="o"
+elif [[ ! -z "$2" && "$1" == "-o" ]]; then
+ ROOT="/"
+ TEMPLATE=$2
+ OPTION="o"
+elif [[ ! -z "$2" && "$1" != "-o" ]]; then
+ ROOT="$1"
+ TEMPLATE="$2"
+elif [ ! -z "$1" ]; then
+ ROOT="/"
+ TEMPLATE="$1"
+else
+ echo "usage: [MASK=mask] $0 [-o root-dir] [-a] <template-file>"
+ echo -e "\troot-dir is the absolute path from with the desired /var/log/packages is placed"
+ echo -e "\toptionaly, use MASK=mask $0 ..., eg: MASK=gcc* $0 ..."
+ exit 1
+fi
+
+if [ ! -d "$ROOT/var/log/packages" ]; then
+ echo $ROOT/var/log/packages: directory not found
+ exit 1
+elif [[ -f "$TEMPLATE" && "$OPTION" != "o" ]]; then
+ echo template $TEMPLATE already exists: use -o to overwrite
+ exit 1
+elif [[ -f "$TEMPLATE" && "$OPTION" == "o" ]]; then
+ rm -f $TEMPLATE
+fi
+
+for package in `ls -1 $ROOT/var/log/packages/$MASK`; do
+ package_name $package >> $TEMPLATE
+done
diff --git a/old/teste b/old/teste
new file mode 100644
index 0000000..6f9c64e
--- /dev/null
+++ b/old/teste
@@ -0,0 +1,132 @@
+Eterm
+anacron
+antiword
+ardour
+audacity
+azureus
+bitlbee
+bogofilter
+bootsplash
+cadaver
+camp
+checkinstall
+cinelerra
+cpan2tgz
+cryptsetup-luks
+darkice
+darksnow
+dopewars
+dvbackup
+dvgrab
+e_modules
+eclair
+ecore
+edb
+edje
+eel
+eet
+elicit
+elinks
+emacs
+embryo
+emotion
+enlightenment
+entice
+entrance
+eog
+epeg
+epsilon
+esmart
+etox
+evas
+ewl
+extralite
+ffmpeg
+fglrx64_6_8_0
+firefox
+gconf
+gdm
+gftp
+ghex
+gnome-icon-theme
+gnome-keyring
+gnome-mime-data
+gnome-vfs
+gnumeric
+gnupg
+gnutls
+gphoto2
+gqview
+grip
+grub
+gtk-gnutella
+gtkam
+hicolor-icon-theme
+homecrypt
+hydrogen
+iconbar
+jack
+jackmix
+jgal
+jre
+kernel-ratten
+kino
+ladspa_sdk
+latex2html-2002-2
+libart_lgpl
+libavc1394
+libbonobo
+libbonoboui
+libdrm
+libdv
+libexif-gtk
+libgnome
+libgnomecanvas
+libgnomeprint
+libgnomeprintui
+libgnomeui
+libgphoto2
+libgsasl
+libgsf
+libidl
+libjackasyn
+liblrdf
+libraw1394
+librsvg
+libsidplay
+libsndfile
+libstdc++5
+libtheora
+lm_sensors
+mairix
+mondo
+mp3blaster
+mplayer
+msmtp
+mutt
+netpbm
+nicotine
+offlineimap
+orbit2
+puredata-0.39
+pygtk
+python
+qemu
+qiv
+qjackctl
+raptor
+realtime-lsm
+rhattofonts
+rhattoscripts
+scons
+shfs
+sqlite
+stellarium
+tcd
+torsmo
+turboprint
+unrtf
+urlview
+vte
+wxGTK
+xmms_jack