- This is a copy of the [OSX](https://github.com/bkuhlmann/osx) project originally released on 2012-03-31. The OSX project has been deprecated. All future development and support will take place with this project instead. - This project uses the *macOS* name in order to better match the updated branding and terminology used by Apple.
32 lines
1020 B
Bash
32 lines
1020 B
Bash
#! /bin/bash
|
|
|
|
# DESCRIPTION
|
|
# Defines software restore functions.
|
|
|
|
# Label: Restore Preference
|
|
# Description: Restores an application preference.
|
|
# Parameters: $1 (required) - The backup volume root path, $2 (required) - The preference file.
|
|
restore_preference() {
|
|
local backup_root="$1"
|
|
local preference_file="$2"
|
|
local backup_path="$backup_root/Users/$USER/Library/Preferences/$preference_file"
|
|
local restore_root="$HOME/Library/Preferences"
|
|
|
|
cp -p "$backup_path" "$restore_root"
|
|
}
|
|
export -f restore_preference
|
|
|
|
# Label: Restore Application Support
|
|
# Description: Restores application support files.
|
|
# Parameters: $1 (required) - The backup volume root path, $2 required - The application name.
|
|
restore_app_support() {
|
|
local backup_root="$1"
|
|
local app_name="$2"
|
|
local backup_path="$backup_root/Users/$USER/Library/Application Support/$app_name"
|
|
local restore_path="$HOME/Library/Application Support"
|
|
|
|
mkdir -p "$restore_path"
|
|
cp -pR "$backup_path" "$restore_path"
|
|
}
|
|
export -f restore_app_support
|