Miscellaneous > Programming & Networking

Self-extracting archive

<< < (2/5) > >>

H_TeXMeX_H:
Well I wrote a script that makes self-extracting and removing packages (I've tried to make it as safe as possible so it only deletes stuff you actually installed with the packaging system and only in /usr/local) I also added an extract feature so you can extract the archive inside to anywhere you want.


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

if [ -a /tmp/Sirx ]; then
 rm -rf /tmp/Sirx
fi

mkdir /tmp/Sirx
mkdir /tmp/Sirx/local

echo "Build package from [s]ource or from [b]inary? "
read pack

if [ "$pack" == "s" ]; then
 mkdir /tmp/Sirx/source
 echo "Path to folder containing configure and/or Makefile? "
 read inputsource
 cd "$inputsource"
 cp -r * /tmp/Sirx/source
 cd /tmp/Sirx/source
 if [ -a configure ]; then
  if ./configure --prefix=/usr/local ; then
   echo "configure complete"
  else
   echo "!configure failed!"
   read dummy
   exit 1
  fi
 fi
 if make ; then
  echo "make complete"
 else
  echo "!make failed!"
  read dummy
  exit 1
 fi
 if make prefix=/tmp/Sirx/local install ; then
  echo "make install complete"
 else
  echo "!make install failed!"
  read dummy
  exit 1
 fi
elif [ "$pack" == "b" ]; then
 echo "Path to folder containing binary? "
 read inputbinary
 cd "$inputbinary"
 cp -r * /tmp/Sirx/local
else
 echo "!Incorrect input!"
 read dummy
 exit 1
fi

cd /tmp/Sirx/local

echo "Name of output package file? "
read outputfilename

tar -czf /tmp/Sirx/"$outputfilename".tar.gz *

find -type f > /tmp/Sirx/remove.txt

cd /tmp/Sirx/
sed 's/\./\/usr\/local/' remove.txt > removefixed.txt

echo "#!/bin/sh" > header.sh
echo SKIP=\`awk \'\/\^__ARCHIVE_FOLLOWS__\/ { print NR + 1\; exit 0\; }\' \$0\` >> header.sh
echo \echo \""$outputfilename"\" >> header.sh
echo \echo \"Select: \[i\]nstall, \[r\]emove, e\[x\]tract, or any other key to quit\? \" >> header.sh
echo "read switch" >> header.sh
echo \if  \[ \"\$switch\" == \"i\" \]\; \then >> header.sh
echo \echo \"Installing . . .\" >> header.sh
echo \tail +\$SKIP \$0 \| tar xz -C \/usr\/local >> header.sh
echo \echo \"Done\" >> header.sh
echo \elif \[ \"\$switch\" == \"r\" \]\; \then >> header.sh
echo \echo \"Removing . . .\" >> header.sh
while read line
do
 echo rm "$line" >> header.sh
done < removefixed.txt
echo \echo \"Done\" >> header.sh
echo \elif \[ \"\$switch\" == \"x\" \]\; \then >> header.sh
echo \echo \"Extract directory\? \" >> header.sh
echo "read extract" >> header.sh
echo \echo \"Extracting . . .\" >> header.sh
echo \tail +\$SKIP \$0 \| tar xz -C \"\$extract\" >> header.sh
echo \echo \"Done\" >> header.sh
echo "else" >> header.sh
echo "exit 1" >> header.sh
echo "fi" >> header.sh
echo "exit 0" >> header.sh
echo "__ARCHIVE_FOLLOWS__" >> header.sh

cat header.sh "$outputfilename".tar.gz > $HOME/"$outputfilename".sh

cd $HOME
echo "Finished, check your home folder . . . press [Enter] to quit"
read dummy
rm -rf /tmp/Sirx
exit 0

--- End code ---

I also put it up on my site along with the home-made man page for it and further info on how to use it properly.

ReggieMicheals:
What UNIX needs is less irritating makefiles and more windows-like installers/uninstallers with actual binaries if the home market is going to accept UNIX OSes. Its a small step, but it's a step nonetheless...

H_TeXMeX_H:
I like binaries ... but not Window$ installers ... after switching to Linux, I realized how retarded the Window$ installers really are. They all go something like this if I remember correctly:

Double-click the exe file ... it loads after 1-2 min
"Blah, Blah, Blah, Blah, Blah, Blah ... click next" -> you click next
"Do you accept this 200 page EULA ?" Only option: Yes -> you click yes
click next 5 times
"Install to /Program File$ ?" -> yes
click next 5 more times
"Installing" ...
30-45 minutes later ... Done
And you goto the next installer and do it over again !!!

You wonder how efficient this system really is ... not at all efficient. I was really surprised by how easily and quickly RPMS install compared to the Window$ way. With rpm it takes like 2 steps max and installs nearly instantly. I'm never going back to Window$ ... or any of their inefficient bullshit.

If you want Linux installers try Loki ... too bad they went out of business.

Aloone_Jonez:
It depends alot on the installer, I haven't had any trouble with OpenOffice, Opera and Firefox but some of the shareware shitware used to give me that kind of grief.

ReggieMicheals:

--- Quote ---You wonder how efficient this system really is ... not at all efficient. I was really surprised by how easily and quickly RPMS install compared to the Window$ way. With rpm it takes like 2 steps max and installs nearly instantly. I'm never going back to Window$ ... or any of their inefficient bullshit.
--- End quote ---

Yeah, you do have to wonder what moron came up with the idea. What would be better is something along the lines of a self extracting zip file with a self deletion program in the installed directory.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version