mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Mostly var cleanup across ~80 files
This commit is contained in:
parent
a6112381a3
commit
814efd5a02
88 changed files with 679 additions and 260 deletions
15
roles/usb_lib/templates/content_dir.conf
Normal file
15
roles/usb_lib/templates/content_dir.conf
Normal file
|
@ -0,0 +1,15 @@
|
|||
# configure for local content
|
||||
|
||||
Alias /content {{ doc_root }}/local_content
|
||||
Alias /local_content {{ doc_root }}/local_content
|
||||
Alias /USB {{ doc_root }}/local_content
|
||||
Alias /usb {{ doc_root }}/local_content
|
||||
|
||||
<Directory {{ doc_root }}/local_content>
|
||||
Require all granted
|
||||
Options +Indexes
|
||||
IndexOptions FancyIndexing
|
||||
IndexOptions HTMLTable
|
||||
IndexOptions SuppressColumnsorting
|
||||
IndexOptions Charset=UTF-8
|
||||
</Directory>
|
5
roles/usb_lib/templates/iiab-usb_lib-show-all-off
Normal file
5
roles/usb_lib/templates/iiab-usb_lib-show-all-off
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# turn on the flag which registers new USB sticks at root directory
|
||||
|
||||
sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=False/' {{ iiab_env_file }}
|
||||
|
5
roles/usb_lib/templates/iiab-usb_lib-show-all-on
Normal file
5
roles/usb_lib/templates/iiab-usb_lib-show-all-on
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# turn on the flag which registers new USB sticks at root directory
|
||||
|
||||
sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=True/' {{ iiab_env_file }}
|
||||
|
60
roles/usb_lib/templates/mount.d/70-usb-library
Normal file
60
roles/usb_lib/templates/mount.d/70-usb-library
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
# Create symlink in DocumentRoot/content to autmounted usb drive
|
||||
#
|
||||
# based on a similar script in the xs-rsync package
|
||||
# by Martin Langhoff <martin@laptop.org>
|
||||
#
|
||||
# and the adaptation for xs-activity-server by Douglas Bagnall
|
||||
# <douglas@paradise.net.nz>
|
||||
#
|
||||
# by Tim Moody tim@timmoody.com
|
||||
|
||||
source {{ iiab_env_file }}
|
||||
case $IIAB_USB_LIB_SHOW_ALL in
|
||||
'True'|'true'|'TRUE')
|
||||
logger -p user.notice -t "70-usb-library" -- "Displaying root directory on $UM_MOUNTPOINT."
|
||||
# regularize the variable
|
||||
IIAB_USB_LIB_SHOW_ALL=True
|
||||
;;
|
||||
*)
|
||||
logger -p user.notice -t "70-usb-library" -- "Looking for /share, /Share, /Piratebox/Share, /USB, or /usb on $UM_MOUNTPOINT."
|
||||
;;
|
||||
esac
|
||||
|
||||
VERBOSE=yes
|
||||
|
||||
SHARE_DIR=""
|
||||
# Only show content if in these directories
|
||||
|
||||
if [ -d $UM_MOUNTPOINT/share ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT/share"
|
||||
fi
|
||||
if [ -d $UM_MOUNTPOINT/Share ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT/Share"
|
||||
fi
|
||||
if [ -d $UM_MOUNTPOINT/Piratebox/Share ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT/Piratebox/Share"
|
||||
fi
|
||||
if [ -d $UM_MOUNTPOINT/USB ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT/USB"
|
||||
fi
|
||||
if [ -d $UM_MOUNTPOINT/usb ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT/usb"
|
||||
fi
|
||||
if [ "$IIAB_USB_LIB_SHOW_ALL" == "True" ]; then
|
||||
SHARE_DIR="$UM_MOUNTPOINT"
|
||||
fi
|
||||
|
||||
if [ ! -z "$SHARE_DIR" ]; then
|
||||
logger -p user.notice -t "70-usb-library" -- "Found Share Directory $SHARE_DIR."
|
||||
else
|
||||
logger -p user.notice -t "70-usb-library" -- "did not find /share, /Share, /Piratebox/Share, /USB, or /usb on USB"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$SHARE_DIR" != "" ];then
|
||||
CONTENT_LINK_USB=`basename $UM_MOUNTPOINT | awk '{print toupper($0)}'`
|
||||
CONTENT_LINK="{{ doc_root }}/local_content/$CONTENT_LINK_USB"
|
||||
logger -p user.notice -t "70-usb-library" -- "Creating link to $CONTENT_LINK."
|
||||
ln -s $SHARE_DIR $CONTENT_LINK
|
||||
fi
|
24
roles/usb_lib/templates/umount.d/70-usb-library
Normal file
24
roles/usb_lib/templates/umount.d/70-usb-library
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# Remove symlink in /library/content to autmounted usb drive
|
||||
#
|
||||
# based on a similar script in the xs-rsync package
|
||||
# by Martin Langhoff <martin@laptop.org>
|
||||
#
|
||||
# and the adaptation for xs-activity-server by Douglas Bagnall
|
||||
# <douglas@paradise.net.nz>
|
||||
#
|
||||
# by Tim Moody tim@timmoody.com
|
||||
|
||||
CONTENT_LINK_USB=`basename $UM_MOUNTPOINT | awk '{print toupper($0)}'`
|
||||
CONTENT_LINK="{{ doc_root }}/local_content/$CONTENT_LINK_USB"
|
||||
|
||||
logger -p user.notice -t "70-usb-library" -- "Attempting to remove link $CONTENT_LINK."
|
||||
|
||||
if [ -L $CONTENT_LINK ]; then
|
||||
{% if is_debuntu %}
|
||||
/bin/rm $CONTENT_LINK
|
||||
{% else %}
|
||||
/usr/bin/rm $CONTENT_LINK
|
||||
{% endif %}
|
||||
logger -p user.notice -t "70-usb-library" -- "$CONTENT_LINK removed."
|
||||
fi
|
5
roles/usb_lib/templates/usbmount.rules.j2
Normal file
5
roles/usb_lib/templates/usbmount.rules.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
|
||||
KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
|
||||
KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
|
||||
KERNEL=="sd*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove"
|
||||
|
12
roles/usb_lib/templates/usbmount@.service.j2
Normal file
12
roles/usb_lib/templates/usbmount@.service.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
BindTo=%i.device
|
||||
After=%i.device
|
||||
After=rc-local.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
TimeoutStartSec=0
|
||||
Environment=DEVNAME=%I
|
||||
ExecStart=/usr/share/usbmount/usbmount add
|
||||
RemainAfterExit=yes
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue