[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] System Build Cleanup Script
From:       "Rudy Ruiz" <rudy () thummy ! com>
Date:       2001-05-25 16:51:02
[Download RAW message or body]

Version 0.02 is out. It now optionally cleans up the portage distfiles
directory and prints out a little more status information.

----- Original Message -----
From: "Rudy Ruiz" <rudy@thummy.com>
To: <gentoo-dev@gentoo.org>
Sent: Friday, May 25, 2001 3:18 PM
Subject: [gentoo-dev] System Build Cleanup Script


> I hacked together a script to cleanup a few things and create a few files
in
> /etc after a build from a build snapshot. I'll attach it. I think it's
> reasonably safe, but review and patches are welcome.
>
> Thanks,
> --
> rudy-at-thummy-dot-com
> www.thummy.com
>

["cleanup.sh" (application/octet-stream)]

#!/bin/sh
# cleanup.sh - Script to clean up after a system build
#
# Version 0.02
# Release Date: May 25, 2001
#

TMPDIR=/tmp
HOSTNAME=/etc/hostname
RESOLV=/etc/resolv.conf
PORTAGEDIR=/usr/portage

function cleanup_help {
	cat << EOF
Usage: `basename $0` [options]
Options:
	-f		Force creation of hostname and resolv.conf.
	-h		Display the help screen.
	-d		Clean distfiles from Portage(tm) tree.
EOF
}

while getopts ":fhd" opt; do
	case $opt in
		f )
			FORCENEWFILES=y;
			;;
		h )
			cleanup_help
			exit
			;;
		d )
			CLEANDISTFILES=y;
			;;
		*)
			break;
	esac
done

# Cleanup $TMPDIR
if [ -d ${TMPDIR} ]; then
	echo "Cleaning up ${TMPDIR}..."
	rm -rf ${TMPDIR}/portage
fi
if [ "${CLEANDISTFILES}" = "y" ]; then
	echo "Cleaning up ${PORTAGEDIR}/distfiles..."
	rm -rf ${PORTAGEDIR}/distfiles/*
fi


# We're going to create a couple of skeleton files if they don't exist already
if [ ! -f ${HOSTNAME} -o "${FORCENEWFILES}" = "y" ] ; then
	echo "Creating ${HOSTNAME}..."
	echo "yourhostname.yourdomain.com" > /etc/hostname
else
	echo "${HOSTNAME} exists..skipping. To overwrite use -f instead"
fi

if [ ! -f ${RESOLV} -o "${FORCENEWFILES}" = "y" ]; then
	echo "Creating ${RESOLV}..."
	echo "domain yourdomain.com" > /etc/resolv.conf
	echo "nameserver yournameserver.com" >> /etc/resolv.conf
else
	echo "${RESOLV} exists..skipping. To overwrite use -f instead"
fi	


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic