Ads

distributed.net client RPM Package

This week I decided to dust off my RPM hat and build an RPM for the distributed.net client application.  Firstly to test my setup here and secondly to make the client easier to deploy and remove from my systems.  I have packaged the core DNETC application (v2.9104.510), and added my own DNETC System V init script

I thought I would post the files here, as they maybe of use. 

dnetc-2.9104.510-2.i386.rpm
dnetc.spec
dnetc.init

Distributed.net recommend that you only download and install clients from their site, I have packaged the above and use it on my systems so the choice is yours, but if you wish to build your own RPM, the spec file etc may save you a few mins.

Internet Explorer Script Error, on a cash machine...!

I went to the cash point the other day and look what I found…..  Had to take a photo.

Internet Explorer Script Error, on a cash machine...! 

Annoying Windows Update restart popup

I was working away on my PC today and was getting bugged by the Windows Update restart reminder, having been bitten by its restart in the past I wanted it to leave me alone.

I had stacks of SSH sessions open, web sites and files, it was not the time for a reboot and I didn’t want it to decide to restart when I got up to make a drink.

A quick google search helped me out!  Running this command (from a run prompt or from within a command prompt) will stop the message appearing and allow you to continue working, uninterrupted and reboot when your good and ready.

sc stop wuauserv

Source: Lifehacker

Building RPMs

Here is some advice I found useful when setting up my RPM build environment, and building a basic RPM.  The main source I used, to save reading my book again or the man pages, was Linc Fessenden’s blog and some of Linc’s blog is repeated here for completeness. Thanks Linc!

These instructions should work fine on any CentOS / RHEL / Fedora system.

First off, we need the rpm-build package to be installed. Check and install if needed.
yum install rpm-build

Login to the system as your user account, then make the following directories:


mkdir -p ~/rpm
mkdir -p ~/rpm/BUILD
mkdir -p ~/rpm/RPMS
mkdir -p ~/rpm/SOURCES
mkdir -p ~/rpm/SPECS
mkdir -p ~/rpm/SRPMS
mkdir -p ~/rpm/tmp

And create an ~/.rpmmacros file with the following in it:


%packager Your Name
%_topdir /home/YOUR USERNAME/rpm
%_tmppath /home/YOUR USERNAME/rpm/tmp

Now you need to create a package source code ditectory in the ~/rpm/SOURCES directory. You should name it package name – major revision number. Eg: ~/rpm/SOURCES/robspackage-1. In that directory place all the files that you wish to package in the RPM. I have put “script.sh” in mine.

Once that is done, make a tarball of that directory in the ~/rpm/SOURCES directory named programname-revision.tar.gz. Eg:

cd ~/rpm/SOURCES
tar -czvf rob-1.tar.gz rob-1/

In the ~/rpm/SPECS directory, create a packagename.spec file for your package.
Eg: rob.spec:

Summary: My first rpm package
Name: rob
Version: 1
Release: 1
Source0: rob-1.tar.gz
License: GPL
Group: CustomGroup
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
Relevant package description
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/opt/rob
install -m 0755 script.sh $RPM_BUILD_ROOT/opt/rob/script.sh
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo ” ”
echo “This will display after rpm installs the package!”
%files
%dir /opt/rob
/opt/rob/script.sh
%changelog
* Wed Feb 24 2010 Rob Jervis
- added something or fixed a bug

* Tue Feb 23 2010 Rob Jervis
- First RPM package of the rob application for EL5

Direct Quote from Linc:
“The install lines tell rpm what to install where and with what permissions. You also have to do any directory creation there as well (the one with the -d in the line).”

“The things after %file are similar in that this tells rpm’s database which files are attached to this package. The %dir signifies a new directory, otherwise the files are listed with their complete paths.”

Now you need to create the package, go to ~/rpm and do “rpmbuild -ba SPECS/rob.spec”.
If your package builds ok, it will end up in the RPMS directory, in this case: ~/rpm/RPMS/noarch/rob-1-1.noarch.rpm.

If it fails to build, first check your spec file carefully. Enjoy!

Video Test!

Here is a test video file, best viewed full screen. This will show you how you can check which release of CentOS your running.

Get the Flash Player to see this player.

Server Upgrade

Having just upgraded the server, JERVIS DOT WS will be back soon!

DNETC System V init Script

This week I was looking into init scripts again, its been a while… Anyhow, I remembered that I had written one for distributed.net’s client app.

I thought I would share it, place in “/etc/init.d/dnetc”. It should work fine on current releases of Fedora, RHEL and CentOS. Its designed for the sysadmin to configure dnetc for that system and then manage its start up and shutdown. (Not a script for end users to be using. )

You will need to change the application path to be the directory you have extracted the into.


#!/bin/bash
#
# dnetc This shell script takes care of starting and stopping distributed.net client
#
# chkconfig: 345 90 12
# description: distributed.net client program, a \
# distributed computing project. The program \
# uses only the computers idle time.
# processname: dnetc

# config: /etc/dnetc/dnetc.ini
# pidfile: /var/run/dnetc.pid

# Get function from functions library
. /etc/init.d/functions

start() {
echo -n “Starting DNET client: ”
/custom/dnetc/dnetc -quiet
touch /var/lock/subsys/dnetc
success $”DNET client startup”
echo
}

stop() {
echo -n “Stopping DNET client: ”
killproc dnetc
rm -f /var/lock/subsys/dnetc
echo
}

# —————————————————————–
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status dnetc
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart|reload|status}”
exit 1
esac

exit 0

This script could do with some more work, I did put it together quickly, but this page helped me get it going and its worth looking at if you want to write a System V init script of your own.

Looking forward to Fedora 12!

Fedora 12 release countdown!

Fedora 12 is here!

Wordpress Upgrade 2.7 and 2.7.1

Going back to late last year, I upgraded WordPress to 2.7. It all went will apart from some issues with the TinyMCE visual editor. I read a number of articles including Troubleshooting TinyMCE in WordPress 2.7 and http://wordpress.org/support/topic/224121 with no luck. With no plugins and the default theme, i could not get my editor to run correctly. I decided to put up with it, till i had some more time to investigate.

I found that v2.7.1 has now been released, so I rushed to upgrade. I used the new options in the admin section, “Tools > Upgrade > Automatically Upgrade”. The auto upgrade went briliantly and afterwards my TinyMCE visual editor also started working! Great!

Firefox SSH protocol handler (Linux)

I have a web page that lists servers I need to connect to. This page has several hyper links for each server to key webpages on that host. I wanted to be able to connect using ssh too, at the click of a link. (eg: ssh://myserver.example.com and ssh://user@myserver.example.com)

I started doing a bit of research into this and have been able to set it up!

On Fedora 10:
1. Open Firefox and go to: about:config.
2. Right Click > New > Boolean > Enter the following name “network.protocol-handler.expose.ssh” and then “true”
3. Right Click > New > Boolean > Enter the following name “network.protocol-handler.external.ssh” and then “true”
4. Right Click > New > Boolean > Enter the following name “network.protocol-handler.warn-external.ssh” and then “false”
5. Right Click > New > String > Enter the following name “network.protocol-handler.app.ssh” and then “firefox-ssh.sh”
6. Close Firefox
7. Create a script here (/usr/local/bin/firefox-ssh.sh) with the following in it:

#!/bin/bash
gnome-terminal -e “ssh `echo $1 | sed -e “s/ssh:\/\///”`”
8. Run chmod +x /usr/local/bin/firefox-ssh.sh
9. Open Firefox and go to a link like ssh://myserver.example.com