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

Re: su and chsh never work



On Thu, Dec 30, 1999 at 07:33:42PM -0900, Ethan Benson wrote:
> On 30/12/99 matt garman wrote:
> 
> >Would it be a bad idea to just do a
> >    tar xzvpf base2_2.tgz
> >from my root directory?
> >
> >I assume all the files will be put in the correct places, but will this
> >throw off or otherwise interfere with dpkg's accounting in anyway?
> 
> I really don't know, I am not familiar enough with what dbootstrap 
> does behind the scenes of installation to know what will get broken 
> and how badly by doing this.  i am sure there will be at least some 
> breakage in the form of creating a unconfigured base...
> 
> does dpkg have a --set-perms option like RPM to set all permissions 
> in a package to what they should be?
> 
> that would be perfect for this situation...
> 
> 

Try the attached script.
 
-- 
"If you continue running Windows, your system may become unstable."
     -- Windows 95 BSOD

Dwayne C. Litzenberger - dlitz@cheerful.com

Please always Cc to me when replying to me on the lists.

Advertising Policy: http://www.redrival.com/dlitz/spamoff.html
GnuPG Public Key:   http://www.redrival.com/dlitz/gpgkey.asc
     Fingerprint:   0535 F7CF FF5F 8547 E5A5 695E 4456 FB6C BC39 A4B0
#!/bin/sh
# Usage: tgz-perms.sh filename.tar.gz

octal_value() {
	oo=""
	if echo $1 | cut -b 1 | grep "l" >/dev/null ; then exit 1; fi
	for e in `echo $1 | cut -b 2-4` `echo $1 | cut -b 5-7` `echo $1 | cut -b 8-10`
	do	
		oo=${oo}`oct $e`
	done
 	echo $oo
}

oct() {
	case $1 in
		"rwx")  o=7;;
		"rw-")  o=6;;
		"r--")  o=4;;
		"r-x")  o=5;;
		"rws")  o=47;;
		"r-s")  o=45;;
		"---")  o=0;;
		*)	o=-1;;
	esac
	echo $o
}

for file in "$@" ; do \
	for e in `tar tvzf $file | cut -c1-10,48,52-` ; do \
		p=`echo $e | cut -c1-10`
		f=`echo $e | cut -c12-`
		if o=`octal_value $p` ; then \
			echo "chmod $o $f"
			chmod $o $f
		fi	
	done
done

Attachment: pgpQ_pz5v2AEI.pgp
Description: PGP signature


Reply to: