Miscellaneous > Programming & Networking

Self-extracting archive

<< < (3/5) > >>

Orethrius:

--- Quote from: ReggieMicheals ---What would be better is something along the lines of a self extracting zip file with a self deletion program in the installed directory.
--- End quote ---


You mean emerge -C? :p

H_TeXMeX_H:
Ok ... here's the last version of the script ... you now have the ability to install and remove a program anywhere not just /usr/local ... as for the suggestion to put an uninstall script in the install directory ... there would be a lot of scripts there after installing lots of stuff. Besides, I keep the installers for everything I install just in case I need to re-install it.


--- 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

echo "Install path? "
read installpath

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="$installpath" ; 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/\.//' 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 '"$installpath" >> 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 "$installpath""$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 ---

piratePenguin:

--- Quote from: 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 !!!
--- End quote ---
Yea, heh. Doing that for like 10+ packages would be hell.

--- Quote ---
If you want Linux installers try Loki ... too bad they went out of business.
--- End quote ---
There's also autopackage and probably some others.

H_TeXMeX_H:
Of course, the other problem is getting people to use your packaging software. So far I've only come across 1 autopackage for 1 program ... in the last year. There are far more RPMS out there than any other packaging system ... as far as I've seen. Too bad it's so hard to make them correctly.

mobrien_12:

--- Quote from: H_TeXMeX_H ---
"Installing" ...
30-45 minutes later ... Done
And you goto the next installer and do it over again !!!

--- End quote ---

You forgot the fact where you have to reboot after running most windows installers.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version