Miscellaneous > Programming & Networking

Self-extracting archive

(1/5) > >>

H_TeXMeX_H:
I was trying to make my own rpms but upon encountering lots of problems and just cuz it was a pain in the ass to do I found that you can actually make your own self-extracting archives ... which is really cool

http://linux.org.mt/article/selfextract

An example ... after compiling and installing the game toppler

./configure
make
make prefix=/home/USERNAME/Stuff/MAKEBIN install

add all the files inside /home/USERNAME/Stuff/MAKEBIN to a tar.gz call it toppler-1.1.2-fc4-i686-bin.tar.gz

write a header script call it toppler-header


--- Code: ---#!/bin/sh

SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`

echo ""
echo "toppler-1.1.2-fc4-i686-bin"
echo "this package is built for Fedora Core 4 on i686 architecture"
echo ""
echo "!!! You must be root to install this package !!!"
echo ""

echo -n "Options: Type i to install, r to remove, or any other key to quit? "
read switch
if  [ "$switch" == "i" ]; then
  echo "Installing ... stand by"
  tail +$SKIP $0 | tar xz -C /usr/local
  echo "Done"
elif [ "$switch" == "r" ]; then
  echo "Removing ... stand by"
  rm /usr/local/bin/toppler
  rm /usr/local/man/man6/toppler.6
  rm /usr/local/share/applications/toppler.desktop
  rm /usr/local/share/doc/toppler/AUTHORS
  rm /usr/local/share/doc/toppler/ChangeLog
  rm /usr/local/share/doc/toppler/COPYING
  rm /usr/local/share/doc/toppler/NEWS
  rm /usr/local/share/doc/toppler/README
  rmdir /usr/local/share/doc/toppler
  rm /usr/local/share/locale/de/LC_MESSAGES/toppler.mo
  rm /usr/local/share/locale/fi/LC_MESSAGES/toppler.mo
  rm /usr/local/share/locale/fr/LC_MESSAGES/toppler.mo
  rm /usr/local/share/locale/pt/LC_MESSAGES/toppler.mo
  rm /usr/local/share/locale/sv/LC_MESSAGES/toppler.mo
  rm /usr/local/share/pixmaps/toppler.xpm
  rm /usr/local/share/toppler/abc.ttm
  rm /usr/local/share/toppler/ball2.ttm
  rm /usr/local/share/toppler/m1.ttm
  rm /usr/local/share/toppler/pasi2.ttm
  rm /usr/local/share/toppler/ball1.ttm
  rm /usr/local/share/toppler/ball3.ttm
  rm /usr/local/share/toppler/m2.ttm
  rm /usr/local/share/toppler/toppler.dat
  rmdir /usr/local/share/toppler
  rm /usr/local/var/toppler/toppler.hsc
  rmdir /usr/local/var/toppler
  echo "Done"
else
  exit 1
fi

exit 0

__ARCHIVE_FOLLOWS__

--- End code ---

(I wrote this myself :D)

and finally ...

cat toppler-header toppler-1.1.2-fc4-i686-bin.tar.gz > toppler-1.1.2-fc4-i686-bin.sh

You might want to note that you can install and remove the package without needing rpm ... that's exactly what I wanted ... anyway I thought it was a cool

And if you wanted to, you could make it input the install location ... /usr/local is the most logical place to put it though

Aloone_Jonez:
This looks great, it's a classic example of how UNIX's superiour scripting capabilities totally blow$ Winblow$ out of the water.

mobrien_12:
I'm pretty good at building RPMS if I can find some SPEC file to start with and update.  Still haven't mastered writing SPEC files from scratch.

H_TeXMeX_H:
Yeah, that's the biggest problem with rpms ... the damn spec files ... and even if you do know how to make them, they gotta be done right or there will be problems

Aloone_Jonez:
Packages suck shit in general, if I made some softwere (and I do have a little project in progress) I'd release the binary in a simple archive so all you do is make a directory and extract it, if it was large and needed to alter the desktop I'd write a script like this one.

Navigation

[0] Message Index

[#] Next page

Go to full version