Unix/Linux Go Back    


OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

Backup user folder

OS X (Apple)


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-26-2017   -   Original Discussion by peli
peli's Unix or Linux Image
peli peli is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 6 January 2018, 10:33 AM EST
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Backup user folder

Hi, I have a postinstall script included in an Installer which has worked properly in the future. Now, for some reason, a part is not working. The function of the part in the script is to backup the User's folder to the desktop in order for the installed app to copy new files from the Library/Application Support to the User/Library/Application Support directory. The part of the script looks like this:



Code:
################################################################################
#
# Move user's files so app will update those files
#
################################################################################
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = $year + 1900;
$mon = $mon + 1;
$timeStampString = sprintf("%04u.%02u.%02u_%02u.%02u.%02u", $year, $mon, $mday, $hour, $min, $sec);
$userFileBackupDir = $ENV{"HOME"}."/Desktop/Finale User Backup/".$PKG_RECORD_VERSION."_Backup_".$timeStampString;
foreach $relativeFilePath (@MOVE_USER_FILES_FOR_UPDATES) {
    $existingPath = $ENV{"HOME"}."/".$relativeFilePath;
    print "checking: $existingPath\n";
    if ( -e $existingPath )  {
        $backupPath = $userFileBackupDir."/".$relativeFilePath;
        makeDirAtPath_(parentDirOfPath_($backupPath));
        print "  moving: $backupPath\n";
        rename($existingPath, $backupPath);
    }
}

I can contribute the entire script if needed

Thank's
peli
Sponsored Links
    #2  
Old Unix and Linux 12-26-2017   -   Original Discussion by peli
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 20 February 2018, 3:57 AM EST
Location: San Jose, CA, USA
Posts: 11,070
Thanks: 617
Thanked 3,859 Times in 3,302 Posts
You tell us that you have a function that has worked in the future (although I don't know what time machine you used to determine that) and that it doesn't work now. But, you:
haven't told us:
  1. what interpreter is used to run this code,
  2. what it does when it worked correctly in the future,
  3. what it is doing now that is incorrect,
  4. what diagnostic messages it now produces, nor
  5. what normal outputs it now produces.
Without this basic information, it is hard for us to make any guesses as to why it doesn't work now but will work in the future!
Sponsored Links
    #3  
Old Unix and Linux 12-28-2017   -   Original Discussion by peli
peli's Unix or Linux Image
peli peli is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 6 January 2018, 10:33 AM EST
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
I’m sorry for the lack of… and wrong information… and my English language. This has worked in the past is what I mean. I also should mention this is on Mac.

1. I think it is Perl. On top of script is #!/usr/bin/perl.
2. After updating the app and corresponding files in Library/Application Support/”Program Files Folder” the program, when it starts, will move the newer files to Users/Library/Application Support/”Program Files Folder”. My program is Swedish localized and for some reason, the program doesn’t update files in user’s directory. Probably a Unicode problem. The Installer script guy working for the American Company, which makes the program, helped me with this workaround script and the function is to back up the older version of the updater’s newer files in a backup folder placed on the desktop and then delete them in the User’s dir. The program then install’s new files. There are more features of the script including one that you helped me with before, 02-21-2016 (Installer issue | Unix Linux Forums | OS X (Apple)) Here is a list of what the script does:
# Move user's files so app will update those files
# Create Desktop shortcut for Swedish Menu Commands Document
# Create Desktop shortcut for Swedish Meta Tools Document
# Create a Audio Units Support folder
# Check to see if the installer's rewire bundle needs to be installed.
# remove the temp support folder in either case.
# Create a "Favorite Plug-ins" folder
# Finale activation file
# Reset the QuickLook Server and clients' generator cache
# Register our Spotlight component
# Write a receipt for this component (for updaters)

3. It doesn’t backup and deletes User files in order for the app to install the new ones.
4. No messages.
5. Everything else is working.

Thank's
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create a folder under different user directory bghosh Shell Programming and Scripting 2 05-20-2016 01:37 PM
Temp folder Getting full while taking backup. purushottamaher HP-UX 2 06-13-2012 09:42 AM
Unable to create folder as a user Manjunath K V Solaris 2 03-09-2011 07:14 PM
User should be restricted moving a folder perlamohan UNIX for Dummies Questions & Answers 6 10-24-2009 08:23 PM
How to disable cd to other folder for a user Dilippatel AIX 1 12-02-2003 07:45 AM



All times are GMT -4. The time now is 05:50 AM.