-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall
executable file
·123 lines (84 loc) · 3.55 KB
/
postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#
#
# LBACKUP INSTALLER - Post Install Script
# (C)2006 Lucid Information Systems, All Rights Reserved
# Authors : Henri Shustak, Sam Wiliams
# Licenced under the GNU GPL
#
# Version 1.2
#
#######################
# Install LBACKUP #
#######################
################### Install Configuration #################
# Name and Version
install_name="lbackup"
install_version="1001"
# Source Variables
install_dir_source="/usr/local/libexec/"
backup_component_name_source="backup_script.bash"
email_component_name_source="maillog_script.bash"
change_directory_component_name_source="interfaces/lbackup_change_directory.bash"
# Destination Variables
bin_exec_dest="/usr/local/sbin/"
backup_component_name_dest="lbackup"
email_component_name_dest="lmail"
change_directory_component_name_dest="lcd"
# Version Links
compatibility_version_link_name="lbackup1"
current_version_link_name="lbackup"
################### Internal Variables #################
full_install_dir_source=${install_dir_source}${install_name}${install_version}/
full_backup_component_name_dest="${bin_exec_dest}${backup_component_name_dest}"
full_email_component_name_dest="${bin_exec_dest}${email_component_name_dest}"
full_change_directory_component_link_dest="${bin_exec_dest}${change_directory_component_name_dest}"
full_compatibility_version_link_name="${install_dir_source}${compatibility_version_link_name}"
full_current_version_link_name="${install_dir_source}${current_version_link_name}"
backup_component_link_source="${full_current_version_link_name}/${backup_component_name_source}"
email_component_link_source="${full_current_version_link_name}/${email_component_name_source}"
change_directory_component_link_source="${full_current_version_link_name}/${change_directory_component_name_source}"
################### Previous Version Check #################
# Remove Outdated Links
# Remove Previous Version (Backup Component)
if [ -h "${full_backup_component_name_dest}" ] ; then
rm -f "${full_backup_component_name_dest}"
fi
# Remove Previous Version (Email Component)
if [ -h "${full_email_component_name_dest}" ] ; then
rm -f "${full_email_component_name_dest}"
fi
# Remove Compatibility Version Link
if [ -h "${full_compatibility_version_link_name}" ] ; then
rm -f "${full_compatibility_version_link_name}"
fi
# Remove Current Version Link
if [ -h ${full_current_version_link_name} ] ; then
rm -f "${full_current_version_link_name}"
fi
################ Create Current Version Links ##############
# Install Compatibility Version Link
ln -s "${full_install_dir_source}" "${full_compatibility_version_link_name}"
# Install Current Version Link
ln -s "${full_compatibility_version_link_name}" "${full_current_version_link_name}"
################## Create Executable Links ################
# Confirm Executable Destination Folder Exists
if ! [ -d "${bin_exec_dest}" ] ; then
mkdir -p "${bin_exec_dest}"
chown root:wheel "${bin_exec_dest}"
chmod 755 "${bin_exec_dest}"
fi
# Install Backup Component (Executable)
ln -s "${backup_component_link_source}" "${full_backup_component_name_dest}"
# Install Email Component (Executable)
ln -s "${email_component_link_source}" "${full_email_component_name_dest}"
# Install Change Directory Component (Executable)
ln -s "${change_directory_component_link_source}" "${full_change_directory_component_link_dest}"
##### Create the (Example) Settings Sybolic Link (Root Directory) #####
if ! [ -d /lbackup ] ; then
if [ -d /etc/lbackup ] ; then
ln -s /etc/lbackup /lbackup
fi
fi
################ Exit ##############
exit 0