Sponsored Content
Top Forums Shell Programming and Scripting Trying to untar then chown, and chmod Post 302270099 by walkerl on Friday 19th of December 2008 04:22:33 PM
Old 12-19-2008
Trying to untar then chown, and chmod

I'm changing (trying to anyway) a script that will need to unrar a file, this file will create a directory with files in it. Then I need to change the owner ship and permission on that directory. Finally, I will rsync the directory to another machine.

This is what I have so far.

#!/bin/bash

###Grab the name of the .trz file and unzip

echo -e "Enter the name of the patch file: \c"
read file
tar -zxf $file
##### This is where I'm stuck, not sure what the next step is.


####Below was the original script that would rsynce the directory if the permissions were already set and the file was already untarred####

echo -e "Please enter the directory of patch (exclude trailing slash) : \c"
read patch
rsync -rpvgo --force $patch user@somemachine.com:/srv/patches
rsync -rpvgo --force $patch user@somemachine.com:/srv/patches
 

10 More Discussions You Might Find Interesting

1. AIX

chown

hello chown not change ownership before: 205:system ~kuku chown kuku:system ~kuku after no change 205:system ~kuku aix box can someone help me? ariec (2 Replies)
Discussion started by: ariec
2 Replies

2. UNIX for Advanced & Expert Users

chown issue

I have a strange problem in my Linux box (Suse). Recently I took over this box as admin even though I have no prior admin experience. Following is my issue I had following users under 'root' group initially user1 user2 user3 Since I did not like user ids under root group. I modifed these... (9 Replies)
Discussion started by: praveenkumar_l
9 Replies

3. UNIX for Dummies Questions & Answers

chown

is there a difference in chown on a file or a directory? how do i chown a directory and all the contents? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

4. Shell Programming and Scripting

cp, chown, untar

hello i want shell script. i have a source.txt /home/user409/public_html/test/ /home/user09876/public_html/xdsss/ /home/user9765/public_html/320xxx/ . . . maybe 1000 lines i want . 1.read a source.txt 2.untar special.tar.gz into these directory in source.txt 3.i want to... (14 Replies)
Discussion started by: topic32428285
14 Replies

5. Shell Programming and Scripting

Chown - error

I have a file fin2009_4.txt.gz in the unix ftp server. Owner of the file is: ftpusr. -rw-r--r-- 1 ftpusr sap 0 Feb 19 10:19 fin2009_4.txt.gz When I try to delete this file after copying to my home folder, I am getting the following error. rm: fin2009_4.txt.gz1: override... (4 Replies)
Discussion started by: sid1982
4 Replies

6. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

7. Solaris

chown

Hello My oracledatabase creats some xmlfiles. this files has the owner hugo. now I've a script (how runs als hugo2) and this script will insert this XMLFile into the database. But that doesn't work, because the owner of the files is wrong, and hugo has not the rights to insert this files into... (3 Replies)
Discussion started by: Street
3 Replies

8. Shell Programming and Scripting

excluding a directory with chown, chmod

does anyone know how to exclude a directory with chown or chmod? im trying to do something like this chown $username:$username $directory/* chown $username:$username $directory/.* chown $username:$username $directory and find $directory/* -type f -exec... (1 Reply)
Discussion started by: vanessafan99
1 Replies

9. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies

10. UNIX for Dummies Questions & Answers

How to log all file that has been move,chmod,chown?

Hi All, Seeking for your assistance on how to log that has been chmod,mv,chown,chgrp and how to prevent script running while chmod,mv,chown,chgrp are still running? Ex: a/b/c-folder file1.txt file2.txt file3.txt chmod 777 * chown owner owner group mv what i did was(please see... (6 Replies)
Discussion started by: nikki1200
6 Replies
PATCHER(1)						User Contributed Perl Documentation						PATCHER(1)

NAME
patcher - a patch maintenance tool SYNOPSIS
patcher [-n <patchname>] [<file ...>] Edit <file> as part of the patch <patchname>. patcher -r Refresh current patch. patcher [-f] -b Move back one patch to the previous one. patcher [-f] -b <patch> Move back in series until we're at <patch>. patcher [-f] -b <num> Move back <num> patches in series. patcher -a Apply the next patch in the series. patcher -a <patch> Apply all patches from the series until we've reached at <patch>. patcher -a <num> Apply next <num> patches from series. patcher -n <patchname> [-p <n>] -i <diff> Import an external diff file into patch <patchname>. Strip <n> levels from the directory names. Please note that patch allows '-p1', but we only '-p 1'. patcher [-f] [-n <patchname>] [-p <n>] -i <patch ...> Import an external diff file into patch <patchname>. Strip <n> levels from the directory names. Please note that patch allows '-p1', but we only '-p 1'. CONCEPT
Patcher is a perl script which I use for managing patches. It's quite powerful, easy to use, and fast. Patcher keeps track of which files you change. It then can generate patches from your changes, no need for you to handle the diff tool man- ually. You can have more than one record of file changes, we call this a patch. A patch is something that the patch(1) command can apply. The patches can be stacked in series, they define the order they have to applied. Patcher keeps series information as well as information which patches have been applied and which not. DESCRIPTION
Later we will have a walkthrought, but let me first explain the basic operation modes of patcher: Editing files When you call patcher with a filename, patch will make a backup of this file (if the file exists). Now you can create or change the file. Later you can ask patcher to create a unified diff with all your changes. Creating unified diffs Just call "patcher -r" and you will get a unified diff of all your additions, modification and deletions. The diff will be stored in .patches/<patchname>.patch. It is in a form that allows direct application via patch(1) or, of course, via "patcher -i". Whenever you do "patcher -r" your .patches/<patchname>.patch file get's refreshed. Back out a patch To revoke your changes and go to the previous version, just enter "patcher -b". Patcher will make sure that you don't loose your changes by asking you to create a diff if something has changed since the last refresh. You may use -f (or --force) patcher to go back anyway. You can back out more than one patch by either specifying a number a patch name after -b. Re-Apply a patch With "patcher -n <patchname> -a" one can apply an already existing managed patch. A managed patch is a patch that already is stored in the .patches directory and is mentioned in the .patches/series file. Patcher tests if the patch would apply without problem and applies it. If the patch would be rejected, you can use -f (or --force) to apply the patch anyway. You can apply more than one patch by either specifying a number a patch name after -a. Importing external patches Sometimes you have an external patch. That's the opposite of a managed patch, the patch is not stored in the .patches directory. By import- ing it, it will become a managed patch. Import the patch simply with -i <filename>. You can use -p <num> to specify the directory level, similar to the -p<num> option of patch(1). But please keep in mind that we need a space between -p and the number. Normally only clean patches will be imported. To import a patch that creates rejects use -f (or --force). You'll see a list of files where the patch did not apply cleanly, fix the problems manually. Later you can use "patcher -r" to create a clean patch. INSTALLATION
Just place patcher somewhere in your path. That's all. For each project Patcher requires one special directory called ".patches". It will search for this directory. If it does not exist, patcher creates it automatically. INTERNALS
All work occurs with a single directory tree. All commands are invoked within the root of that tree (TODO: this can and should change). Patcher manages a "stack" of patches. Each patch is a changeset against the base tree plus the preceding patches. All patches are listed, in order, in the file ".patches/series". Patcher adds patches into this file, but never deletes entries. You can edit this file with a text editor, but please do only so if the patch you delete is currently not applied. Any currently applied patches is listed in the file ".patches/applied". The patcher manage this file, there is no need for you to ever edit this file manually. Each patch affects a number of files in the tree. These files are listed in a file list named ".patches/*.files". Patcher manages them. When you back out a patch, this file will deleted. Or, in other words, this file exists only for applied patches. It's only used by "patcher -r". Patches are placed into ".patches/*.patch" files. They are always unified diffs with -p1 as patchlevel. You can copy then anywhere, the patch(1) utility will read them without problems. Optionally you can put descriptions for the patches in files named ".patches/*.txt". So for a particular patch "my-first-patch" the following will exist: - An entry "my-first-patch.patch" in ".patches/series". - An entry "my-first-patch" in ".patches/applied" (if it's currently applied) - A file ".patches/my-first-patch.files" which contains the names of the files which my-first-patch modifies, adds or removes - A file ".patches/my-first-patch.patch", which is the context diff, basically the main output of patcher. - Optionally a file ".patches/my-first-patch.txt" which contains the patch's changelog, description or whatever you put in there. WALKTHROUGHT
Let's start. Go into /usr/src/linux (or wherever). Now let's start with changing some source files: patcher -n my-patch kernel/sched.c OK, patcher copied kernel/sched.c to kernel/sched.c~my-patch for you, the program has also done some magic in the .patches directory, which won't be of interest to us now. Now edit kernel/sched.c a bit. Now we're ready to document the patch: Create .patches/my-patch.txt Now generate a patch: patcher -r This will generate ".patches/my-patch.patch". Take a look at this file. Now we remove our change to sched.c by going backwards: patcher -b Look at where we're now: patcher -s Now let's add another file to my-patch. First we re-apply the patch: patcher -a Now edit a second file: patcher kernel/printk.c Note that here we gave patcher a single argument, without command line options. This always tells patcher to add another file to the cur- rent patch. Edit kernel/printk.c Refresh my-patch: patcher -r Now start a second patch: patcher -n my-second-patch kernel/sched.c Here we have a filename in the command line for patcher, so we edit a file. But now we specified a patch name with -n. This told patcher to create a new patch. Now patcher manages two patches, "my-patch" and "my-second-patch". Edit kernel/sched.c, to make some changes for my-second-patch Generate my-second-patch: patcher -r Take a look in ".patches/my-second-patch.patch". Also note that "my-second-patch.patch" has been added to the series file. Whenever you manually begin a patch, it will automatically be put into the series file. In this way, the whole thing is stackable. If you have four patches applied, say "patch-1", "patch-2", "patch-3" and "patch-4", and if patch-2 and patch-4 both touch kernel/sched.c then you will have: kernel/sched.c~patch-2 Original copy, before patch-2 kernel/sched.c~patch-4 Copy before patch-4. Contains changes from patch-2 kernel/sched.c Current working copy. Contains changes from patch-4. This means that your diff headers contain "~patch-name" in them, which is convenient documentation. To end our tour, we remove both patches: patcher -b patcher -b That's pretty much it, really. SEE ALSO
Andrew Morton's patch scripts at http://www.zip.com.au/~akpm/linux/patches/ I stole the idea from him and even most of this documentation. At http://savannah.nongnu.org/projects/quilt/ you'll find Quilt. That's the successor of Andrew's original scripts. They do the same as patcher (and slightly more), but with tenthousand shell scripts. AUTHOR
Holger Schurig <holgerschurig usingthedomain gmx.de> perl v5.8.4 2004-05-21 PATCHER(1)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy