backup_paradise 1.2.40
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of backup_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +390 -0
- data/backup_paradise.gemspec +50 -0
- data/bin/backup_for_ingrid +10 -0
- data/bin/backup_paradise +7 -0
- data/bin/windows_backup_paradise +9 -0
- data/doc/README.gen +347 -0
- data/doc/TODO.md +130 -0
- data/lib/backup_paradise/actions/README.md +2 -0
- data/lib/backup_paradise/actions/backup.rb +62 -0
- data/lib/backup_paradise/base/base.rb +493 -0
- data/lib/backup_paradise/base/colours.rb +137 -0
- data/lib/backup_paradise/base/namespace.rb +16 -0
- data/lib/backup_paradise/base/tab.rb +47 -0
- data/lib/backup_paradise/colours/colours.rb +88 -0
- data/lib/backup_paradise/constants/constants.rb +162 -0
- data/lib/backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb +87 -0
- data/lib/backup_paradise/gui/gtk2/OLD_backup.rb +222 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/create.rb +64 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/misc.rb +34 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/simple_backup_widget.rb +167 -0
- data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
- data/lib/backup_paradise/gui/libui/simple_backup_widget/simple_backup_widget.rb +119 -0
- data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +595 -0
- data/lib/backup_paradise/gui/tk/backup.rb +108 -0
- data/lib/backup_paradise/images/BACKUP_IMAGE.png +0 -0
- data/lib/backup_paradise/images/right_arrow.png +0 -0
- data/lib/backup_paradise/project/project.rb +40 -0
- data/lib/backup_paradise/requires/require_the_backup_paradise_project.rb +18 -0
- data/lib/backup_paradise/requires/require_yaml.rb +7 -0
- data/lib/backup_paradise/tab/tab.rb +87 -0
- data/lib/backup_paradise/toplevel_methods/cliner.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/config.rb +77 -0
- data/lib/backup_paradise/toplevel_methods/create_and_remove.rb +63 -0
- data/lib/backup_paradise/toplevel_methods/e.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/esystem.rb +19 -0
- data/lib/backup_paradise/toplevel_methods/files_and_directories.rb +181 -0
- data/lib/backup_paradise/toplevel_methods/help.rb +93 -0
- data/lib/backup_paradise/toplevel_methods/misc.rb +153 -0
- data/lib/backup_paradise/toplevel_methods/mountpoint.rb +185 -0
- data/lib/backup_paradise/toplevel_methods/opnn.rb +25 -0
- data/lib/backup_paradise/utility_scripts/backup/backup.rb +1416 -0
- data/lib/backup_paradise/utility_scripts/backup/constants.rb +44 -0
- data/lib/backup_paradise/utility_scripts/backup/initialize.rb +71 -0
- data/lib/backup_paradise/utility_scripts/backup/menu.rb +361 -0
- data/lib/backup_paradise/utility_scripts/backup/run.rb +20 -0
- data/lib/backup_paradise/version/version.rb +19 -0
- data/lib/backup_paradise/windows/README.md +1 -0
- data/lib/backup_paradise/windows/windows.rb +101 -0
- data/lib/backup_paradise/www/backup.cgi +63 -0
- data/lib/backup_paradise/yaml/config.yml +78 -0
- data/lib/backup_paradise.rb +5 -0
- data/test/testing_toplevel_functionality.rb +11 -0
- metadata +198 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/utility_scripts/backup/constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'backup_paradise/base/base.rb'
|
8
|
+
|
9
|
+
module BackupParadise
|
10
|
+
|
11
|
+
class Backup < ::BackupParadise::Base
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === NAMESPACE
|
15
|
+
# ========================================================================= #
|
16
|
+
NAMESPACE = inspect
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === MINIMAL_FILESIZE
|
20
|
+
# ========================================================================= #
|
21
|
+
MINIMAL_FILESIZE = 5 * (1000 ** 3) # 5 * 1024 * 1024 * 1024
|
22
|
+
|
23
|
+
# ========================================================================= #
|
24
|
+
# === FILE_BACKUP_LOG
|
25
|
+
#
|
26
|
+
# Denote where to keep the backup.log file, if we log that is.
|
27
|
+
# ========================================================================= #
|
28
|
+
if File.directory? '/home/Temp/'
|
29
|
+
FILE_BACKUP_LOG = '/home/Temp/backup.log'
|
30
|
+
else
|
31
|
+
FILE_BACKUP_LOG = '/tmp/backup.log'
|
32
|
+
end
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === TRY_TO_SHOW_BACKUP_COMPLETE_MESSAGE_VIA_LIBUI
|
36
|
+
#
|
37
|
+
# If the following constant is true then this class will try to make
|
38
|
+
# use of libui and the libui_paradise gem to show a little libui
|
39
|
+
# message box (a window) about how the backup action is now
|
40
|
+
# complete.
|
41
|
+
# ========================================================================= #
|
42
|
+
TRY_TO_SHOW_BACKUP_COMPLETE_MESSAGE_VIA_LIBUI = true
|
43
|
+
|
44
|
+
end; end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/utility_scripts/backup/initialize.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'backup_paradise/base/base.rb'
|
8
|
+
|
9
|
+
module BackupParadise
|
10
|
+
|
11
|
+
class Backup < ::BackupParadise::Base # === BackupParadise::Backup
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === initialize
|
15
|
+
#
|
16
|
+
# Invocation example:
|
17
|
+
#
|
18
|
+
# x = BackupParadise::Backup.new(nil, :do_not_run_yet)
|
19
|
+
#
|
20
|
+
# ========================================================================= #
|
21
|
+
def initialize(
|
22
|
+
commandline_arguments = nil,
|
23
|
+
run_already = true,
|
24
|
+
&block
|
25
|
+
)
|
26
|
+
register_sigint
|
27
|
+
reset
|
28
|
+
if commandline_arguments
|
29
|
+
if commandline_arguments.is_a?(Symbol)
|
30
|
+
case commandline_arguments
|
31
|
+
# =================================================================== #
|
32
|
+
# === :do_not_run_yet
|
33
|
+
# =================================================================== #
|
34
|
+
when :do_not_run_yet
|
35
|
+
run_already = false
|
36
|
+
end
|
37
|
+
else
|
38
|
+
set_commandline_arguments(
|
39
|
+
commandline_arguments
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
case run_already
|
44
|
+
# ======================================================================= #
|
45
|
+
# === :do_not_run_yet
|
46
|
+
# ======================================================================= #
|
47
|
+
when :do_not_run_yet
|
48
|
+
run_already = false
|
49
|
+
end
|
50
|
+
# ======================================================================= #
|
51
|
+
# === Handle blocks given next
|
52
|
+
# ======================================================================= #
|
53
|
+
if block_given?
|
54
|
+
yielded = yield
|
55
|
+
case yielded
|
56
|
+
# ===================================================================== #
|
57
|
+
# === :do_not_run_yet
|
58
|
+
# ===================================================================== #
|
59
|
+
when :do_not_run_yet
|
60
|
+
run_already = false
|
61
|
+
# ===================================================================== #
|
62
|
+
# === :we_are_on_windows
|
63
|
+
# ===================================================================== #
|
64
|
+
when :we_are_on_windows
|
65
|
+
@internal_hash[:are_we_on_windows] = true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
run if run_already
|
69
|
+
end
|
70
|
+
|
71
|
+
end; end
|
@@ -0,0 +1,361 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/utility_scripts/backup/menu.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'backup_paradise/base/base.rb'
|
8
|
+
|
9
|
+
module BackupParadise
|
10
|
+
|
11
|
+
class Backup < ::BackupParadise::Base # === BackupParadise::Backup
|
12
|
+
|
13
|
+
require 'backup_paradise/version/version.rb'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === menu (menu tag)
|
17
|
+
# ========================================================================= #
|
18
|
+
def menu(
|
19
|
+
i = commandline_arguments?
|
20
|
+
)
|
21
|
+
return if i.nil?
|
22
|
+
# ======================================================================= #
|
23
|
+
# === Handle Hashes
|
24
|
+
#
|
25
|
+
# Note that this is the default entry point.
|
26
|
+
#
|
27
|
+
# An example for how this may be used is given next:
|
28
|
+
#
|
29
|
+
# BackupParadise::Actions.backup(
|
30
|
+
# backup_these_directories: i,
|
31
|
+
# where_to: to
|
32
|
+
# )
|
33
|
+
#
|
34
|
+
# ======================================================================= #
|
35
|
+
if i.is_a? Hash
|
36
|
+
# ===================================================================== #
|
37
|
+
# === :backup_to_this_target
|
38
|
+
#
|
39
|
+
# The next check must come early, on top.
|
40
|
+
# ===================================================================== #
|
41
|
+
# ===================================================================== #
|
42
|
+
# === :where_to
|
43
|
+
# ===================================================================== #
|
44
|
+
if i.has_key? :where_to
|
45
|
+
set_backup_to_this_target(i[:where_to])
|
46
|
+
elsif i.has_key? :backup_to_this_target
|
47
|
+
set_backup_to_this_target(i[:backup_to_this_target])
|
48
|
+
end
|
49
|
+
# ===================================================================== #
|
50
|
+
# === :commandline_arguments
|
51
|
+
# ===================================================================== #
|
52
|
+
if i.has_key? :commandline_arguments
|
53
|
+
menu(i[:commandline_arguments])
|
54
|
+
# ===================================================================== #
|
55
|
+
# === :backup_these_directories
|
56
|
+
# ===================================================================== #
|
57
|
+
elsif i.has_key? :backup_these_directories
|
58
|
+
menu(i[:backup_these_directories])
|
59
|
+
end
|
60
|
+
# ======================================================================= #
|
61
|
+
# === Handle Arrays
|
62
|
+
# ======================================================================= #
|
63
|
+
elsif i.is_a? Array
|
64
|
+
i.each {|entry| menu(entry) }
|
65
|
+
else
|
66
|
+
case i # case tag
|
67
|
+
# ===================================================================== #
|
68
|
+
# === rbackup --audio-dir
|
69
|
+
#
|
70
|
+
# This entry point can be used to specifically backup the
|
71
|
+
# audio-directory - that is, the local directory that
|
72
|
+
# contains all songs.
|
73
|
+
#
|
74
|
+
# Usage example:
|
75
|
+
#
|
76
|
+
# rbackup --audio-dir
|
77
|
+
#
|
78
|
+
# A more advanced invocation example is:
|
79
|
+
#
|
80
|
+
# rbackup --backup-to=/opt/ --audio-dir
|
81
|
+
#
|
82
|
+
# ===================================================================== #
|
83
|
+
when /^-?-?audio(-| |_)?dir$/i,
|
84
|
+
/^-?-?audio$/i,
|
85
|
+
/^-?-?aud$/i,
|
86
|
+
/^-?-?audi$/i,
|
87
|
+
/^-?-?aonly$/i,
|
88
|
+
/^-?-?audio(-| |_)?only$/i
|
89
|
+
determine_whether_the_target_harddisc_is_a_ntfs_system
|
90
|
+
backup_the_audio_directory
|
91
|
+
do_not_perform_the_regular_backup_routine
|
92
|
+
# ===================================================================== #
|
93
|
+
# === rbackup --libui
|
94
|
+
# ===================================================================== #
|
95
|
+
when /^-?-?lib-?ui$/i,
|
96
|
+
/^-?-?gui2$/i
|
97
|
+
require 'backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb'
|
98
|
+
BackupParadise::GUI::LibUI::BackupForIngrid.new
|
99
|
+
exit
|
100
|
+
# ===================================================================== #
|
101
|
+
# === rbackup --gui
|
102
|
+
#
|
103
|
+
# Alternatively use rbackup --gtk3.
|
104
|
+
# ===================================================================== #
|
105
|
+
when /^-?-?gui$/i,
|
106
|
+
/^-?-?gtk3$/i,
|
107
|
+
/^-?-?gtk$/i,
|
108
|
+
/^-?-?gui1$/i
|
109
|
+
start_the_gtk3_bindings
|
110
|
+
do_not_perform_the_regular_backup_routine
|
111
|
+
# ===================================================================== #
|
112
|
+
# === rbackup --version?
|
113
|
+
# ===================================================================== #
|
114
|
+
when /^-?-?version\??$/i
|
115
|
+
e BackupParadise::VERSION
|
116
|
+
do_not_perform_the_regular_backup_routine
|
117
|
+
# ===================================================================== #
|
118
|
+
# === rbackup --are-we-on-windows?
|
119
|
+
# ===================================================================== #
|
120
|
+
when /^-?-?are(-| |_)?we(-| |_)?on(-| |_)?windows\??$/i
|
121
|
+
e rev+'Are we on windows? '+
|
122
|
+
steelblue(are_we_on_windows?.to_s)
|
123
|
+
do_not_perform_the_regular_backup_routine
|
124
|
+
# ===================================================================== #
|
125
|
+
# === rbackup --help
|
126
|
+
#
|
127
|
+
# The user can use this entry point to obtain helpful information in
|
128
|
+
# how to use this class, on the commandline.
|
129
|
+
# ===================================================================== #
|
130
|
+
when /help/i,
|
131
|
+
/^-?-?show(-| |_)?help$/i,
|
132
|
+
'hel',
|
133
|
+
'he','h','?','*'
|
134
|
+
show_help
|
135
|
+
do_not_perform_the_regular_backup_routine
|
136
|
+
# ===================================================================== #
|
137
|
+
# === rbackup --video-dir
|
138
|
+
# ===================================================================== #
|
139
|
+
when /^-?-?video(-| |_)?dir$/i,
|
140
|
+
/^-?-?video(-| |_)?directory$/i,
|
141
|
+
/^-?-?video$/i
|
142
|
+
backup_the_video_directory
|
143
|
+
do_not_perform_the_regular_backup_routine
|
144
|
+
# ===================================================================== #
|
145
|
+
# === rbackup --books
|
146
|
+
#
|
147
|
+
# This entry point allows the user to backup the /home/x/books/
|
148
|
+
# directory.
|
149
|
+
# ===================================================================== #
|
150
|
+
when /^-?-?books$/i,
|
151
|
+
/^-?-?books(-| |_)?directory$/i
|
152
|
+
backup_the_books_directory
|
153
|
+
do_not_perform_the_regular_backup_routine
|
154
|
+
# ===================================================================== #
|
155
|
+
# === rbackup --source-dir
|
156
|
+
# === rbackup --source-directory
|
157
|
+
# === rbackup --source
|
158
|
+
# === rbackup --src-dir
|
159
|
+
# === rbackup --src
|
160
|
+
#
|
161
|
+
# This entry point allows the user to backup the /home/x/src/
|
162
|
+
# directory.
|
163
|
+
# ===================================================================== #
|
164
|
+
when /^-?-?source(-| |_)?dir$/i,
|
165
|
+
/^-?-?source(-| |_)?directory$/i,
|
166
|
+
/^-?-?source$/i,
|
167
|
+
/^-?-?src(-| |_)?dir$/i,
|
168
|
+
/^-?-?src$/i
|
169
|
+
backup_the_source_directory
|
170
|
+
do_not_perform_the_regular_backup_routine
|
171
|
+
# ===================================================================== #
|
172
|
+
# === Backup all relevant entries to the chroot-directory
|
173
|
+
#
|
174
|
+
# This entry point is mostly used for my local Chroot directory. We
|
175
|
+
# will quickly backup the important files to that directory, which
|
176
|
+
# then allows us to cd into a better chroot-environment.
|
177
|
+
#
|
178
|
+
# Invocation examples:
|
179
|
+
#
|
180
|
+
# rbackup --chroot
|
181
|
+
# rbackup --to-chroot
|
182
|
+
#
|
183
|
+
# ===================================================================== #
|
184
|
+
when /^-?-?chroot$/i,
|
185
|
+
/^-?-?to(-| |_)?chroot$/i,
|
186
|
+
/^-?-?into(-| |_)?chroot$/i
|
187
|
+
backup_into_the_default_chroot_directory
|
188
|
+
do_not_perform_the_regular_backup_routine
|
189
|
+
# ===================================================================== #
|
190
|
+
# === rbackup --studium-dir
|
191
|
+
# === rbackup --studium-directory
|
192
|
+
# === rbackup --studium
|
193
|
+
#
|
194
|
+
# This entry point allows the user to backup the /home/x/studium/
|
195
|
+
# directory, by making use of the constant STUDIUM_DIRECTORY.
|
196
|
+
# ===================================================================== #
|
197
|
+
when /^-?-?studium(-| |_)?dir$/i,
|
198
|
+
/^-?-?studium(-| |_)?directory$/i,
|
199
|
+
/^-?-?studium$/i
|
200
|
+
backup_the_studium_directory
|
201
|
+
do_not_perform_the_regular_backup_routine
|
202
|
+
# ===================================================================== #
|
203
|
+
# === rbackup --data-dir
|
204
|
+
# ===================================================================== #
|
205
|
+
when /^-?-?data(-| |_)?dir$/i,
|
206
|
+
/^-?-?data(-| |_)?directory$/i,
|
207
|
+
/^-?-?data$/i,
|
208
|
+
/^-?-?ONLY(-| |_)?DATA$/i,
|
209
|
+
/^-?-?DATA(-| |_)?ONLY$/i,
|
210
|
+
/^-?-?donly$/i
|
211
|
+
backup_the_data_directory_then_exit
|
212
|
+
# ===================================================================== #
|
213
|
+
# === rbackup --system-dir
|
214
|
+
# ===================================================================== #
|
215
|
+
when /^-?-?system(-| |_)?dir$/i,
|
216
|
+
/^-?-?system(-| |_)?directory$/i,
|
217
|
+
/^-?-?system$/i
|
218
|
+
backup_the_system_directory
|
219
|
+
do_not_perform_the_regular_backup_routine
|
220
|
+
# ===================================================================== #
|
221
|
+
# === rbackup --programs-dir
|
222
|
+
#
|
223
|
+
# This entry point can be used to backup /home/Programs/ specifically.
|
224
|
+
# ===================================================================== #
|
225
|
+
when /^-?-?programs(-| |_)?dir$/i,
|
226
|
+
/^-?-?programs$/i
|
227
|
+
backup_the_programs_directory
|
228
|
+
do_not_perform_the_regular_backup_routine
|
229
|
+
# ===================================================================== #
|
230
|
+
# === rbackup default
|
231
|
+
# ===================================================================== #
|
232
|
+
when 'default' # Default entry point is for /Mount/USB1 aka :usb1.
|
233
|
+
set_target_mountpoint(:usb1)
|
234
|
+
# ===================================================================== #
|
235
|
+
# === rbackup --mountpoints
|
236
|
+
# ===================================================================== #
|
237
|
+
when /^-?-?mountpoints/
|
238
|
+
show_available_mountpoints_then_exit
|
239
|
+
# ===================================================================== #
|
240
|
+
# === rbackup --logfile
|
241
|
+
# ===================================================================== #
|
242
|
+
when /^-?-?logfile\??$/i
|
243
|
+
show_the_logfile
|
244
|
+
do_not_perform_the_regular_backup_routine
|
245
|
+
# ===================================================================== #
|
246
|
+
# === rbackup --show-file-size-of-popular_directories
|
247
|
+
# === rbackup --overview
|
248
|
+
# ===================================================================== #
|
249
|
+
when /^-?-?show(-| |_)?file(-| |_)?size(-| |_)?of(-| |_)?popular(-| |_)?directories$/i,
|
250
|
+
/^-?-?overview$/i
|
251
|
+
use_this_array = [
|
252
|
+
return_the_songs_directory,
|
253
|
+
PROGRAMS_DIRECTORY,
|
254
|
+
VIDEO_DIRECTORY,
|
255
|
+
STUDIUM_DIRECTORY,
|
256
|
+
DATA_DIRECTORY,
|
257
|
+
SOURCE_DIRECTORY
|
258
|
+
].map {|entry|
|
259
|
+
return_this_absolute_directory(entry)
|
260
|
+
}
|
261
|
+
use_this_array.each {|this_entry|
|
262
|
+
report_file_size_of(this_entry)
|
263
|
+
}
|
264
|
+
do_not_perform_the_regular_backup_routine
|
265
|
+
# ===================================================================== #
|
266
|
+
# === rbackup --use-this-as-target-for-backup=/opt/
|
267
|
+
# === rbackup --use-this-as-target=/opt/
|
268
|
+
# === rbackup --backup-to=/opt/
|
269
|
+
#
|
270
|
+
# This entry point allows the user to specify another target to
|
271
|
+
# be used from the commandline.
|
272
|
+
# ===================================================================== #
|
273
|
+
when /^-?-?backup(-| |_)?to=(.+)$/i,
|
274
|
+
/^-?-?use(-| |_)?this(-| |_)?as(-| |_)?target=(.+)$/i,
|
275
|
+
/^-?-?use(-| |_)?this(-| |_)?as(-| |_)?target(-| |_)?for(-| |_)?backup=(.+)$/i
|
276
|
+
_ = $2.to_s.dup
|
277
|
+
_ = $4.to_s.dup if $4
|
278
|
+
_ = $6.to_s.dup if $6
|
279
|
+
opnn; e 'The target device will be at '+sfancy(_)+'.'
|
280
|
+
set_target_device(_)
|
281
|
+
# ===================================================================== #
|
282
|
+
# === Use a shorter name for the backup-directory
|
283
|
+
#
|
284
|
+
# This entry point has been created to allow simpler backup onto
|
285
|
+
# NTFS devices. I ran into a problem with a too-long, and special
|
286
|
+
# name for a directory.
|
287
|
+
#
|
288
|
+
# Usage example:
|
289
|
+
#
|
290
|
+
# rbackup --use-shorter-name
|
291
|
+
# rbackup tousb1 --use-shorter-name
|
292
|
+
#
|
293
|
+
# ===================================================================== #
|
294
|
+
when /^-?-?use(-| |_)?shorter(-| |_)?name$/i,
|
295
|
+
/^-?-?windows$/i,
|
296
|
+
/^-?-?sane-symlink$/i
|
297
|
+
do_use_simplified_directory
|
298
|
+
# ===================================================================== #
|
299
|
+
# === rbackup --pwd
|
300
|
+
# ===================================================================== #
|
301
|
+
when /^-?-?pwd$/i
|
302
|
+
current_directory = (Dir.pwd+'/').squeeze('/')
|
303
|
+
set_target_mountpoint(current_directory)
|
304
|
+
# ===================================================================== #
|
305
|
+
# === rbackup --autogenerated
|
306
|
+
# ===================================================================== #
|
307
|
+
when /^-?-?autogen$/,
|
308
|
+
'agen',
|
309
|
+
'autog',
|
310
|
+
/^-?-?autogenerated$/i
|
311
|
+
determine_whether_the_target_harddisc_is_a_ntfs_system
|
312
|
+
try_to_backup_the_autogenerated_directory
|
313
|
+
do_not_perform_the_regular_backup_routine
|
314
|
+
else # else tag
|
315
|
+
# =================================================================== #
|
316
|
+
# === Backup an existing directory
|
317
|
+
#
|
318
|
+
# This entry point allows us to quickly backup an existing
|
319
|
+
# directory.
|
320
|
+
#
|
321
|
+
# Usage example:
|
322
|
+
#
|
323
|
+
# rbackup /home/x/data/rpg/
|
324
|
+
#
|
325
|
+
# =================================================================== #
|
326
|
+
if File.directory?(i)
|
327
|
+
i = File.absolute_path(i)
|
328
|
+
i << '/' unless i.end_with? '/'
|
329
|
+
new_target = @mountpoint.squeeze('/')
|
330
|
+
cpr(i, new_target)
|
331
|
+
all_done_message
|
332
|
+
do_not_perform_the_regular_backup_routine
|
333
|
+
# =================================================================== #
|
334
|
+
# === Backup individual .h files quickly
|
335
|
+
#
|
336
|
+
# This is a short circuit action here - we just backup an existing
|
337
|
+
# .h file quickly.
|
338
|
+
#
|
339
|
+
# Invocation example:
|
340
|
+
#
|
341
|
+
# rbackup /usr/include/xvid.h
|
342
|
+
#
|
343
|
+
# =================================================================== #
|
344
|
+
elsif File.exist?(i) and i.end_with?('.h')
|
345
|
+
base_directory = '/BACKUP/include/'
|
346
|
+
verbose_create_a_directory_at_this_position(base_directory)
|
347
|
+
target = "#{base_directory}#{File.basename(i)}"
|
348
|
+
opnn; e "Backing up towards `#{sfile(target)}` (a mere copy operation)."
|
349
|
+
copy_file(i, target)
|
350
|
+
do_not_perform_the_regular_backup_routine
|
351
|
+
else
|
352
|
+
if i and i.start_with?('--')
|
353
|
+
e "Option #{i} was not found. Exiting now."
|
354
|
+
exit
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
end; end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/utility_scripts/backup/run.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
class Backup < ::BackupParadise::Base # === BackupParadise::Backup
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === run (run tag)
|
13
|
+
# ========================================================================= #
|
14
|
+
def run
|
15
|
+
sanitize_the_commandline_arguments
|
16
|
+
menu
|
17
|
+
do_perform_the_backup_tasks if perform_the_regular_backup_routine?
|
18
|
+
end
|
19
|
+
|
20
|
+
end; end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/version/version.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === VERSION
|
11
|
+
# ========================================================================= #
|
12
|
+
VERSION = '1.2.40'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === LAST_UPDATE
|
16
|
+
# ========================================================================= #
|
17
|
+
LAST_UPDATE = '09.09.2022'
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This directory may contain code that we will use on windows.
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/windows/windows.rb'
|
6
|
+
# BackupParadise::Windows.backup_ingrid_directory
|
7
|
+
# =========================================================================== #
|
8
|
+
module BackupParadise
|
9
|
+
|
10
|
+
module Windows # === BackupParadise::Windows
|
11
|
+
|
12
|
+
require 'fileutils'
|
13
|
+
require 'backup_paradise/toplevel_methods/misc.rb'
|
14
|
+
|
15
|
+
alias e puts
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === BackupParadise::Windows.e
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.e(i = '')
|
21
|
+
puts i
|
22
|
+
end
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# === BackupParadise::Windows.return_the_current_time
|
26
|
+
# ========================================================================= #
|
27
|
+
def self.return_the_current_time
|
28
|
+
Time.now.strftime('%d.%m.%Y')
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === BackupParadise.do_use_fileutils_for_the_copy_action
|
33
|
+
# ========================================================================= #
|
34
|
+
def self.do_use_fileutils_for_the_copy_action
|
35
|
+
BackupParadise::CONFIG['use_system_cp'] = false
|
36
|
+
end
|
37
|
+
|
38
|
+
# ========================================================================= #
|
39
|
+
# === BackupParadise::Windows.backup_ingrid_directory
|
40
|
+
#
|
41
|
+
# This will try to backup c:\\ingrid\. It only works on windows really.
|
42
|
+
#
|
43
|
+
# The trailing '.' is necessary, so that the content of the directory
|
44
|
+
# is copied, rather than the directory itself and THEN its content.
|
45
|
+
# ========================================================================= #
|
46
|
+
def self.backup_ingrid_directory(
|
47
|
+
from = 'c://ingrid/.',
|
48
|
+
to = :infer_the_first_external_device
|
49
|
+
)
|
50
|
+
case to
|
51
|
+
# ======================================================================= #
|
52
|
+
# === :infer_the_first_external_device
|
53
|
+
#
|
54
|
+
# Here we will infer which external device is the first one.
|
55
|
+
# ======================================================================= #
|
56
|
+
when :infer_the_first_external_device
|
57
|
+
begin
|
58
|
+
require 'mountpoints'
|
59
|
+
rescue LoadError; end
|
60
|
+
if Object.const_defined? :Mountpoints
|
61
|
+
to = Mountpoints[]
|
62
|
+
else # else we will use a hardcoded approach.
|
63
|
+
e 'Assuming a hardcoded path at: e://'
|
64
|
+
to = "e://"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
if to.is_a? Array
|
68
|
+
to = to.first
|
69
|
+
end
|
70
|
+
unless to.include? '_'
|
71
|
+
from = from.to_s.dup
|
72
|
+
from.chop! if from.end_with? '/'
|
73
|
+
if from.start_with?('c://') and BackupParadise.are_we_on_linux?
|
74
|
+
from[0,4] = ''
|
75
|
+
end
|
76
|
+
_ = to.to_s+
|
77
|
+
File.basename(from.to_s.delete('.'))+ # We remove '.' to avoid "ingrid/." stuff.
|
78
|
+
'_'+
|
79
|
+
return_the_current_time
|
80
|
+
_ = _.squeeze '/'
|
81
|
+
e 'Now creating the directory '+_+'.'
|
82
|
+
FileUtils.mkdir_p(_)
|
83
|
+
to = _
|
84
|
+
end
|
85
|
+
if File.directory?(from) and !from.end_with?('/', '.')
|
86
|
+
from = from.dup if from.frozen?
|
87
|
+
from << '/'
|
88
|
+
end
|
89
|
+
if File.directory?(to) and !to.end_with?('/')
|
90
|
+
to = to.dup if to.frozen?
|
91
|
+
to << '/'
|
92
|
+
end
|
93
|
+
do_use_fileutils_for_the_copy_action
|
94
|
+
BackupParadise.simple_backup(from, to)
|
95
|
+
end
|
96
|
+
|
97
|
+
end; end
|
98
|
+
|
99
|
+
if __FILE__ == $PROGRAM_NAME
|
100
|
+
BackupParadise::Windows.backup_ingrid_directory
|
101
|
+
end # backupingriddirectory
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This file may also mix non-objectified HTML tags.
|
6
|
+
# =========================================================================== #
|
7
|
+
# http://localhost/programming/ruby/src/cyberweb/examples/advanced/hybrid_experiment.cgi
|
8
|
+
# =========================================================================== #
|
9
|
+
require 'cyberweb/requires/require_objectified_html_tags_files.rb'
|
10
|
+
require 'cyberweb/requires/require_the_toplevel_methods_files.rb'
|
11
|
+
require 'cyberweb/requires/require_the_html_template.rb'
|
12
|
+
require 'cyberweb/web_images/map_symbol_to_image_location.rb'
|
13
|
+
require 'cyberweb/javascript/drag_and_drop.rb'
|
14
|
+
require 'cyberweb/toplevel_methods/jquery.rb'
|
15
|
+
require 'backup_paradise'
|
16
|
+
|
17
|
+
alias ee print
|
18
|
+
|
19
|
+
Cyberweb.require_objectified_html_tags_files
|
20
|
+
Cyberweb.require_toplevel_methods_files
|
21
|
+
|
22
|
+
include Cyberweb::Objectified::HtmlTags
|
23
|
+
include Cyberweb
|
24
|
+
|
25
|
+
ee "Content-type: text/html\n\n"
|
26
|
+
ee '<html><head>'
|
27
|
+
|
28
|
+
Title.report('Backup-related actions')
|
29
|
+
ee '<style>'
|
30
|
+
ee Cyberweb.return_content_of_all_the_CSS_files
|
31
|
+
ee '</style>'
|
32
|
+
ee Cyberweb.return_jquery_string
|
33
|
+
ee '</head>'
|
34
|
+
ee '<body class="mar4px">'
|
35
|
+
|
36
|
+
ee Cyberweb.params?
|
37
|
+
# =========================================================================== #
|
38
|
+
# Hello world div:
|
39
|
+
# =========================================================================== #
|
40
|
+
ee '<form method="POST" id="backup_form" name="backup_form" class="FS1_5em mars1em mart1em" action="">'
|
41
|
+
|
42
|
+
ee 'Backup c:\ingrid\\<br><br>'
|
43
|
+
_ = submit_button
|
44
|
+
_.name = 'do_backup_for_ingrid'
|
45
|
+
_.value = 'Do backup c:\ingrid\\'
|
46
|
+
_.bblack2
|
47
|
+
_.css_class 'pad8px mar4px mars2em FS1_3em'
|
48
|
+
_.style 'border: 3px dotted tomato'
|
49
|
+
_.report
|
50
|
+
# ee '<img src="../../../../../../../data/images/'+Cyberweb.get_webimage(:backup_image)+'">'
|
51
|
+
ee '<input name="do_backup_for_ingrid" type="image" src="../../../../../../../data/images/'+
|
52
|
+
Cyberweb.get_webimage(:backup_image)+'" border="0" alt="Submit"/>'
|
53
|
+
|
54
|
+
# <form class="spacer" action="" method="post">
|
55
|
+
# <input class="submit" type="submit" value="Submit" />
|
56
|
+
# </form>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
ee '</form>'
|
61
|
+
|
62
|
+
ee '</body>'
|
63
|
+
ee '</html>'
|