You are not logged in.

#1 2005-05-18 18:06:58

murkus
Member
From: Europe/Helsinki
Registered: 2004-03-19
Posts: 254

Editing RH-style install script to suit archlinux

Hi folks,

I don't completely grok the differences between RH-style init and the Arch way. So here's my problem. I've got an install script for a daemon that wants to install into /etc/init.d and /etc/rc?.d
How can I change it to work with Arch?

all: help

# Makefile for installation of dyfi-update.pl

# For BSD install: Which install to use and where to put the files
INSTALL = install
PREFIX  = /usr/local
BIN_DIR = $(PREFIX)/bin
ETC_DIR = $(PREFIX)/etc
MAN_DIR = $(PREFIX)/man

clean:
        rm -f *.o *~ *.bak core
distclean: clean

install: installboot installconf installbin

installbin:
        $(INSTALL) -d -o root -g root -m 755 $(BIN_DIR)
        $(INSTALL) -m 755 -o root -g root dyfi-update.pl $(BIN_DIR)
        @echo ""
        @echo "dyfi-update.pl has been installed in $(BIN_DIR)."
        @echo "To install the boot script, figure out your default runlevel"
        @echo "(hint: grep initdefault /etc/inittab)"
        @echo "and run 'make installboot2', 'make installboot5' or whatever"
        @echo "you happen to use. RedHat typically runs at 3 or 5."
        @echo ""

installboot:
        $(INSTALL) -m 755 -o root -g root dyfi-update /etc/init.d

installboot0: installboot
        @if [ ! -e /etc/rc0.d/K01dyfi-update ]; then cd /etc/rc0.d; ln -s ../ini t.d/dyfi-update K01dyfi-update; fi

installboot1: installboot
        @if [ ! -e /etc/rc1.d/K01dyfi-update ]; then cd /etc/rc1.d; ln -s ../ini t.d/dyfi-update K01dyfi-update; fi

installboot2: installboot installboot0 installboot1 installboot6
        @if [ -f /etc/rc2.d/S99dyfi-update ]; then echo "Already configured at r unlevel 2."; exit 1; fi
        cd /etc/rc2.d && ln -s ../init.d/dyfi-update S99dyfi-update

installboot3: installboot installboot0 installboot1 installboot6
        @if [ -f /etc/rc3.d/S99dyfi-update ]; then echo "Already configured at r unlevel 3."; exit 1; fi
        cd /etc/rc3.d && ln -s ../init.d/dyfi-update S99dyfi-update

installboot4: installboot installboot0 installboot1 installboot6
        @if [ -f /etc/rc4.d/S99dyfi-update ]; then echo "Already configured at r unlevel 4."; exit 1; fi
        cd /etc/rc4.d && ln -s ../init.d/dyfi-update S99dyfi-update

installboot5: installboot installboot0 installboot1 installboot6
        @if [ -f /etc/rc5.d/S99dyfi-update ]; then echo "Already configured at r unlevel 5."; exit 1; fi
        cd /etc/rc5.d && ln -s ../init.d/dyfi-update S99dyfi-update

installboot6: installboot
        @if [ ! -e /etc/rc6.d/K01dyfi-update ]; then cd /etc/rc6.d; ln -s ../ini t.d/dyfi-update K01dyfi-update; fi

installconf:
        $(INSTALL) -d -o root -g root -m 755 $(ETC_DIR)
        @if [ -f $(ETC_DIR)/dyfi-update.conf ]; then 
                echo ""; 
                echo "Configuration file already installed. Run 'make forceinsta llconf' to overwrite."; 
                echo ""; 
        else 
                echo "Installing config in $(ETC_DIR)."; 
                echo "Remember to edit dyfi-update.conf afterwards!"; 
                $(INSTALL) -m 644 -o root -g root dyfi-update.conf $(ETC_DIR); 
        fi

forceinstallconf:
        @echo "Overwriting config in $(ETC_DIR)."
        $(INSTALL) -d -o root -g root -m 755 $(ETC_DIR)
        $(INSTALL) -m 644 -o root -g root dyfi-update.conf $(ETC_DIR)

uninstall:
        @echo "Uninstalling dyfi-update..."
        @echo ""
        rm /etc/rc?.d/S99dyfi-update /etc/rc?.d/K01dyfi-update || exit 0
        rm /etc/init.d/dyfi-update || exit 0
        rm $(ETC_DIR)/dyfi-update.conf || exit 0
        rm $(BIN_DIR)/dyfi-update.pl || exit 0

help:
        @echo "This make file only knows how to install or uninstall."

Any help is much appreciated. big_smile


.murkus

Offline

#2 2005-05-18 18:41:05

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Editing RH-style install script to suit archlinux

ok, RH style has the scripts in init.d, rcX.d is a mess of symlinks

so, here's what I'd do:
let the Makefile install the file as normal, then just

rm -rf $startdir/pkg/etc/rc?.d
rm -rf $startdir/pkg/etc/init.d
install -m755 $startdir/src/MY-HANDMADE-INIT-SCRIPT $startdir/pkg/etc/rc.d/something

so, take the sysV init script, copy it in the PKGBUILD dir, add it to the source array, and hand mod it - there's no real way to make a sysV script like that work fine under Arch

Offline

#3 2005-05-18 19:35:17

murkus
Member
From: Europe/Helsinki
Registered: 2004-03-19
Posts: 254

Re: Editing RH-style install script to suit archlinux

Thanks Phrak! :-D


.murkus

Offline

Board footer

Powered by FluxBB