1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/hibernate/common.conf Thu Feb 27 17:12:59 2014 +0100
1.3 @@ -0,0 +1,176 @@
1.4 +# Configuration options common for suspending to disk or RAM.
1.5 +# Options are not case sensitive.
1.6 +#
1.7 +# See hibernate.conf(5) for help on the configuration items.
1.8 +
1.9 +##############################################################################
1.10 +### Some global settings
1.11 +##############################################################################
1.12 +
1.13 +Verbosity 0
1.14 +LogFile /var/log/hibernate.log
1.15 +LogVerbosity 1
1.16 +# LogTimestamp yes
1.17 +# AlwaysForce yes
1.18 +# AlwaysKill yes
1.19 +# HibernateVT 15
1.20 +Distribution debian
1.21 +# XDisplay :0
1.22 +
1.23 +##############################################################################
1.24 +### Scriptlets
1.25 +### Scriptlets provide support for doing all sorts of things before and after
1.26 +### suspending. The defaults settings here should work for most people, but
1.27 +### you may wish to edit these to taste. Consult "hibernate -h" for help on
1.28 +### the configuration settings.
1.29 +##############################################################################
1.30 +
1.31 +### bootsplash
1.32 +## If you use bootsplash, also enabling SwitchToTextMode is recommended if
1.33 +## you use X, otherwise you may end up with a garbled X display.
1.34 +# Bootsplash on
1.35 +# BootsplashConfig /etc/bootsplash/default/config/bootsplash-1024x768.cfg
1.36 +
1.37 +### clock
1.38 +SaveClock restore-only
1.39 +#DirectIsa
1.40 +
1.41 +### devices
1.42 +# IncompatibleDevices /dev/dsp /dev/video*
1.43 +
1.44 +### diskcache
1.45 +# DisableWriteCacheOn /dev/hda
1.46 +
1.47 +### fbsplash (enable SwitchToTextMode if you use this)
1.48 +# FBSplash on
1.49 +# FBSplashTheme tuxonice
1.50 +
1.51 +### filesystems
1.52 +# Unmount /nfsshare /windows /mnt/sambaserver
1.53 +# UnmountFSTypes smbfs nfs
1.54 +# UnmountGraceTime 1
1.55 +# Mount /windows
1.56 +
1.57 +### grub
1.58 +# ChangeGrubMenu yes
1.59 +# GrubMenuFile /boot/grub/grub.cfg
1.60 +# AlternateGrubMenuFile /boot/grub/grub-suspended.cfg
1.61 +# BackupGrubMenuFile /var/backups/grub.cfg.hibernate
1.62 +
1.63 +# see http://bugs.debian.org/317479
1.64 +# RemountXFSBoot yes
1.65 +
1.66 +### hardware_tweaks
1.67 +# IbmAcpi yes
1.68 +# RadeonTool yes
1.69 +# Runi915resolution yes
1.70 +# FullSpeedCPU yes
1.71 +
1.72 +### lilo
1.73 +# EnsureLILOResumes yes
1.74 +
1.75 +### lock (generally you only want one of the following options)
1.76 +## For console you need vlock available.
1.77 +## For x you need xscreensaver-command-command available.
1.78 +## For gnome you need gnome-screensaver-command available.
1.79 +## For kde you need dcop, kscreensaver available.
1.80 +## For XAuto you need xautolock available.
1.81 +## For Xtr you need xtrlock available.
1.82 +## For Freedesktop (for example KDE4) you need dbus-send available
1.83 +# LockConsoleAs root
1.84 +# LockXScreenSaver yes
1.85 +# LockGnomeScreenSaver yes
1.86 +# LockFreedesktop
1.87 +# LockKDE yes
1.88 +# LockXLock yes
1.89 +# LockXAutoLock yes
1.90 +# LockXtrLock yes
1.91 +
1.92 +### misclaunch
1.93 +# OnSuspend 20 echo "Good night!"
1.94 +# OnResume 20 echo "Good morning!"
1.95 +
1.96 +### modules
1.97 +# UnloadModules snd_via82cxxx usb-ohci
1.98 +# UnloadAllModules yes
1.99 +UnloadBlacklistedModules yes
1.100 +LoadModules auto
1.101 +# LoadModulesFromFile /etc/modules
1.102 +
1.103 +### modules-gentoo
1.104 +# GentooModulesAutoload yes
1.105 +
1.106 +### network
1.107 +# DownInterfaces eth0
1.108 +# UpInterfaces auto
1.109 +
1.110 +### networkmanager
1.111 +# EnableNMReconnect yes
1.112 +
1.113 +### wicd
1.114 +# EnableWICDReconnect yes
1.115 +
1.116 +### pause_audio
1.117 +# MuteAudio yes
1.118 +# PauseAudio yes
1.119 +
1.120 +### pcmcia
1.121 +# EjectCards yes
1.122 +
1.123 +### programs
1.124 +# IncompatiblePrograms xmms
1.125 +
1.126 +### services
1.127 +# RestartServices laptop-mode anacron
1.128 +# StopServices alsasound
1.129 +# StartServices aumix
1.130 +
1.131 +### vbetool
1.132 +# EnableVbetool yes
1.133 +# RestoreVbeStateFrom /var/lib/vbetool/vbestate
1.134 +# VbetoolPost yes
1.135 +# RestoreVCSAData yes
1.136 +
1.137 +### xhacks
1.138 +SwitchToTextMode yes
1.139 +# UseDummyXServer yes
1.140 +# DummyXServerConfig xorg-dummy.conf
1.141 +
1.142 +### xstatus
1.143 +## This can be set to gnome, kde or x:
1.144 +## For gnome you need zenity available.
1.145 +## For kde you need dcop, kstart, kdialog available.
1.146 +## For x you need to have xosd OR xmessage available.
1.147 +# XStatus gnome
1.148 +# XmessageDisable yes
1.149 +# XSuspendText Preparing to suspend...
1.150 +# XResumeText Resuming from suspend...
1.151 +## When using XStatus x, and you have xosd installed:
1.152 +# XosdSettings --font '-misc-fixed-medium-r-semicondensed--*-120-*-*-c-*-*-*' --colour=Green --shadow 1 --pos bottom --align center --offset 50
1.153 +
1.154 +### xbacklight
1.155 +# BackLight yes
1.156 +
1.157 +### gaim
1.158 +## You need to have dbus, gaim_remote available.
1.159 +# LogoutGaim yes
1.160 +# GaimRestoreStatus yes
1.161 +# GaimLogoutMessage Hibernating
1.162 +# GaimLoginMessage Back from hibernation
1.163 +
1.164 +### pidgin
1.165 +# LogoutPidgin yes
1.166 +# PidginRestoreStatus yes
1.167 +# PidginLogoutMessage Hibernating - bye!
1.168 +# PidginLoginMessage I'm back!
1.169 +
1.170 +### SSH and PGP keys
1.171 +# AgentsClearGPG yes
1.172 +# AgentsClearSSH yes
1.173 +
1.174 +### Virtualbox
1.175 +# SuspendVirtualbox yes
1.176 +
1.177 +# osecvm
1.178 +StopServices vboxadd-service vboxadd rc.local
1.179 +StartServices vboxadd vboxadd-service rc.local
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/init.d/osecfs_downloads Thu Feb 27 17:12:59 2014 +0100
2.3 @@ -0,0 +1,50 @@
2.4 +#! /bin/sh
2.5 +### BEGIN INIT INFO
2.6 +# Provides: osecfsmount
2.7 +# Required-Start: $all
2.8 +# Required-Stop:
2.9 +# Default-Start: 2 3 4 5
2.10 +# Default-Stop: 0 1 6
2.11 +# Short-Description: Mounts /home/osecuser/Downloads to /var/run/Downloads with osecfs
2.12 +# Description: Mounts /home/osecuser/Downloads to /var/run/Downloads with osecfs
2.13 +### END INIT INFO
2.14 +
2.15 +do_start () {
2.16 + #
2.17 + # If login delaying is enabled then remove the flag file
2.18 + #
2.19 + mkdir -p /var/run/Downloads
2.20 + /usr/bin/osecfs /etc/osecfs/osecfs_downloads.cfg /var/run/Downloads ro
2.21 +}
2.22 +
2.23 +do_status () {
2.24 + /bin/df -hT
2.25 +}
2.26 +
2.27 +do_stop () {
2.28 + /bin/umount /var/run/Downloads
2.29 + rmdir /var/run/Downloads
2.30 +}
2.31 +
2.32 +case "$1" in
2.33 + start)
2.34 + do_start
2.35 + ;;
2.36 + restart|reload|force-reload)
2.37 + echo "Error: argument '$1' not supported" >&2
2.38 + exit 3
2.39 + ;;
2.40 + stop)
2.41 + do_stop
2.42 + ;;
2.43 + status)
2.44 + do_status
2.45 + exit $?
2.46 + ;;
2.47 + *)
2.48 + echo "Usage: $0 start|stop" >&2
2.49 + exit 3
2.50 + ;;
2.51 +esac
2.52 +
2.53 +:
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/logrotate.d/usbmount Thu Feb 27 17:12:59 2014 +0100
3.3 @@ -0,0 +1,12 @@
3.4 +/var/log/usbmount
3.5 +{
3.6 + rotate 4
3.7 + weekly
3.8 + missingok
3.9 + notifempty
3.10 + compress
3.11 + sharedscripts
3.12 + postrotate
3.13 + invoke-rc.d rsyslog rotate > /dev/null
3.14 + endscript
3.15 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/network/if-pre-up.d/01_ssh_only_eth0 Thu Feb 27 17:12:59 2014 +0100
4.3 @@ -0,0 +1,11 @@
4.4 +#!/bin/sh
4.5 +
4.6 +# Only run once (not for every interface)
4.7 +if [ "$IFACE" != "--all" ]
4.8 +then
4.9 + exit 0
4.10 +fi
4.11 +
4.12 +# only allow ssh connections on eth0 (host only)
4.13 +iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
4.14 +iptables -A INPUT -p tcp --dport 22 -j REJECT
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/osecvm-config Thu Feb 27 17:12:59 2014 +0100
5.3 @@ -0,0 +1,108 @@
5.4 +### Commented entries have reasonable defaults.
5.5 +### Uncomment to edit them.
5.6 +# Source: <source package name; defaults to package name>
5.7 +Section: misc
5.8 +Priority: optional
5.9 +# Homepage: <enter URL here; no default>
5.10 +Standards-Version: 3.9.2
5.11 +
5.12 +Package: osecvm-config
5.13 +Version: 0.0.30
5.14 +Maintainer: ft <ft@x-net.at>
5.15 +Pre-Depends: samba,usbmount,python,python-fuse,python-requests,ntfs-3g,rsyslog,logrotate,osecfs,python-webpy,python-netifaces,osecvm-password-receiver,python-netifaces,python-netaddr,ipcalc,file,sudo,hibernate
5.16 +# Depends: <comma-separated list of packages>
5.17 +# Recommends: <comma-separated list of packages>
5.18 +# Suggests: <comma-separated list of packages>
5.19 +# Provides: <comma-separated list of packages>
5.20 +# Replaces: <comma-separated list of packages>
5.21 +Architecture: all
5.22 +# Copyright: <copyright file; defaults to GPL2>
5.23 +# Changelog: <changelog file; defaults to a generic changelog>
5.24 +# Readme: <README.Debian file; defaults to a generic one>
5.25 +# Extra-Files: <comma-separated list of additional files for the doc directory>
5.26 +Files: logrotate.d/usbmount /etc/osecvm-configs/
5.27 + rsyslog.d/usbmount.conf /etc/osecvm-configs/
5.28 + samba/smb.conf /etc/osecvm-configs/
5.29 + usbmount/usbmount.conf /etc/osecvm-configs/
5.30 + usbmount/mount.d/00_create_model_symlink /etc/osecvm-configs/
5.31 + usbmount/umount.d/00_remove_model_symlink /etc/osecvm-configs/
5.32 + usr/share/usbmount/usbmount /etc/osecvm-configs/
5.33 + usr/share/usbmount/async_usbmount /etc/osecvm-configs/
5.34 + init.d/osecfs_downloads /etc/
5.35 + rc.local /etc/osecvm-configs/
5.36 + network/if-pre-up.d/01_ssh_only_eth0 /etc/osecvm-configs/
5.37 + sudoers /etc/osecvm-configs/
5.38 + hibernate/common.conf /etc/osecvm-configs/
5.39 +File: postinst
5.40 + #!/bin/sh -e
5.41 + # preinst for main-package-config. Divert some configuration file of main-package.
5.42 + .
5.43 + set -e
5.44 + .
5.45 + if [ -f "/etc/init.d/osecfs_downloads" ]
5.46 + then
5.47 + /etc/init.d/osecfs_downloads stop
5.48 + fi
5.49 + .
5.50 + PKG=osecvm-config
5.51 + PKG_LIST="logrotate.d/usbmount rsyslog.d/usbmount.conf samba/smb.conf usbmount/usbmount.conf usbmount/mount.d/00_create_model_symlink usbmount/umount.d/00_remove_model_symlink rc.local network/if-pre-up.d/01_ssh_only_eth0 hibernate/common.conf"
5.52 + .
5.53 + if [ "$1" = configure ]
5.54 + then
5.55 + .
5.56 + for f in $PKG_LIST
5.57 + do
5.58 + dpkg-divert --add --package ${PKG} --rename --divert /etc/$f.distrib /etc/$f
5.59 + [ \! -e /etc/$f -o -L /etc/$f ] && ln -sf /etc/osecvm-configs/$f /etc/$f
5.60 + done
5.61 + .
5.62 + fi
5.63 + .
5.64 + dpkg-divert --add --package ${PKG} --rename --divert /usr/share/usbmount/usbmount.distrib /usr/share/usbmount/usbmount
5.65 + [ \! -e /usr/share/usbmount/usbmount -o -L /usr/share/usbmount/usbmount ] && ln -sf /etc/osecvm-configs/usr/share/usbmount/usbmount /usr/share/usbmount/usbmount
5.66 + .
5.67 + dpkg-divert --add --package ${PKG} --rename --divert /usr/share/usbmount/async_usbmount.distrib /usr/share/usbmount/async_usbmount
5.68 + [ \! -e /usr/share/usbmount/async_usbmount -o -L /usr/share/usbmount/async_usbmount ] && ln -sf /etc/osecvm-configs/usr/share/usbmount/async_usbmount /usr/share/usbmount/async_usbmount
5.69 + .
5.70 + dpkg-divert --add --package ${PKG} --rename --divert /etc/sudoers.distrib /etc/sudoers
5.71 + [ \! -e /etc/sudoers -o -L /etc/sudoers ] && cp -v /etc/osecvm-configs/sudoers /etc/sudoers
5.72 + .
5.73 + /etc/init.d/rsyslog restart
5.74 + /etc/init.d/samba restart
5.75 + mkdir -p /home/osecuser/Downloads
5.76 + chown osecuser:osecuser /home/osecuser/Downloads
5.77 + update-rc.d osecfs_downloads defaults
5.78 + /etc/init.d/osecfs_downloads start
5.79 + chmod 440 /etc/osecvm-configs/sudoers
5.80 + .
5.81 + exit 0
5.82 +File: prerm
5.83 + #!/bin/sh -e
5.84 + # prerm for main-package-config. Divert some configuration file of main-package.
5.85 + .
5.86 + set -e
5.87 + .
5.88 + PKG=osecvm-config
5.89 + PKG_LIST="logrotate.d/usbmount rsyslog.d/usbmount.conf samba/smb.conf usbmount/usbmount.conf usbmount/mount.d/00_create_model_symlink usbmount/umount.d/00_remove_model_symlink rc.local network/if-pre-up.d/01_ssh_only_eth0 sudoers hibernate/common.conf"
5.90 + .
5.91 + if [ "$1" = remove -o "$1" = purge ]
5.92 + then
5.93 + .
5.94 + # make sure to include all the files inside $PKG.tar.gz in this *for* cycle.
5.95 + for f in $PKG_LIST
5.96 + do
5.97 + [ -L /etc/$f ] && rm /etc/$f
5.98 + dpkg-divert --remove --package $PKG --rename --divert /etc/$f.distrib /etc/$f
5.99 + done
5.100 + .
5.101 + fi
5.102 + .
5.103 + [ -L /usr/share/usbmount/usbmount ] && rm /usr/share/usbmount/usbmount
5.104 + dpkg-divert --remove --package $PKG --rename --divert /usr/share/usbmount/usbmount.distrib /usr/share/usbmount/usbmount
5.105 + .
5.106 + /etc/init.d/osecfs_downloads stop
5.107 + update-rc.d osecfs_downloads remove
5.108 + .
5.109 + exit 0
5.110 +Description: Default configuration for osecvm
5.111 + Brings default configuration files for some pakages
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/osecvm-config.conf Thu Feb 27 17:12:59 2014 +0100
6.3 @@ -0,0 +1,2 @@
6.4 +# Original main-package.conf file.
6.5 +# Do not touch it!! It belongs to dpkg.
7.1 Binary file osecvm-config_0.0.10_all.deb has changed
8.1 Binary file osecvm-config_0.0.11_all.deb has changed
9.1 Binary file osecvm-config_0.0.12_all.deb has changed
10.1 Binary file osecvm-config_0.0.13_all.deb has changed
11.1 Binary file osecvm-config_0.0.14_all.deb has changed
12.1 Binary file osecvm-config_0.0.15_all.deb has changed
13.1 Binary file osecvm-config_0.0.16_all.deb has changed
14.1 Binary file osecvm-config_0.0.17_all.deb has changed
15.1 Binary file osecvm-config_0.0.18_all.deb has changed
16.1 Binary file osecvm-config_0.0.19_all.deb has changed
17.1 Binary file osecvm-config_0.0.1_all.deb has changed
18.1 Binary file osecvm-config_0.0.20_all.deb has changed
19.1 Binary file osecvm-config_0.0.21_all.deb has changed
20.1 Binary file osecvm-config_0.0.22_all.deb has changed
21.1 Binary file osecvm-config_0.0.23_all.deb has changed
22.1 Binary file osecvm-config_0.0.24_all.deb has changed
23.1 Binary file osecvm-config_0.0.25_all.deb has changed
24.1 Binary file osecvm-config_0.0.26_all.deb has changed
25.1 Binary file osecvm-config_0.0.27_all.deb has changed
26.1 Binary file osecvm-config_0.0.28_all.deb has changed
27.1 Binary file osecvm-config_0.0.29_all.deb has changed
28.1 Binary file osecvm-config_0.0.2_all.deb has changed
29.1 Binary file osecvm-config_0.0.30_all.deb has changed
30.1 Binary file osecvm-config_0.0.3_all.deb has changed
31.1 Binary file osecvm-config_0.0.4_all.deb has changed
32.1 Binary file osecvm-config_0.0.5_all.deb has changed
33.1 Binary file osecvm-config_0.0.6_all.deb has changed
34.1 Binary file osecvm-config_0.0.7_all.deb has changed
35.1 Binary file osecvm-config_0.0.8_all.deb has changed
36.1 Binary file osecvm-config_0.0.9_all.deb has changed
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/rc.local Thu Feb 27 17:12:59 2014 +0100
37.3 @@ -0,0 +1,31 @@
37.4 +#!/bin/sh -e
37.5 +#
37.6 +# rc.local
37.7 +#
37.8 +# This script is executed at the end of each multiuser runlevel.
37.9 +# Make sure that the script will "exit 0" on success or any other
37.10 +# value on error.
37.11 +#
37.12 +# In order to enable or disable this script just change the execution
37.13 +# bits.
37.14 +#
37.15 +# By default this script does nothing.
37.16 +
37.17 +getRemoteIp ()
37.18 +{
37.19 + ip_address=$(ifconfig eth0 | grep "inet " | awk '{ print $2 }' | cut -d ":" -f 2)
37.20 + ip_netmask=$(ifconfig eth0 | grep "inet " | awk '{ print $4 }' | cut -d ":" -f 2)
37.21 + remote_ip=$(ipcalc $ip_address/$ip_netmask | grep HostMin | awk '{ print $2}')
37.22 +
37.23 + echo $remote_ip
37.24 +}
37.25 +
37.26 +
37.27 +# Disable error exit (not usefull for this command)
37.28 +#set +e
37.29 +#wget -q -T 3 -t 1 -O /dev/null http://$(getRemoteIp):8080/sdvm_started
37.30 +#set -e
37.31 +VBoxControl guestproperty set SDVMStarted True
37.32 +
37.33 +
37.34 +exit 0
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/rsyslog.d/usbmount.conf Thu Feb 27 17:12:59 2014 +0100
38.3 @@ -0,0 +1,2 @@
38.4 +# extra usbmount log
38.5 +:syslogtag, contains, "usbmount" /var/log/usbmount.log
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/samba/smb.conf Thu Feb 27 17:12:59 2014 +0100
39.3 @@ -0,0 +1,46 @@
39.4 +[global]
39.5 + interfaces = eth0 lo
39.6 + bind interfaces only = yes
39.7 + workgroup = osec
39.8 + restrict anonymous = no
39.9 + server string = osecvm
39.10 + security = share
39.11 + disable spoolss = yes
39.12 + unix extensions = no
39.13 + guest account = root
39.14 +
39.15 +
39.16 + # disable printing
39.17 + load printers = no
39.18 + printing = cups
39.19 + printcap name = /dev/null
39.20 + show add printer wizard = no
39.21 + disable spoolss = yes
39.22 +
39.23 + # disable netbios
39.24 + disable netbios = yes
39.25 +
39.26 +[USB]
39.27 + comment = Zugriff auf USB Sticks
39.28 + path = /var/run/usbmount/
39.29 + read only = no
39.30 + browseable = yes
39.31 + writeable = yes
39.32 + follow symlinks = yes
39.33 + available = yes
39.34 + public = yes
39.35 + guest ok = yes
39.36 + wide links = no
39.37 +
39.38 +[Download]
39.39 + comment = Zugriff auf Downloads
39.40 + path = /var/run/Downloads/
39.41 + read only = yes
39.42 + browseable = yes
39.43 + writeable = no
39.44 + follow symlinks = yes
39.45 + available = yes
39.46 + public = yes
39.47 + guest ok = yes
39.48 + wide links = no
39.49 +
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/sudoers Thu Feb 27 17:12:59 2014 +0100
40.3 @@ -0,0 +1,33 @@
40.4 +#
40.5 +# This file MUST be edited with the 'visudo' command as root.
40.6 +#
40.7 +# Please consider adding local content in /etc/sudoers.d/ instead of
40.8 +# directly modifying this file.
40.9 +#
40.10 +# See the man page for details on how to write a sudoers file.
40.11 +#
40.12 +Defaults env_reset
40.13 +Defaults mail_badpass
40.14 +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
40.15 +
40.16 +# Host alias specification
40.17 +
40.18 +# User alias specification
40.19 +
40.20 +# Cmnd alias specification
40.21 +
40.22 +# User privilege specification
40.23 +root ALL=(ALL:ALL) ALL
40.24 +
40.25 +osecuser ALL=(root)NOPASSWD:/usr/bin/apt-get -y up*
40.26 +osecuser ALL=(root)NOPASSWD:/usr/bin/apt-get -y dist-upgrade*
40.27 +osecuser ALL=(root)NOPASSWD:/sbin/shutdown*
40.28 +osecuser ALL=(root)NOPASSWD:/usr/sbin/hibernate-disk*
40.29 +
40.30 +
40.31 +# Allow members of group sudo to execute any command
40.32 +%sudo ALL=(ALL:ALL) ALL
40.33 +
40.34 +# See sudoers(5) for more information on "#include" directives:
40.35 +
40.36 +#includedir /etc/sudoers.d
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/usbmount/mount.d/00_create_model_symlink Thu Feb 27 17:12:59 2014 +0100
41.3 @@ -0,0 +1,41 @@
41.4 +#!/bin/sh
41.5 +# This script creates the model name symlink in /var/run/usbmount.
41.6 +# Copyright (C) 2005 Martin Dickopp
41.7 +#
41.8 +# This file is free software; the copyright holder gives unlimited
41.9 +# permission to copy and/or distribute it, with or without
41.10 +# modifications, as long as this notice is preserved.
41.11 +#
41.12 +# This file is distributed in the hope that it will be useful,
41.13 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
41.14 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
41.15 +# PARTICULAR PURPOSE.
41.16 +#
41.17 +set -e
41.18 +
41.19 +# Replace spaces with underscores, remove special characters in vendor
41.20 +# and model name.
41.21 +UM_VENDOR=`echo "$UM_VENDOR" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`
41.22 +UM_MODEL=`echo "$UM_MODEL" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`
41.23 +
41.24 +# Exit if both vendor and model name are empty.
41.25 +test -n "$UM_VENDOR" || test -n "$UM_MODEL" || exit 0
41.26 +
41.27 +# Build symlink name.
41.28 +if test -n "$UM_VENDOR" && test -n "$UM_MODEL"; then
41.29 + name="${UM_VENDOR}_$UM_MODEL"
41.30 +else
41.31 + name="$UM_VENDOR$UM_MODEL"
41.32 +fi
41.33 +
41.34 +# Append partition number, if any, to the symlink name.
41.35 +partition=`echo "$UM_DEVICE" | sed 's/^.*[^0123456789]\([0123456789]*\)/\1/'`
41.36 +if test -n "$partition"; then
41.37 + name="${name}_$partition"
41.38 +fi
41.39 +
41.40 +mkdir -p "/var/run/usbmount/$name"
41.41 +osecfs /etc/osecfs/osecfs_usb.cfg /var/run/usbmount/$name ro
41.42 +
41.43 +
41.44 +exit 0
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/usbmount/umount.d/00_remove_model_symlink Thu Feb 27 17:12:59 2014 +0100
42.3 @@ -0,0 +1,19 @@
42.4 +#!/bin/sh
42.5 +# This script removes the model name symlink in /var/run/usbmount.
42.6 +# Copyright (C) 2005 Martin Dickopp
42.7 +#
42.8 +# This file is free software; the copyright holder gives unlimited
42.9 +# permission to copy and/or distribute it, with or without
42.10 +# modifications, as long as this notice is preserved.
42.11 +#
42.12 +# This file is distributed in the hope that it will be useful,
42.13 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
42.14 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
42.15 +# PARTICULAR PURPOSE.
42.16 +#
42.17 +set -e
42.18 +
42.19 +umount "/var/run/usbmount/"*
42.20 +rmdir "/var/run/usbmount/"*
42.21 +
42.22 +exit 0
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/usbmount/usbmount.conf Thu Feb 27 17:12:59 2014 +0100
43.3 @@ -0,0 +1,53 @@
43.4 +# Configuration file for the usbmount package, which mounts removable
43.5 +# storage devices when they are plugged in and unmounts them when they
43.6 +# are removed.
43.7 +
43.8 +# Change to zero to disable usbmount
43.9 +ENABLED=1
43.10 +
43.11 +# Mountpoints: These directories are eligible as mointpoints for
43.12 +# removable storage devices. A newly plugged in device is mounted on
43.13 +# the first directory in this list that exists and on which nothing is
43.14 +# mounted yet.
43.15 +MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
43.16 + /media/usb4 /media/usb5 /media/usb6 /media/usb7"
43.17 +
43.18 +# Filesystem types: removable storage devices are only mounted if they
43.19 +# contain a filesystem type which is in this list.
43.20 +FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus ntfs fuseblk"
43.21 +
43.22 +#############################################################################
43.23 +# WARNING! #
43.24 +# #
43.25 +# The "sync" option may not be a good choice to use with flash drives, as #
43.26 +# it forces a greater amount of writing operating on the drive. This makes #
43.27 +# the writing speed considerably lower and also leads to a faster wear out #
43.28 +# of the disk. #
43.29 +# #
43.30 +# If you omit it, don't forget to use the command "sync" to synchronize the #
43.31 +# data on your disk before removing the drive or you may experience data #
43.32 +# loss. #
43.33 +# #
43.34 +# It is highly recommended that you use the pumount command (as a regular #
43.35 +# user) before unplugging the device. It makes calling the "sync" command #
43.36 +# and mounting with the sync option unnecessary---this is similar to other #
43.37 +# operating system's "safely disconnect the device" option. #
43.38 +#############################################################################
43.39 +# Mount options: Options passed to the mount command with the -o flag.
43.40 +# See the warning above regarding removing "sync" from the options.
43.41 +MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime"
43.42 +
43.43 +# Filesystem type specific mount options: This variable contains a space
43.44 +# separated list of strings, each which the form "-fstype=TYPE,OPTIONS".
43.45 +#
43.46 +# If a filesystem with a type listed here is mounted, the corresponding
43.47 +# options are appended to those specificed in the MOUNTOPTIONS variable.
43.48 +#
43.49 +# For example, "-fstype=vfat,gid=floppy,dmask=0007,fmask=0117" would add
43.50 +# the options "gid=floppy,dmask=0007,fmask=0117" when a vfat filesystem
43.51 +# is mounted.
43.52 +FS_MOUNTOPTIONS=""
43.53 +
43.54 +# If set to "yes", more information will be logged via the syslog
43.55 +# facility.
43.56 +VERBOSE=yes
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/usr/share/usbmount/async_usbmount Thu Feb 27 17:12:59 2014 +0100
44.3 @@ -0,0 +1,251 @@
44.4 +#!/bin/sh
44.5 +# This script mounts USB mass storage devices when they are plugged in
44.6 +# and unmounts them when they are removed.
44.7 +# Copyright © 2004, 2005 Martin Dickopp
44.8 +# Copyright © 2008, 2009, 2010 Rogério Theodoro de Brito
44.9 +#
44.10 +# This file is free software; the copyright holder gives unlimited
44.11 +# permission to copy and/or distribute it, with or without
44.12 +# modifications, as long as this notice is preserved.
44.13 +#
44.14 +# This file is distributed in the hope that it will be useful,
44.15 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
44.16 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
44.17 +# PARTICULAR PURPOSE.
44.18 +#
44.19 +set -e
44.20 +exec > /dev/null 2>&1
44.21 +
44.22 +######################################################################
44.23 +# Auxiliary functions
44.24 +
44.25 +# Log a string via the syslog facility.
44.26 +log()
44.27 +{
44.28 + if [ $1 != debug ] || expr "$VERBOSE" : "[yY]" > /dev/null; then
44.29 + logger -p user.$1 -t "usbmount[$$]" -- "$2"
44.30 + fi
44.31 +}
44.32 +
44.33 +
44.34 +# Test if the first parameter is in the list given by the second
44.35 +# parameter.
44.36 +in_list()
44.37 +{
44.38 + for v in $2; do
44.39 + [ "$1" != "$v" ] || return 0
44.40 + done
44.41 + return 1
44.42 +}
44.43 +
44.44 +
44.45 +######################################################################
44.46 +# Main program
44.47 +
44.48 +# Default values for configuration variables.
44.49 +ENABLED=1
44.50 +MOUNTPOINTS=
44.51 +FILESYSTEMS=
44.52 +MOUNTOPTIONS=
44.53 +FS_MOUNTOPTIONS=
44.54 +VERBOSE=no
44.55 +
44.56 +if [ -r /etc/usbmount/usbmount.conf ]; then
44.57 + . /etc/usbmount/usbmount.conf
44.58 + log debug "loaded usbmount configurations"
44.59 +fi
44.60 +
44.61 +if [ "${ENABLED:-1}" -eq 0 ]; then
44.62 + log info "usbmount is disabled, see /etc/usbmount/usbmount.conf"
44.63 + exit 0
44.64 +fi
44.65 +
44.66 +if [ ! -x /sbin/blkid ]; then
44.67 + log err "cannot execute /sbin/blkid"
44.68 + exit 1
44.69 +fi
44.70 +
44.71 +# Per Policy 9.3.2, directories under /var/run have to be created
44.72 +# after every reboot.
44.73 +if [ ! -e /var/run/usbmount ]; then
44.74 + mkdir -p /var/run/usbmount
44.75 + log debug "creating /var/run/usbmount directory"
44.76 +fi
44.77 +
44.78 +umask 022
44.79 +
44.80 +if [ "$1" = add ]; then
44.81 +
44.82 + # Acquire lock.
44.83 + log debug "trying to acquire lock /var/run/usbmount/.mount.lock"
44.84 + lockfile-create --retry 3 /var/run/usbmount/.mount || \
44.85 + { log err "cannot acquire lock /var/run/usbmount/.mount.lock"; exit 1; }
44.86 + trap '( lockfile-remove /var/run/usbmount/.mount )' 0
44.87 + log debug "acquired lock /var/run/usbmount/.mount.lock"
44.88 +
44.89 + # Grab device information from device and "divide it"
44.90 + # FIXME: improvement: implement mounting by label (notice that labels
44.91 + # can contain spaces, which makes things a little bit less comfortable).
44.92 +
44.93 + set +e
44.94 + DEVINFO=$(/sbin/blkid -p $DEVNAME)
44.95 + BLKID_RESULT="$?"
44.96 + if [ "$BLKID_RESULT" != "0" ]
44.97 + then
44.98 + log info "blkid -p $DEVNAME has retured with $BLKID_RESULT"
44.99 + log info "Stick is maybe encrypted. Try decrypt"
44.100 + wget -q -T 3 -t 1 -O /dev/null http://192.168.56.1:8090/password?text=Please+send+me+the+password
44.101 + if [ "$?" != "0" ]
44.102 + then
44.103 + log err "Connection to http://192.168.56.1:8090/password?text=Please+send+me+the+password failed"
44.104 + exit 1
44.105 + fi
44.106 + log info "Password notification sended, wait for response"
44.107 +
44.108 + /usr/bin/osecvm-password-receiver.py eth0 58080 $DEVNAME /media/usb0
44.109 + if [ "$?" != "0" ]
44.110 + then
44.111 + log err "Stick removed. exit"
44.112 + exit 1
44.113 + fi
44.114 +
44.115 + mkdir -p "/var/run/usbmount/encrypted"
44.116 + /usr/bin/osecfs /etc/osecfs/osecfs_usb.cfg "/var/run/usbmount/encrypted" rw
44.117 + log info "Encrypted stick mounted"
44.118 + exit 0
44.119 + fi
44.120 + set -e
44.121 +
44.122 + FSTYPE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
44.123 + UUID=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
44.124 + USAGE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;')
44.125 +
44.126 + if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then
44.127 + log info "$DEVNAME does not contain a filesystem or disklabel"
44.128 + exit 1
44.129 + fi
44.130 +
44.131 +
44.132 + # Try to use specifications in /etc/fstab first.
44.133 + if egrep -q "^[[:blank:]]*$DEVNAME" /etc/fstab; then
44.134 + log info "executing command: mount $DEVNAME"
44.135 + mount $DEVNAME || log err "mount by DEVNAME with $DEVNAME wasn't successful; return code $?"
44.136 +
44.137 + elif grep -q "^[[:blank:]]*UUID=$UUID" /etc/fstab; then
44.138 + log info "executing command: mount -U $UUID"
44.139 + mount -U $UUID || log err "mount by UUID with $UUID wasn't successful; return code $?"
44.140 +
44.141 + else
44.142 + log debug "$DEVNAME contains filesystem type $FSTYPE"
44.143 +
44.144 + fstype=$FSTYPE
44.145 + # Test if the filesystem type is in the list of filesystem
44.146 + # types to mount.
44.147 + if in_list "$fstype" "$FILESYSTEMS"; then
44.148 + # Search an available mountpoint.
44.149 + for v in $MOUNTPOINTS; do
44.150 + if [ -d "$v" ] && ! grep -q "^[^ ][^ ]* *$v " /proc/mounts; then
44.151 + mountpoint="$v"
44.152 + log debug "mountpoint $mountpoint is available for $DEVNAME"
44.153 + break
44.154 + fi
44.155 + done
44.156 + if [ -n "$mountpoint" ]; then
44.157 + # Determine mount options.
44.158 + options=
44.159 + for v in $FS_MOUNTOPTIONS; do
44.160 + if expr "$v" : "-fstype=$fstype,."; then
44.161 + options="$(echo "$v" | sed 's/^[^,]*,//')"
44.162 + break
44.163 + fi
44.164 + done
44.165 + if [ -n "$MOUNTOPTIONS" ]; then
44.166 + options="$MOUNTOPTIONS${options:+,$options}"
44.167 + fi
44.168 +
44.169 + # Mount the filesystem.
44.170 + log info "executing command: mount -t$fstype ${options:+-o$options} $DEVNAME $mountpoint"
44.171 + mount "-t$fstype" "${options:+-o$options}" "$DEVNAME" "$mountpoint"
44.172 +
44.173 + # Determine vendor and model.
44.174 + vendor=
44.175 + if [ -r "/sys$DEVPATH/device/vendor" ]; then
44.176 + vendor="`cat \"/sys$DEVPATH/device/vendor\"`"
44.177 + elif [ -r "/sys$DEVPATH/../device/vendor" ]; then
44.178 + vendor="`cat \"/sys$DEVPATH/../device/vendor\"`"
44.179 + elif [ -r "/sys$DEVPATH/device/../manufacturer" ]; then
44.180 + vendor="`cat \"/sys$DEVPATH/device/../manufacturer\"`"
44.181 + elif [ -r "/sys$DEVPATH/../device/../manufacturer" ]; then
44.182 + vendor="`cat \"/sys$DEVPATH/../device/../manufacturer\"`"
44.183 + fi
44.184 + vendor="$(echo "$vendor" | sed 's/^[[:blank:]]\+//; s/[[:blank:]]\+$//')"
44.185 +
44.186 + model=
44.187 + if [ -r "/sys$DEVPATH/device/model" ]; then
44.188 + model="`cat \"/sys$DEVPATH/device/model\"`"
44.189 + elif [ -r "/sys$DEVPATH/../device/model" ]; then
44.190 + model="`cat \"/sys$DEVPATH/../device/model\"`"
44.191 + elif [ -r "/sys$DEVPATH/device/../product" ]; then
44.192 + model="`cat \"/sys$DEVPATH/device/../product\"`"
44.193 + elif [ -r "/sys$DEVPATH/../device/../product" ]; then
44.194 + model="`cat \"/sys$DEVPATH/../device/../product\"`"
44.195 + fi
44.196 + model="$(echo "$model" | sed 's/^[[:blank:]]\+//; s/[[:blank:]]\+$//')"
44.197 +
44.198 + # Run hook scripts; ignore errors.
44.199 + export UM_DEVICE="$DEVNAME"
44.200 + export UM_MOUNTPOINT="$mountpoint"
44.201 + export UM_FILESYSTEM="$fstype"
44.202 + export UM_MOUNTOPTIONS="$options"
44.203 + export UM_VENDOR="$vendor"
44.204 + export UM_MODEL="$model"
44.205 + log info "executing command: run-parts /etc/usbmount/mount.d"
44.206 + run-parts /etc/usbmount/mount.d || :
44.207 + else
44.208 + # No suitable mount point found.
44.209 + log warning "no mountpoint found for $DEVNAME"
44.210 + exit 1
44.211 + fi
44.212 + fi
44.213 + fi
44.214 +elif [ "$1" = remove ]; then
44.215 +
44.216 + # A block or partition device has been removed.
44.217 + # Test if it is mounted.
44.218 + for device in $(/usr/bin/truecrypt -l | awk '{ print $2}')
44.219 + do
44.220 + if [ "$DEVNAME" = "$device" ]
44.221 + then
44.222 + log info "encrypted device was removed"
44.223 + umount "/var/run/usbmount/encrypted"
44.224 + rmdir "/var/run/usbmount/encrypted"
44.225 + log info "/usr/bin/truecrypt -d $DEVNAME"
44.226 + /usr/bin/truecrypt -d "$DEVNAME"
44.227 + log info "everything done"
44.228 + fi
44.229 + done
44.230 + while read device mountpoint fstype remainder; do
44.231 + if [ "$DEVNAME" = "$device" ]; then
44.232 + # If the mountpoint and filesystem type are maintained by
44.233 + # this script, unmount the filesystem.
44.234 + if in_list "$mountpoint" "$MOUNTPOINTS" &&
44.235 + in_list "$fstype" "$FILESYSTEMS"; then
44.236 + log info "executing command: umount -l $mountpoint"
44.237 + umount -l "$mountpoint"
44.238 +
44.239 + # Run hook scripts; ignore errors.
44.240 + export UM_DEVICE="$DEVNAME"
44.241 + export UM_MOUNTPOINT="$mountpoint"
44.242 + export UM_FILESYSTEM="$fstype"
44.243 + log info "executing command: run-parts /etc/usbmount/umount.d"
44.244 + run-parts /etc/usbmount/umount.d || :
44.245 + fi
44.246 + break
44.247 + fi
44.248 + done < /proc/mounts
44.249 +else
44.250 + log err "unexpected: action '$1'"
44.251 + exit 1
44.252 +fi
44.253 +
44.254 +log debug "usbmount execution finished"
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/usr/share/usbmount/usbmount Thu Feb 27 17:12:59 2014 +0100
45.3 @@ -0,0 +1,16 @@
45.4 +#!/bin/sh
45.5 +
45.6 +# run usbmount asyncron from udev
45.7 +# wait in the subshell until the network comes up and then start the rest
45.8 +(
45.9 +
45.10 +if [ "$1" != "remove" ]
45.11 +then
45.12 + while [ -z "$(ifconfig eth0 | grep "inet addr:")" ]
45.13 + do
45.14 + sleep 0.5
45.15 + done
45.16 +fi
45.17 +
45.18 +/usr/share/usbmount/async_usbmount $1
45.19 +) &