View Full Version : HOWTO: post to usenet with Ubuntu
Martje_001
February 9th, 2008, 06:33 AM
Hi,
Because it's a bit hard to post (binary files) to Usenet with Linux, I decided to make this tutorial.
Note: All commands, which you have to run in a terminal, are in code tags.
1. First install a few programs
sudo apt-get install par2 newspost rar
2. Place the files you want to upload in a folder.
3. Most files on Usenet are in rar-files. You can create these rar-files with this command:
rar a "name of rar file" -v10m -m0 "/home/example/upload/"*
Let me explain the command:
name of rar file: This is the name of the rar-file. ".rar" will automatic be added.
-v10m: Split the file(s) to a new rar-archive after 10 MB
-m0: Set compression level (0-store...3-default...5-best).
"/home/example/upload/"*: This means; rar everything in the folder '/home/example/upload'
4. Now we can create par files.
par2create -r10 -n7 "name of par file" /home/example/upload/*.rar*
-r10: Percent par-files you want to create
-n7: Number of par-files you want to create
"name of par file": I don't want to explain this ;)
/home/example/upload/*.rar*: means; Create par-files of everything in the folder /home/eample/upload, which ends with .rar
5. Upload your files
newspost -i upload.eweka.nl -u USERNAME -p PASSWORD -f noadress@gmail.com -n alt.binaries.boneless -y -s "SUBJECT" "/home/example/upload/*.part*" "/home/example/upload/*.par*"
Extra notes:
This is it. You can run commands after each one is done (with &&). Then it will be something like:
rar a "name of rar file" -v10m -m0 "/home/example/upload/"* && par2create -r10 -n7 "name of par file" /home/example/upload/*.rar* && newspost -i upload.eweka.nl -u USERNAME -p PASSWORD -f noadress@gmail.com -n alt.binaries.boneless -y -s "SUBJECT" "/home/example/upload/*.part*" "/home/example/upload/*.par*"
marxian
May 6th, 2008, 10:49 AM
I would very much like to use this, but newspost is not in the repositories of Hardy. Can I still use this program?
Martje_001
May 6th, 2008, 01:13 PM
Of course :)
i386:
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/n/newspost/newspost_2.1.1-4_i386.deb
sudo dpkg -i newspost_2.1.1-4_i386.deb
amd64:
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/n/newspost/newspost_2.1.1-4_amd64.deb
sudo dpkg -i newspost_2.1.1-4_amd64.deb
rabside
May 23rd, 2008, 01:40 PM
greate guide!
Only a question: why do you split file in rar of 10MB? isn't usefull bigger blocks? maybe 40MB?
Martje_001
May 23rd, 2008, 01:48 PM
Thank you! And, yes, it is, but this is only an example.
rabside
May 25th, 2008, 08:36 AM
Hi guys,
this is a little script to automate the upload:
#!/bin/bash
#---------- config start----------
username="username"
password="password"
server="newsserver"
temppath="path of temp dir used to post material es: /media/dati/"
newsgroup="newsgroup, es: alt.binaries.multimedia.divx.italian"
poster="poster name, es: poster"
email="email address, es: poster@gmail.com"
#---------- config end----------
error="false"
filename="$(basename $1)"
subject="${filename%.*}"
function checkLastCommand {
if [ "$1" != "0" ]; then
error="true"
fi
}
#rar split of file
rar a "$temppath$filename" -v40m -m0 $1
#checkresult
checkLastCommand "$?"
#create par
if [ "$error" != "true" ]; then
par2create -r10 -n7 "$temppath$filename" "$temppath"*.rar*
fi
#checkresult
checkLastCommand "$?"
#post
if [ "$error" != "true" ]; then
newspost -i "$server" -u "$username" -p "$password" -f "$email" -n "$newsgroup" -y -s "$subject" "$temppath"*
fi
#checkresult
checkLastCommand "$?"
#delete tmpfile
if [ "$error" != "true" ]; then
rm "$temppath"*
fi
I hope this help ;)
Martje_001
May 25th, 2008, 08:40 AM
I'm working on this myself, see this:
http://www.xs4all.nl/~mgj1/bnewspost.htm
hq197
August 29th, 2008, 08:00 AM
Martje!! Thank you for you guide. It's very helpful. Rabside, how do i use your script? I get a Cannot create path of temp dir used to post material es: /media/dati/.rar
No such file or directorybasename: missing operand
Try `basename --help' for more information. in konsole when i run the script. Basename --help didn't help me at all. I have no idea how to adjust the script (if it indeed needs that).
hq197
August 29th, 2008, 08:02 AM
Thanks for the script but can you help me out of my error message http://ubuntuforums.org/showpost.php?p=5686659&postcount=8
rabside
August 29th, 2008, 08:08 AM
You have to change the value of variable temppath. Choose what you want.
Crafty Kisses
August 29th, 2008, 05:08 PM
Nice tutorial, very nicely typed and very smooth. :)
Stan*
October 6th, 2008, 02:58 AM
I can't upload all the rar-files in a directory. When I type "~/Desktop/up/*.rar" I get an error: "WARNING: No such file or directory". What can I do to solve this?
Thanks.
hq197
October 8th, 2008, 01:44 AM
I can't upload all the rar-files in a directory. When I type "~/Desktop/up/*.rar" I get an error: "WARNING: No such file or directory". What can I do to solve this?
Thanks.
Hi Stan,
Have u checked what directory your terminal is working from? To the left of your cursor and inside square brackets eg. [userisme@localhost Download] in this case, i am inside /home/userisme/Download/. If i passed a location like rar a example /Download/*.avi , i would get the same error message u did (unless there is a location like /home/userisme/Download/Download .
In the end, the best is to operate from inside the actual data directory, so your command starts with the command, rather than a location.
Stan*
October 8th, 2008, 01:03 PM
Thanks for your reply. I found it out already, I had to remove the quotes. Thanks anyway :)
DCJuggler
November 14th, 2008, 06:30 PM
Hi,
Thanks for this, but there is just one problem, is there anyway to open more than 1 thread (aka upload more than 1 file at a time) as i cant max my server out with just a single thread which means it takes it longer to upload...
colemar
September 21st, 2009, 01:11 PM
I bet you can figure out how to install: ksh, rar, par2, newspost.
#!/usr/bin/ksh
# tousenet
#---------- begin config ----------
SERVER=my.news.server.com
PORT=119
USERNAME=colemar
PASSWORD=password
NEWSGROUP=alt.binaries.test
EMAIL=colemarc@gmail.moc
NICKNAME=colemar
WORKBASE=/tmp/tousenet
RARVOLSIZE=50m
PARPERCENT=5
NFOMASK=*.nfo
SAMPLEMASK=*.sample.*
LISTFILESUFFIX=list.nfo
#---------- end config ----------
function errorexit {
print -u2 "ERROR: $1"
exit 1
}
function usage {
print "
tousenet <what> [<where>] [<subject>]
<what> a directory containing the binary files you want posted to usenet.
<where> an optional comma separated list of newsgroup names (maximum 5).
Default is alt.binaries.test.
<subject> an optional string to be used to build the articles subject.
Default is directory name of <what>.
Files contained in <what> (and subdirs) are assembled in a set of rar/par
files located in a work dir under the configured temp directory.
The common <prefix> for rar/par filenames is the directory name of <what>.
This program attempts to recognize whether a given <what> has already been
assembled for posting. To detect this situation, the work dir is named after
a fingerprint made from the first 8 characters of the md5 digest of <what>
contents and a helper listfile is created in the work directory.
"[fingerprint]" is also inserted at the beginning of articles subject; it
can be used later to search and track the post via binsearch.info or
other services.
If *.nfo and/or *.sample.* files exist in <what> directory, they will be
posted as such (besides in rar archive).
To let binsearch.info report these files together with rar/par files, you
should name them with the common prefix: <prefix>.nfo <prefix>.sample.mkv
The first *.nfo file is automatically renamed to <prefix>.nfo in the
work dir and posted as file number 0.
Example: tousenet ~/media/W.La.Foca alt.binaries.movies.divx 'W la foca! (1982) IMDB:tt0084880 avi divx 720x576 italiano-mp3'
"
exit
}
WHAT=$1
[[ $WHAT = "" ]] && usage
WHERE=${2:-$NEWSGROUP}
[[ $WHAT = /* ]] || WHAT=$PWD/$WHAT
[[ -d $WHAT ]] || errorexit "$WHAT should be a directory"
[[ -r $WHAT ]] || errorexit "$WHAT is not readable"
print "Source is $WHAT"
PREFIX=$(basename $WHAT)
[[ $PREFIX = *\ * ]] && errorexit "I don't like blanks in common prefix [$PREFIX]"
LISTFILE=$PREFIX.$LISTFILESUFFIX
SUBJECT="${3:-$PREFIX}"
cd $WHAT
what=$(find . -type f -printf '%P %s %T+\n')
typeset -L8 FINGERPRINT
print -- "$what" | md5sum | read FINGERPRINT junk
print "Fingerprint is $FINGERPRINT"
WORKDIR=$WORKBASE/$FINGERPRINT
print "Work dir is $WORKDIR"
mkdir -p $WORKDIR
cd $WORKDIR
if [[ $(print *) = "*" ]]; then
rar a $PREFIX -r -v$RARVOLSIZE -m0 $WHAT || errorexit "RAR archiver failed"
eval cp $WHAT/$NFOMASK $WHAT/$SAMPLEMASK .
par2 c -r$PARPERCENT $PREFIX * || errorexit "PAR file creation failed"
print -- "$what" > $LISTFILE
else
print "Work dir is not empty"
if [[ -f $LISTFILE ]]; then
print "Post already assembled in the work dir"
read answer?"Do you want to repost it? [Y/n] "
[[ $answer = @(n|N) ]] && errorexit "Aborted"
else
errorexit "The work dir contains something unexpected"
fi
fi
NFO=""
ls *.nfo | fgrep -v $LISTFILE | read infofile
if [[ $infofile > "" ]]; then
[[ -f $PREFIX.nfo ]] || mv $infofile $PREFIX.nfo
NFO="-e $PREFIX.nfo"
fi
newspost -T 3 -y -i $SERVER -z $PORT -u $USERNAME -p $PASSWORD -f $EMAIL -F $NICKNAME -n $WHERE -s "[$FINGERPRINT] $SUBJECT" $NFO *
print "Done. The assembled post is still in work dir $WORKDIR"
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.