You are not logged in.

#1 2006-06-13 10:56:49

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Help with sed for Bastille PKGBUILD?

Alright, I'm making a PKGBUILD for Bastille and so far it looks like this:

pkgname=bastille
pkgver=3.0.9
pkrel=1
url="http://www.bastille-linux.org"
pkgdesc="An interactive tool for hardening Linux systems"
depends=('bash' 'tk')
source=(http://dl.sourceforge.net/sourceforge/Bastille/Bastille-$pkgver.tar.bz)
md5sums=('39794400983d7198b5027659264fa8f3')

build() {
  cd $startdir/src/Bastille
  ./Install.sh || return 1
}

But obviously that wouldn't work, since Bastille's install script shoves everything straight into the system. Here's the install script from the Bastille package:

#!/bin/sh

umask 077
RPM_BUILD_ROOT=""

mkdir -p $RPM_BUILD_ROOT/usr/sbin
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/Curses
mkdir -p $RPM_BUILD_ROOT/usr/lib/Bastille
mkdir -p $RPM_BUILD_ROOT/usr/share/Bastille
mkdir -p $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
mkdir -p $RPM_BUILD_ROOT/usr/share/Bastille/Questions
mkdir -p $RPM_BUILD_ROOT/usr/share/Bastille/FKL/configs/
mkdir -p $RPM_BUILD_ROOT/var/lock/subsys/bastille
 
cp AutomatedBastille $RPM_BUILD_ROOT/usr/sbin/
cp BastilleBackEnd $RPM_BUILD_ROOT/usr/sbin
cp Bastille_Curses.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl
cp Bastille_Tk.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl
cp Curses/Widgets.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/Curses
cp InteractiveBastille $RPM_BUILD_ROOT/usr/sbin
# Questions.txt has been replaced by Modules.txt and Questions/
#cp Questions.txt $RPM_BUILD_ROOT/usr/share/Bastille
cp Modules.txt $RPM_BUILD_ROOT/usr/share/Bastille
# New Weights file(s).
cp Weights.txt $RPM_BUILD_ROOT/usr/share/Bastille
# Castle graphic
cp bastille.jpg $RPM_BUILD_ROOT/usr/share/Bastille/
# Javascript file
cp wz_tooltip.js $RPM_BUILD_ROOT/usr/share/Bastille/
cp Credits $RPM_BUILD_ROOT/usr/share/Bastille
cp FKL/configs/fkl_config_redhat.cfg $RPM_BUILD_ROOT/usr/share/Bastille/FKL/configs/

cp RevertBastille $RPM_BUILD_ROOT/usr/sbin
ln -s $RPM_BUILD_ROOT/usr/sbin/RevertBastille $RPM_BUILD_ROOT/usr/sbin/UndoBastille
cp bin/bastille $RPM_BUILD_ROOT/usr/sbin
chmod +x $RPM_BUILD_ROOT/usr/sbin/RevertBastille
cp bastille-firewall $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-firewall-reset $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-firewall-schedule $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-tmpdir-defense.sh $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-tmpdir.csh $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-tmpdir.sh $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-firewall.cfg $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-ipchains $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-netfilter $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-firewall-early.sh $RPM_BUILD_ROOT/usr/share/Bastille
cp bastille-firewall-pre-audit.sh $RPM_BUILD_ROOT/usr/share/Bastille
cp complete.xbm $RPM_BUILD_ROOT/usr/share/Bastille
cp incomplete.xbm $RPM_BUILD_ROOT/usr/share/Bastille
cp ifup-local $RPM_BUILD_ROOT/usr/share/Bastille


cp hosts.allow $RPM_BUILD_ROOT/usr/share/Bastille
cp Bastille/AccountSecurity.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Apache.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/API.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/BootSecurity.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/ConfigureMiscPAM.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/DisableUserTools.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/DNS.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/FilePermissions.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/FTP.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Firewall.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/HP_API.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/OSX_API.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/LogAPI.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/HP_UX.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/IOLoader.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Patches.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Logging.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/MiscellaneousDaemons.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/PatchDownload.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Printing.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/PSAD.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/RemoteAccess.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/SecureInetd.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/Sendmail.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/TMPDIR.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_AccountSecurity.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_Apache.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_DNS.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_FTP.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_HP_UX.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_MiscellaneousDaemons.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_SecureInetd.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_Sendmail.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_BootSecurity.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_DisableUserTools.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_FilePermissions.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_Logging.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/test_Printing.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/TestAPI.pm $RPM_BUILD_ROOT/usr/lib/Bastille
cp Bastille/IPFilter.pm $RPM_BUILD_ROOT/usr/lib/Bastille



cp OSMap/LINUX.bastille $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/LINUX.system $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/HP-UX.bastille $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/HP-UX.system $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/HP-UX.service $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/OSX.bastille $RPM_BUILD_ROOT/usr/share/Bastille/OSMap
cp OSMap/OSX.system $RPM_BUILD_ROOT/usr/share/Bastille/OSMap

for file in `cat Modules.txt` ; do
   cp Questions/$file.txt $RPM_BUILD_ROOT/usr/share/Bastille/Questions
done

So, my question is... How would I use sed to change the value for RPM_BUILD_ROOT to whatever $startdir/pkg happened to be?

Offline

#2 2006-06-13 12:03:25

mpie
Member
From: 404 Not found
Registered: 2005-03-06
Posts: 649

Re: Help with sed for Bastille PKGBUILD?

 sed -i -e "s:$RPM_BUILD_ROOT:$startdir/pkg:g" Install.sh 

or you could try passing the variable

$RPM_BULD_ROOT=$startdi4r/pkg ./Install.sh

Offline

#3 2006-06-13 16:50:04

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

Thanks... Don't know why I didn't think of that. :oops:

Edit: alright that doesn't work, I'll just use sed the way you told me...

Offline

#4 2006-06-13 16:58:34

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with sed for Bastille PKGBUILD?

Gullible Jones wrote:

Thanks... Don't know why I didn't think of that. :oops:

Edit: alright that doesn't work, I'll just use sed the way you told me...

Probably because here's a couple of typos in the line. It should be:

RPM_BUILD_ROOT=$startdir/pkg ./Install.sh

Offline

#5 2006-06-13 17:02:33

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

Doesn't work with sed either, the RPM_BUILD_ROOT line is unchanged.

Offline

#6 2006-06-13 17:10:25

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with sed for Bastille PKGBUILD?

this should work:
sed -i "s|""|"$startdir/pkg"|" Install.sh

Offline

#7 2006-06-13 17:27:34

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: Help with sed for Bastille PKGBUILD?

mpie wrote:
 sed -i -e "s:$RPM_BUILD_ROOT:$startdir/pkg:g" Install.sh 

or you could try passing the variable

$RPM_BULD_ROOT=$startdi4r/pkg ./Install.sh

The above sed command is useless, $ is parsed as the end of line so it should be escaped, the install is easy there's many possibilities here's some using just sed

sed -e "s@(RPM_BUILD_ROOT=).*@1${startdir}/pkg@g" -i install.sh
sed -e "s@$RPM_BUILD_ROOT@${startdir}/pkg@g" -i install.sh

Offline

#8 2006-06-13 20:25:05

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

Alright thanks guys... I'll see how those work.

(FWIW, Snowman, I had noticed and corrected for the typos. lol)

Offline

#9 2006-06-13 20:57:37

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with sed for Bastille PKGBUILD?

Gullible Jones wrote:

Alright thanks guys... I'll see how those work.

(FWIW, Snowman, I had noticed and corrected for the typos. lol)

8)

Offline

#10 2006-06-14 06:13:35

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Help with sed for Bastille PKGBUILD?

A few more comments on your PKGBUILD, as it's there:

- it's pkgrel, not pkrel
- there's a lot of perl there, so I think you should add perl to depends
- the source path and extension are incorrect. Try this instead: http://dl.sourceforge.net/sourceforge/b … er.tar.bz2

I was going to add yet another sed command as well, but I think you've enough to work with at the moment. smile

Offline

#11 2006-06-14 09:36:54

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

tomk wrote:

A few more comments on your PKGBUILD, as it's there:

- it's pkgrel, not pkrel

Thanks, corrected.

- there's a lot of perl there, so I think you should add perl to depends

Done, it needs perl-tk and perl-curses and those are now dependencies. Don't know why I hadn't noticed the Perl earlier... :?

- the source path and extension are incorrect. Try this instead: http://dl.sourceforge.net/sourceforge/b … er.tar.bz2

That's what I tried at first, but either the servers are damn slow or the package doesn't exist - you can't download it directly from Sourceforge, thus the Heanet mirror.

I was going to add yet another sed command as well, but I think you've enough to work with at the moment. smile

lol

Offline

#12 2006-06-27 18:33:33

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

Ah crap, my bad... Forgot about this some time when I was trying to get the USB install working. Shouldn't take too long though.

Offline

#13 2006-06-27 18:50:30

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Help with sed for Bastille PKGBUILD?

Here, how's this?

pkgname=bastille
pkgver=3.0.9
pkgrel=1
url="http://bastille-linux.org"
pkgdesc="An interactive tool for hardening Linux systems"
depends=('perl-curses' 'perl-tk')
source=(http://heanet.dl.sourceforge.net/sourceforge/bastille-linux/Bastille-$pkgver.tar.bz2)
md5sums=('39794400983d7198b5027659264fa8f3')

build() {
  cd $startdir/src/Bastille
  sed -e "s@$RPM_BUILD_ROOT@${startdir}/pkg@g" -i Install.sh
  ./Install.sh || return 1
}

Offline

#14 2010-04-06 01:36:09

Burning_aces
Member
Registered: 2009-09-29
Posts: 120

Re: Help with sed for Bastille PKGBUILD?

Gullible Jones wrote:

Here, how's this?

pkgname=bastille
pkgver=3.0.9
pkgrel=1
url="http://bastille-linux.org"
pkgdesc="An interactive tool for hardening Linux systems"
depends=('perl-curses' 'perl-tk')
source=(http://heanet.dl.sourceforge.net/sourceforge/bastille-linux/Bastille-$pkgver.tar.bz2)
md5sums=('39794400983d7198b5027659264fa8f3')

build() {
  cd $startdir/src/Bastille
  sed -e "s@$RPM_BUILD_ROOT@${startdir}/pkg@g" -i Install.sh
  ./Install.sh || return 1
}

does this work?
was just about to post an aur request for this but saw this topic instead
(also the current aur request contains no info hence i was going to post my own)

Offline

#15 2010-04-06 10:12:43

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Help with sed for Bastille PKGBUILD?

This thread is close to four years old - please start a new thread, linking to this one if necessary.

Also, there hasn't been a bastille release since 3.2.1 in September 2008. You may be already aware of this, but I think it's worth mentioning anyway.

Closed.

Offline

Board footer

Powered by FluxBB