Sponsored Content
Top Forums Shell Programming and Scripting Recover the original file once removed Post 303043154 by bmk123 on Monday 20th of January 2020 06:09:31 AM
Old 01-20-2020
Thanks... i will go through the link
 

10 More Discussions You Might Find Interesting

1. Solaris

after init all /tmp file has been removed

I'm new in Solaris server After the system support reboot the Solaris server, all the files in /tmp has been removed, is that normal under Solaris or under different init level will get different result? which init level will do that? (5 Replies)
Discussion started by: yesthomas
5 Replies

2. Shell Programming and Scripting

Please Help. Strings in file 1 need to be searched and removed from file 2

Please help. Here is my problem. I have 9000 lines in file a and 500,000 lines in file b. For each line in file a I need to search file b and remove that line. I am currently using the grep -v command and loading the output into a new file. However, because of the size of file b this takes an... (4 Replies)
Discussion started by: mjs3221
4 Replies

3. UNIX for Dummies Questions & Answers

how to removed chr(10) characters in a file

Hi, How do we remove an extra new line in a file. New line in ascii is called chr(10). Suppose we have a file as: 12345 98765 ------ ------ From the above i represented new line with dashed lines. Basically i have 2 new lines with white space at the end of the file. How do i removes... (1 Reply)
Discussion started by: sandeep_1105
1 Replies

4. UNIX for Dummies Questions & Answers

CSV file:Find duplicates, save original and duplicate records in a new file

Hi Unix gurus, Maybe it is too much to ask for but please take a moment and help me out. A very humble request to you gurus. I'm new to Unix and I have started learning Unix. I have this project which is way to advanced for me. File format: CSV file File has four columns with no header... (8 Replies)
Discussion started by: arvindosu
8 Replies

5. Linux

file removed

Hi Team, I have deleted a file accidentally by using rm command. I am not the root(admin) user. Can you please let me know how to get that .tex file? (2 Replies)
Discussion started by: darling
2 Replies

6. Red Hat

How to update rpm database regarding removed file of a package?

For Suppose, I have installed a package having files file1, file2 and file3. After installation, I removed the file "file3". But "rpm -qf file3" is giving the package name, even file3 was not there. And also "rpm -ql package" is also displaying all 3 files. How can i update rpm database about... (6 Replies)
Discussion started by: snreddy_gopu
6 Replies

7. Programming

The fwrite function is not returning error, if the file was removed.

The fwrite function call is not returning error, when the file it writes to is removed, please advise on how to find if the file already opened and being written by a program is removed manually or by some other process. please see the code below, #include<stdio.h> #include<stdlib.h> ... (3 Replies)
Discussion started by: Kesavan
3 Replies

8. Shell Programming and Scripting

Error removed from file

Below is a flowchart of a program. Most everything works as expected, but there are a couple of issues that I need some expert help on. The check function was setup initially for a single user input. The input has been modified to allow for multiple inputs, so the code below does not work. My... (15 Replies)
Discussion started by: cmccabe
15 Replies

9. UNIX for Beginners Questions & Answers

File Containing Extra delimiter should be removed

The input file is this: a|b|c|d x|y|z|n||||||||| p|q|r|s||| g|h|i| w|e|r|| Now as per requirement , each row should have only 3 delimiter. Now the 2nd row & last row has an extra delimiter, How to remove that ? In some large file having 100K data , there can be 100 such rows having... (4 Replies)
Discussion started by: ikdKunal
4 Replies

10. UNIX for Beginners Questions & Answers

File Management: Removing of files from Server2 IF the same file is removed from Server1.

Hi Folks, I have a requirement of file management on different servers. Source Server is SERVER-A. Two servers will fetch files from SERVER-A: SERVER1 and SERVER2. 4th SERVER is SERVER-B, It will fetch files from SERVER1. If SERVER1 goes DOWN, SERVER-B will fetch pending files from... (2 Replies)
Discussion started by: Raza Ali
2 Replies
dpkg-maintscript-helper(1)					    dpkg suite						dpkg-maintscript-helper(1)

NAME
dpkg-maintscript-helper - works around known dpkg limitations in maintainer scripts SYNOPSIS
dpkg-maintscript-helper command [parameter...] -- maint-script-parameter... COMMANDS AND PARAMETERS
rm_conffile conffile [prior-version [package]] mv_conffile old-conffile new-conffile [prior-version [package]] DESCRIPTION
This program is designed to be run within maintainer scripts to achieve some tasks that dpkg can't (yet) handle natively either because of design decisions or due to current limitations. Many of those tasks require coordinated actions from several maintainer scripts (preinst, postinst, prerm, postrm). To avoid mistakes the same call simply needs to be put in all scripts and the program will automatically adapt its behaviour based on the environment variable DPKG_MAINTSCRIPT_NAME and on the maintainer scripts arguments that you have to forward after a double dash. CONFFILE RELATED TASKS
When upgrading a package, dpkg will not automatically remove a conffile (a configuration file for which dpkg should preserve user changes) if it is not present in the newer version. There are two principal reasons for this; the first is that the conffile could've been dropped by accident and the next version could restore it, users wouldn't want their changes thrown away. The second is to allow packages to tran- sition files from a dpkg-maintained conffile to a file maintained by the package's maintainer scripts, usually with a tool like debconf or ucf. This means that if a package is intended to rename or remove a conffile, it must explicitly do so and dpkg-maintscript-helper can be used to implement graceful deletion and moving of conffiles within maintainer scripts. REMOVING A CONFFILE If a conffile is completely removed, it should be removed from disk, unless the user has modified it. If there are local modifications, they should be preserved. If the package upgrades aborts, the newly obsolete conffile should not disappear. All of this is implemented by putting the following shell snippet in the preinst, postinst and postrm maintainer scripts: dpkg-maintscript-helper rm_conffile conffile prior-version package -- "$@" conffile is the filename of the conffile to remove. prior-version defines the latest version of the package whose upgrade should trigger the removal. It is important to calculate prior-ver- sion correctly so that conffiles are correctly removed even if the user rebuilt the package with a local version. For example, for a conf- file removed in version 2.0-1 of a package, prior-version should be set to 2.0-1~. This will cause the conffile to be removed even if the user rebuilt the previous version 1.0-1 as 1.0-1local1. If the conffile has not been shipped for several versions, and you are now modifying the maintainer scripts to clean up the obsolete file, prior-version should be based on the version of the package that you are now preparing, not the first version of the package that lacked the conffile. package is the package name. If empty or omitted, the DPKG_MAINTSCRIPT_PACKAGE environment variable (as set by dpkg) will be used. All the parameters of the maintainer scripts have to be forwarded to the program after "--". Current implementation: in the preinst, it checks if the conffile was modified and renames it either to conffile.dpkg-remove (if not modi- fied) or to conffile.dpkg-backup (if modified). In the postinst, the latter file is renamed to conffile.dpkg-bak and kept for reference as it contains user modifications but the former will be removed. If the package upgrade aborts, the postrm reinstalls the original conffile. During purge, the postrm will also delete the .dpkg-bak file kept up to now. RENAMING A CONFFILE If a conffile is moved from one location to another, you need to make sure you move across any changes the user has made. This may seem a simple change to the preinst script at first, however that will result in the user being prompted by dpkg to approve the conffile edits even though they are not responsible of them. Graceful renaming can be implemented by putting the following shell snippet in the preinst, postinst and postrm maintainer scripts: dpkg-maintscript-helper mv_conffile old-conffile new-conffile prior-version package -- "$@" old-conffile and new-conffile are the old and new name of the conffile to rename. prior-version defines the latest version of the package whose upgrade should trigger the rename of the conffile (see the notes for rm_conf- file above concerning the correct value). If prior-version is empty or omitted, then the operation is tried on every upgrade (note: it's safer to give the version and have the operation tried only once). package is the package name. If empty or omitted, the DPKG_MAINTSCRIPT_PACKAGE environment variable (as set by dpkg) will be used. All the parameters of the maintainer scripts have to be forwarded to the program after "--". Current implementation: the preinst checks if the conffile has been modified, if yes it's left on place otherwise it's renamed to old-conf- file.dpkg-remove. On configuration, the postinst removes old-conffile.dpkg-remove and renames old-conffile to new-conffile if old-conffile is still available. On abort-upgrade/abort-install, the postrm renames old-conffile.dpkg-remove back to old-conffile if required. INTEGRATION IN PACKAGES
Given that dpkg-maintscript-helper is used in the preinst, using it unconditionally requires a pre-dependency to ensure that the required version of dpkg has been unpacked before. The required version depends on the command used, for rm_conffile and mv_conffile it is 1.15.7.2: Pre-Depends: dpkg (>= 1.15.7.2) But in many cases the operation done by the program is not critical for the package, and instead of using a pre-dependency we can call the program only if we know that the required command is supported by the currently installed dpkg: if dpkg-maintscript-helper supports command; then dpkg-maintscript-helper command ... fi Debian Project 2012-05-04 dpkg-maintscript-helper(1)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy