-
Notifications
You must be signed in to change notification settings - Fork 20
/
README
499 lines (334 loc) · 14.5 KB
/
README
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
___ /\ ___
__/ /_ / \ _\ \__
____ _____/_ __/__ / _/\ ___ ___ ____ ______ __\__ _\
/ \ / / // // \ /\_/ \ / / \ / \\ \ \ / \\ \
/ / // / // // / // \\ \ \ \\ \ \\ \ \\ \ \\ \_
\_____\\____/ \__\\____//__________\\__\__\__\\____/ \_____\\__\__\\___\
The 'automount' is a devd(8) based automounter for FreeBSD.
It supports most popular file systems:
NTFS/MSDOS/exFAT/EXT2/EXT3/EXT4/UFS/XFS/HFS/MTP/ISO9660
-------------------------------------------------------------------------------
I N S T A L L
===================
Use provided FreeBSD Ports/packages from here:
* sysutils/automount
.. or make manual unstallation:
# cp automount.conf /usr/local/etc/automount.conf
# cp automount_devd.conf /usr/local/etc/devd/automount_devd.conf
# cp automount /usr/local/sbin/automount
# chmod +x /usr/local/sbin/automount
# /etc/rc.d/devd restart
Now plugin Your USB thumb drive and have fun ;)
These ports/packages are needed for all filesystems:
* sysutils/e2fsprogs // EXT2/EXT3/EXT4 fsck(8)
* sysutils/xfsprogs // XFS fsck(8)
* sysutils/exfat-utils // exFAT exfatfsck(8)
* sysutils/fusefs-exfat // exFAT
* sysutils/fusefs-ntfs // NTFS (read write support)
* sysutils/fusefs-hfsfuse // HFS
* sysutils/fusefs-lkl // XFS/EXT2/EXT3/EXT4
* sysutils/fusefs-simple-mtpfs // MTP
All of the above are available as pkg(8) packages.
Shortcut:
# pkg install -y \
sysutils/e2fsprogs \
sysutils/xfsprogs \
sysutils/exfat-utils \
sysutils/fusefs-exfat \
sysutils/fusefs-ntfs \
sysutils/fusefs-hfsfuse \
sysutils/fusefs-lkl \
sysutils/fusefs-simple-mtpfs
-------------------------------------------------------------------------------
C H A N G E L O G
=========================
VERSION 1.7.9 (CURRENT)
Fix XORG detection.
Implement proposed BLACKLIST_REGEX option.
Use 'sysutils/fusefs-lkl' for all ext2/ext3/ext4 mounts.
Fix exFAT detection.
Fix small problem with checking the mount state.
Implement better old directory cleanup.
-------------------------------------------------------------------------------
VERSION 1.7.8
Fix harmless gpart(8) rant about ugen(4) devices.
-------------------------------------------------------------------------------
VERSION 1.7.7
Add option to ignore system partitions like EFI or MSR.
Fix removal of dirs from unmounted filesystems.
Fix mount permissions for FAT filesystems.
Add spaces and comments in the code.
-------------------------------------------------------------------------------
VERSION 1.7.6
Added UZIP images support.
Added another try to mount device in read only mode.
Added optional ada(4) disks support.
Added optional md(4) devices support.
Added automatic kernel modules loading.
-------------------------------------------------------------------------------
VERSION 1.7.5
Add REMOVEDIRS option as default.
Add NICENAMES option to use labels instead of device names.
Use procstat(1) for faster DISPLAY environemnt searching.
-------------------------------------------------------------------------------
VERSION 1.7.4
Add new logo.
-------------------------------------------------------------------------------
VERSION 1.7.3
Use 755 permissions for FAT mounts.
-------------------------------------------------------------------------------
VERSION 1.7.2
Phase out support for sysutils/fusefs-ext4fuse port.
Fix UMASK for exFAT filesystems.
Fix ISO9660 mount options.
-------------------------------------------------------------------------------
VERSION 1.7.1
Fix exFAT mount rights.
Use USER option in config file.
Make MTP detection and mount better.
-------------------------------------------------------------------------------
VERSION 1.7.0
The automount has now a new co-author - Rozhuk Ivan.
New options available in automount.conf config file.
Filesystem detection/mounting reworked totally with file(1)/dd(1)/fstyp(8) as backends.
Notifications are now possible with libnotify.
Automatic detection of DISPLAY variable.
New automatic wait for device appearance.
New detection if device is a block device.
Introduction of CD-ROM support.
Automatic detection of File Manager with exo-open(1).
Option REMOVEDIRS is deprecated now.
Handle '-o large' option for FAT under FreeBSD 11.x and 12.x versions.
-------------------------------------------------------------------------------
VERSION 1.6.1
Fix MBR/msdosfs partition unmount issue.
-------------------------------------------------------------------------------
VERSION 1.6.0
Fix long boot with devd(8) because of ugen(4) devices.
Add fsck.exfat to the exFAT filesystem.
Set fsck.ext2 instead of e2fsck to the ext2 filesystem.
Set fsck.ext3 instead of e2fsck to the ext3 filesystem.
Set fsck.ext4 instead of e2fsck to the ext4 filesystem.
-------------------------------------------------------------------------------
VERSION 1.5.9
Decrease DELAY for sleep from '1' to '0.1' for faster mounting.
Remove __random_wait() at 'attach'.
Implement MTP mounting.
Added XFS and HFS support.
Various fixes and cleanups.
Remove '-o large' option for FAT (not supported on FreeBSD 12).
-------------------------------------------------------------------------------
VERSION 1.5.8
Omit GVFS filesystem in the mount(8) listing.
Improve exFAT mount options.
Add mount_msdosfs(8) fallback fix.
Set caja as file manager in example config.
Add version argument.
-------------------------------------------------------------------------------
VERSION 1.5.7
Fix FAT32 mount.
Add extended options for EXFAT mounts.
Add -version option.
-------------------------------------------------------------------------------
VERSION 1.5.6
Implement --version option.
-------------------------------------------------------------------------------
VERSION 1.5.5
Rework NTFS/MSDOS/FAT detection.
Check for NTFS before FAT.
-------------------------------------------------------------------------------
VERSION 1.5.4
Added notification via notify-send/libnotify and wall(1). Minor bug fix.
Change 'boot sector' detection.
-------------------------------------------------------------------------------
VERSION 1.5.3
Fix small harmless bug - variable WAIT without default value.
-------------------------------------------------------------------------------
VERSION 1.5.2
Introduce smarter fstype() function to better determine filesystem.
-------------------------------------------------------------------------------
VERSION 1.5.1
Add -k flag to file(1) command.
Set new --version and date(1).
-------------------------------------------------------------------------------
VERSION 1.5.0
Add new NTFS options.
Add nested NTFS mount attempt.
Fix devd(8) config.
Improve log messages.
Use random wait only on ATTACH action, not needed on DETACH action.
Implement random wait to eliminate race.
Implement BOOTDELAY option to wait for boot process to complete.
Fix devd(8) config (LARKIND) to match all needed devices and their partitions.
Fix typo in NTFS error message.
-------------------------------------------------------------------------------
VERSION 1.4.3
Only style(9) changes.
Force longnames option for msdosfs.
Remove -u option for debug.
Fix a bug when ATIME is enabled.
Add -o remove_hiberfile to NTFS-3G mount options.
Fix typo at /var/log/automount.log error message.
Use /sbin/e2fsck from FreeBSD base system.
Fix typo at /var/log/automount.log error message.
Force longnames option for msdosfs.
-------------------------------------------------------------------------------
VERSION 1.4.2
Implement active sleep/wait for devices that could not appear.
Add more useful information to /var/log/automount.log file.
Implement BLACKLIST option to ignore problematic devices.
-------------------------------------------------------------------------------
VERSION 1.4.1
Improved checking for already mounted devices.
More readable log format.
Added logging of fsck(8) output.
Added adding setuid also to /sbin/mount* when USERUMOUNT set to YES.
Added error logging of failed mounts.
-------------------------------------------------------------------------------
VERSION 1.4.0
Wait for smartphone to attach device, rewrite all &&-|| into if-then-else-fi syntax.
-------------------------------------------------------------------------------
VERSION 1.3.1
Fixed the 'detach' section (s/PREFIX/MNTPREFIX/g).
Fixed removing directories of manually (properly) unmounted filesystems.
-------------------------------------------------------------------------------
VERSION 1.3
Fixed inproper exFAT detection, now mounts fine.
Fixed creating mount dirs for attached devices no matter if needed or not.
Revised 'detach' section, now removes only directory that is unmounted.
Simplified FAT/NTFS sections, removed additional checks as they break
some MP3 players automount.
-------------------------------------------------------------------------------
VERSION 1.2.1
Added the --help page.
Removed some small bugs.
Added more options to configure features.
% /usr/local/sbin/automount --help
AUTOMOUNT is a devd(8) based automounter for FreeBSD.
It supports following file systems:
UFS/FAT/exFAT/NTFS/EXT2/EXT3/EXT4/MTP/HFS/ISO9660
Add these to mount NTFS/exFAT/EXT4/HFS/XFS/MTP respectively:
o sysutils/fusefs-ntfs
o sysutils/fusefs-exfat
o sysutils/fusefs-ext4fuse
o sysutils/fusefs-hfsfuse
o sysutils/fusefs-lkl
o sysutils/fusefs-simple-mtpfs
By default it mounts/unmounts all removable media but
it is possible to set some additional options at the
/usr/local/etc/automount.conf config file.
Below is a list of possible options with description.
MNT_PREFIX (set to /media by default)
With this options You can alter the default root
for mounting the removable media, for example to
the /mnt directory.
example: MNT_PREFIX='/media'
MNT_GROUP (wheel by default)
If set to some group name, the mount command will
chown(1) the mount directory with the group.
example: group='operator'
MNT_MODE (set to 775 by default)
Value for chmod on mount point.
FAT_ENCODING (set to en_US.UTF-8 by default)
Only used with FAT32 mounts, specifies which
encoding to use at the mount.
example: FAT_ENCODING='en_US.ISO8859-1'
FAT_CODEPAGE (set to CP866 by default)
Only used with FAT32 mounts, specifies which
code page to use at the mount.
example: FAT_CODEPAGE='cp437'
ISO9660_CODEPAGE (set to UTF-8 by default)
Only used with cd9660 mounts, specifies which
code page to use at the mount.
ATIME (set to NO by default)
When set to NO it will mount filesystems with
noatime option when possible.
example: ATIME='YES'
RETRY_COUNT (set to 3 by default)
How many times try to get file system type or try to mount.
example: RETRY_COUNT='1'
RETRY_DELAY (set to 1 second by default)
Delay beetwin retry attempt.
example: RETRY_DELAY='2.5'
USERUMOUNT (set to NO by default)
When set to YES it will 'chmod +s /sbin/umount'
which would allow an USER to unmount the file
system with their selected file manager.
example: USERUMOUNT='YES'
NOTIFY (set to NO by default)
Use 'notify-send' and 'libnotify' to show notifications
of mounting and unmounting devices on the desktop.
example: NOTIFY='YES'
WALL (set to NO by default)
Use wall(1) to show notifications of mounting and
unmounting devices on terminals of logged in users.
example: WALL='YES'
FM ('exo-open --launch FileManager' by default)
If set to file manager command, the mount will
launch the specified command after successful
mount. Works only if USER parameter is also set.
example: FM='nautilus --browser --no-desktop'
BLACKLIST (unset by default)
The automount will ignore devices defined here.
example: BLACKLIST='da0 da3s1a'
USER (root by default)
If set to some username, the mount command will
chown(1) the mount directory with the user and
its primary user group. If used with FM option
allows to launch the specified file manager after
a successful mount.
example: USER="vermaden"
-------------------------------------------------------------------------------
VERSION 1.2
FAT/NTFS detection improvements.
The 'chown' now uses sets user's group.
MSDOS filesystem is now mounted with -m 644 -M 755 options by default.
Removed POPUP=YES option, just use USER + FM for simplicity.
NTFS filesystem, when mounted by mount_ntfs(8) uses -u and -g options.
Even more simplified 'detach' section.
------------------------------------------------------------------------------
VERSION 1.1
I removed the state_lock and stat_unlock mechanisms as they appeared to be
not needed, I have shufled with 3 drives all the time and the 'integrity'
has not been lost, at it was a lot faster, because the lock always had to
wait for the 'slowest' drive (in term of initializing the device, like USB
hard drive).
I simplified the 'attach' section a lot, now each filesystem contains only
check/fsck (if possible), mount and log info.
I also simplified and improved the 'detach' section a little.
I added an option to automatically launch the set-up in config file manager.
These are options that I currently successfully use for NAUTILUS file
manager. You need to set-up all three of them to make it work.
| POPUP=YES
| FM="nautilus --browser --no-desktop"
| USER=vermaden
My whole config looks like that now:
| USERUMOUNT=YES
| POPUP=YES
| FM="nautilus --browser --no-desktop"
| USER=vermaden
| ENCODING=pl_PL.ISO8859-2
| CODEPAGE=cp852
All latest updates are available at GITHUB repository:
https://github.com/vermaden/automount
------------------------------------------------------------------------------
VERSION 1.0
AUTOMOUNT is devd(8) based flexible yet very simple automounter for FreeBSD.
Currently it supports these file systems:
-- NTFS requires sysutils/fusefs-ntfs for R/W
-- FAT/FAT32
-- exFAT requires sysutils/fusefs-exfat
-- EXT2
-- EXT3
-- EXT4 requires sysutils/fusefs-ext4fuse
-- UFS
It keeps state of the mounted devices at /var/run/automount.state and logs
all activities to /var/log/automount.log file.
The place for the script is at /usr/local/sbin/automount.sh executable.
The only additional configuration it requires is to add these lines as
/usr/local/etc/devd/automount_devd.conf file, which would allow it to work.
Remember to restart /etc/rc.d/devd daemon after adding
/usr/local/etc/devd/automount_devd.conf file.
------------------------------------------------------------------------------
Have Fun ;)
vermaden