DragonFly BSD
DragonFly kernel List (threaded) for 2005-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[no subject]


From: "Ruslan Zaripov" <gryzor@xxxxxxx>
Date: Mon, 05 Sep 2005 21:02:08 +0400

On Mon, 05 Sep 2005 19:23:00 +0400,
Simon 'corecode' Schubert <corecode@xxxxxxxxxxxx> wrote:

Nobody said anything about adding stuff to base. I think a package manager even should be implemented as a self-bootstrapping package. Otherwise it's really hard to update the package manager itself on release branches etc.

Interix have such approach.
1.3Mb, it's self-installing shell script
pkg_add, pkg_update, pkg_info, pkg_delete, pkg_create and pkg_sign utilities


ftp://warehousepage:QjH7cVLa@xxxxxxxxxxxxxxxxxxxxxx/pkgs/3.5/pkg-current-bin35.sh

There is first 5 lines, copyright & disclaimer :)
#!/bin/ksh
# Self-extracting, self-modifying, self-installing shell script patch
# (c) Copyright 2003-2005, Rodney Ruddock. All Rights Reserved.
# You may redistribute this freely provided that you understand that
# this software come AS IS and without any warranty.

Rest of script in attach, without binary part (pkg-2.4.3-bin35.tar.gz)
#!/bin/ksh
# Self-extracting, self-modifying, self-installing shell script patch
# (c) Copyright 2003-2005, Rodney Ruddock. All Rights Reserved.
# You may redistribute this freely provided that you understand that
# this software come AS IS and without any warranty.
#
# Flip this file to make sure it wasn't in Win32 format (for uuencode)
mv $0 $0.xxx
cp $0.xxx $0
flip -u $0
ed $0 << EOF > /dev/null 2>&1
7,16d
wq
EOF
sh $0
exit
#
REL=`/bin/uname -r`
MACH=`/bin/uname -m`
ver="2.4.3"
rm -rf $0.xxx
echo ""
echo " /Tools bootstrap installation of the 'pkg' installer."
echo ""
echo " WARNING: "
echo "         This is a software installation. "
echo ""
echo " WHEN INSTALLING THIS SOFTWARE YOU MUST BE: "
echo "     + the Local Administrator, or "
echo "     + a member of the Administrators group. "
echo ""
echo " This installs the 'pkg' installer for Interix ${REL} (${MACH}), version ${ver}. "
echo " This also installs a newer version of 'ftp, 'pax' & 'tar' in '/bin'. "
echo " Updated versions of 'ls' and 'gzip' are also installed."
echo " This installation as a shell script is a bootstraping technique. "
echo " For help refer to http://www.interopsystems.com/tools/ "
echo ""

ADMINTEST=`/bin/id | /bin/egrep "197108|1049076|131616"`

if [ "$ADMINTEST" == "" ] ; then
	echo " *** ALERT *** "
	echo " It has been detected that you are _not_ using the Administrator "
	echo " account or an account in the Administrators group. "
	echo ""
	echo " This installation will now stop for your safety. "
	echo " Please read all information above. "
	echo " For help refer to http://www.interopsystems.com/tools/ "
	echo ""
	echo ""
	exit 0
fi

if [ -f /usr/local/bin/pkg_add ] ; then
	echo " *** ALERT *** "
	echo " It has been detected that you already have a version of "
	echo " 'pkg' installed. You cannot (and should not) update 'pkg' "
	echo " with this script. "
	echo ""
	echo " You should use 'pkg_add' for the update. "
	echo " Do: 'pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/pkg-current-bin.tgz' "
	echo " at a shell (ksh or csh or bash) prompt. "
	echo " For help refer to http://www.interopsystems.com/tools/ and "
	echo " post a question in the /Tools Forum. "
	echo ""
	echo ""
	exit 0
fi

echo " Press Enter to continue or ^C to cancel. "
echo ""
read something

echo $0 | /bin/grep "^/" > /dev/null 2>&1
if [ $? = 0 ] ; then
	THISFILE="$0"
else
	THISFILE="`pwd`/$0"
fi

OFFSET=`awk '/^__UU_GZ_PATCH_BELOW__/ { print NR + 1; exit 0; }' $0`
THISDIR="`pwd`"

echo " Now in directory " `pwd` " extracting the file "
echo " Please wait...   "
echo ""

cd /tmp
/bin/tail +$OFFSET "$THISFILE" | uudecode 
/bin/rm -f pkg-${ver}-bin35.tar
/usr/contrib/bin/gunzip pkg-${ver}-bin35.tar.gz

if [ ! -e pkg-${ver}-bin35.tar ] ; then
	echo "Archive file not extracted/decompressed correctedly."
	echo "This is an error. Exiting early. Software not installed."
	exit 1
fi

# The catch-22 avoider
/bin/cp -f /bin/tar /tmp/tar

if [ ! -s /bin/tar.orig ] ; then
	/bin/cp /bin/tar /bin/tar.orig
fi

# These 'cp's simulate an install happening and what would have been done
# so that updates and uninstalls will happen cleanly.
if [ -s /bin/tar ] ; then
	/bin/cp /bin/tar /bin/tar-0
fi

if [ -s /bin/ftp ] ; then
	/bin/cp /bin/ftp /bin/ftp-0
fi

if [ -s /bin/pax ] ; then
	/bin/cp /bin/pax /bin/pax-0
fi

if [ -s /usr/share/man/cat1/ftp.1 ] ; then
	/bin/cp /usr/share/man/cat1/ftp.1 /usr/share/man/cat1/ftp.1-0
fi

if [ -s /usr/share/man/cat1/pax.1 ] ; then
	/bin/cp /usr/share/man/cat1/tar.1 /usr/share/man/cat1/tar.1-0
fi

if [ -s /usr/share/man/cat1/pax.1 ] ; then
	/bin/cp /usr/share/man/cat1/pax.1 /usr/share/man/cat1/pax.1-0
fi

# umask adjusted here with purpose for 'tar' running
umask 2
/tmp/tar xvpf pkg-${ver}-bin35.tar

if [ ! -e /usr/local/share/terminfo ]; then
	/bin/mkdir -p /usr/local/share
	/bin/ln -s /usr/share/terminfo /usr/local/share/terminfo
fi

/bin/rm -f pkg-${ver}-bin35.tar
/bin/rm -f pkg-${ver}-bin35.tar.uu
cd "${THISDIR}"

# This adds the two "env_*" packages that are part of this bootstrap.
/bin/cat >> /etc/csh.lcl << EOF 2> /dev/null

# pkg_add :: MANPATH local extend for installed software
setenv MANPATH "/usr/local/man:\${MANPATH}"


# pkg_add :: PATH local extend for installed software
setenv PATH "/usr/local/bin:\${PATH}"

EOF

/bin/cat >> /etc/profile.lcl << EOF 2> /dev/null

# pkg_add :: MANPATH local extend for installed software
export MANPATH="/usr/local/man:\${MANPATH}"


# pkg_add :: PATH local extend for installed software
export PATH="/usr/local/bin:\${PATH}"

EOF

/bin/cat >> /etc/zshenv.lcl << EOF 2> /dev/null

# pkg_add :: MANPATH local extend for installed software
export MANPATH="/usr/local/man:\${MANPATH}"


# pkg_add :: PATH local extend for installed software
export PATH="/usr/local/bin:\${PATH}"

EOF

echo ""
echo " Installation of software completed. "
echo ""
echo " Installer database information has been added so that this software "
echo " can be updated with the 'pkg' installer itself. "
echo ""
echo " It is recommended that you close this shell and start a fresh"
echo " shell so that the new setting may take effect."
echo ""
echo " An update for this bootstrap of the installer may be available now."
echo " It is recommended that you update to the most recent version."
printf " Would you like to update now? (y/n)[y] "

read something

if [ "${something}" != "n" ]; then
	echo " Using 'pkg_add' to get the update of 'pkg' (the installer)."
	echo " This will take a couple of minutes...  "
	/usr/local/bin/pkg_add ftp://ftp.interopsystems.com/pkgs/${REL}-${MACH}/pkg-current-bin.tgz
	echo " Finished getting the update for 'pkg'. "
fi
echo ""
echo " Done. "
echo ""

exit 0

__UU_GZ_PATCH_BELOW__
begin 664 pkg-2.4.3-bin35.tar.gz
end


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]