\chapter{Upgrading}\index{Upgrade}\label{Ch:Upgrade}


\section{Upgrade from version 2.1.x to 2.1.y}

Same as upgrading from v.2.0.x to v.2.0.y, see Section \ref{20xto20y}.

~

~

\section{Upgrade from version 2.0.x to 2.1.y}

Please follow the upgrade instructions for upgrading from 2.0.x to 2.0.y below. However, once you use cryptographic hashes in your \textit{wendzelnntpd.conf}, your previous passwords will not work anymore, i.e.\ you need to reset all passwords or deactivate the hashing feature.

~

~

\section{Upgrade from version 2.0.x to 2.0.y}\label{20xto20y}

Stop WendzelNNTPd if it is currently running. Install WendzelNNTPd as described but run \textbf{make upgrade} instead of \textbf{make install}. Afterwards, start WendzelNNTPd again.

~

~

\section{Upgrade from version 1.4.x to 2.0.x}

\textbf{Acknowledgement:} I would like to thank Ann from Href.com for helping a lot with finding out how to upgrade from 1.4.x to 2.0.x!

~

An upgrade from version 1.4.x was not foreseen due to the limited available time I have for the development. However, here is a dirty hack:

\paragraph*{Preparation Step:} You \textbf{need to create a backup of your existing installation first}, at least everything from \textbf{/var/spool/news/wendzelnntpd} as you will need all these files later. \textbf{Perform the following steps on your own risk -- it is possible that they do not work on your system as only two WendzelNNTPd installations were tested!}

\paragraph*{First Step:} Install Wendzelnntpd-2.x on a Linux system (Windows is not supported anymore). This requires some libraries and tools.

Under \textit{Ubuntu} they all come as packages:
\begin{verbatim}
$ sudo apt-get install libmysqlclient-dev libsqlite3-dev flex bison sqlite3
\end{verbatim}

Under \textit{CentOS} they come as packages as well:
\begin{verbatim}
$ sudo yum install make gcc bison flex sqlite-devel
\end{verbatim}

\textit{Other} operating systems should provide the same or similar packages/ports.

Run \textbf{MYSQL=NO ./configure}, followed by \textbf{make}, and \textbf{sudo make install}. This will compile, build and install WendzelNNTPd without MySQL support as you only rely on SQLite3 from v.1.4.x (and it would be significantly more difficult to bring the SQLite database content to a MySQL database).

\paragraph*{Second Step:} Please make sure WendzelNNTPd-2 is configured in a way that we can *hopefully* make it work with your own database file. Therefore, in the configuration file \textbf{/usr/local/etc/wendzelnntpd.conf} make sure that WendzelNNTPd uses sqlite3 instead of mysql:

\begin{verbatim}
database-engine sqlite3
\end{verbatim}

\paragraph*{Third Step:}
Now comes the tricky part. The install command should have created
\textbf{/var/spool/news/wendzelnntpd/usenet.db}.
However, it is an empty usenet database file in the new format.
Now REPLACE that file with the file you use on your existing WendzelNNTPd installation, which uses the old 1.4.x format. Also copy all of your old \textbf{cdp*} files and the old \textbf{nextmsgid} file from your Windows system/from your backup directory to \textbf{/var/spool/news/wendzelnntpd/}.

The following step is a very dirty hack but I hope it works for you. It is not 100\% perfect as important table columns are then still of the type 'STRING' instead of the type 'TEXT'!

Load the sqlite3 tool with your replaced database file:

\begin{verbatim}
$ sudo sqlite3 /var/spool/news/wendzelnntpd/usenet.db
\end{verbatim}

This will open the new file in editing mode. We now add the tables which are not part of v.1.4.x to your existing database file. Therefore enter the following commands:

\begin{verbatim}
CREATE TABLE roles (role TEXT PRIMARY KEY);
CREATE TABLE users2roles (username TEXT, role TEXT, PRIMARY KEY(username, role));
CREATE TABLE acl_users (username TEXT, ng TEXT, PRIMARY KEY(username, ng));
CREATE TABLE acl_roles (role TEXT, ng TEXT, PRIMARY KEY(role, ng));
.quit
\end{verbatim}


\paragraph*{Fix Postings}

You will probably see no post bodies right now if posts are requested by your client. Therefore, switch into \textbf{/var/spool/news/wendzelnntpd} and run (as superuser) this command, it will replace the broken trailings with corrected ones:

\begin{verbatim}
$ cd /var/spool/news/wendzelnntpd
$ for filn in `/bin/ls cdp*`; do echo $filn; cat $filn | \
sed 's/\.\r/.\r\n/' > new;  num=`wc -l new| \
awk '{$minone=$1-1; print $minone}'` ; \
head -n $num new > $filn; done
$
\end{verbatim}

\paragraph*{Last Step (Checking whether it works!):}

First check, whether the database file is accepted at all:

\begin{verbatim}
$ sudo wendzelnntpadm listgroups
\end{verbatim}

It should list all your newsgroups

\begin{verbatim}
$ sudo wendzelnntpadm listusers
\end{verbatim}

It should list all existing users. Accordingly

\begin{verbatim}
$ sudo wendzelnntpadm listacl
\end{verbatim}

should list all access control entries (which will be empty right now but if no error message appears, the related tables are now part of your database file!).

~

Now start WendzelNNTPd via \textbf{sudo wendzelnntpd} and try to connect with a NNTP client to your WendzelNNTPd and then try reading posts, sending new posts and replying to these posts.

If this works, you can now run v2.x on 32bit and 64bit Linux :) Congrats, you made it and chances are you are the second user who did that. Let me know via e-mail if it worked for you.
