Skip to content
Snippets Groups Projects
Commit 80248ce9 authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Merge branch 'develop' into 'master'

Develop

Bugfix licensecheckout.sh

See merge request !2
parents 2e7a4561 3a16a5a6
No related branches found
No related tags found
1 merge request!2Develop
......@@ -4,7 +4,7 @@ EV3
---
.. autoclass:: EV3
:members:
:members: connect, disconnect, stopAllMotors, beep, playTone, stopTone, tonePlayed, setProperties
Motor
......
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252"></head><body><h1>It works!</h1>
<p>This is the a dummy web page for the EV3 toolbox docu.</p>
<p>Replace this file with a link to the actual docu.</p>
</body></html>
......@@ -3,89 +3,110 @@ classdef EV3 < MaskedHandle
%
% This is the 'central' class (from user's view) when working with this toolbox. It
% delivers a convenient interface for creating a connection to the brick and sending
% commands to it.
% commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.
%
% Notes
% Notes:
% * Creating multiple EV3 objects and connecting them to different physical bricks has not
% been thoroughly tested yet, but seems to work on a first glance.
% * When referring to an instance of this class the term 'virtual brick' is used from now
% on. The LEGO EV3 brick itself is referred to as 'physical brick'.
%
% Signature
% Author: Tim Stadtmann
% Date: 2016/05/19
% Updated: 2016/08/15
properties % Standard properties
%debug - [Writable] Debug turned on or off (0/1/off/on/'false'/'true'/2)
% In debug mode 1 (debug=1/'on'/true), everytime a command is passed to the sublayer
% ('communication layer'), there is feedback in the console about what command has been
% called. Debug mode 2 (debug=2) enables debug mode in the lower layers. Each packet
% sent and received is printed to the console.
debug;
%batteryMode - [Writable] Mode for reading battery charge ('Percentage'/'Voltage')
% See also EV3.BATTERYVALUE
% Attributes:
% motorA (Motor): Motor-object interfacing port A
% motorB (Motor): Motor-object interfacing port B
% motorC (Motor): Motor-object interfacing port C
% motorD (Motor): Motor-object interfacing port D
% sensor1 (Sensor): Motor-object interfacing port 1
% sensor2 (Sensor): Motor-object interfacing port 2
% sensor3 (Sensor): Motor-object interfacing port 3
% sensor4 (Sensor): Motor-object interfacing port 4
% debug (numeric in {0,1,2}): Debug mode. [WRITABLE]
% * 0: Debug turned off
% * 1: (High-level-) Debug turned on for EV3-object - enables feedback in the
% console about what firmware-commands have been called when using a method
% * 2: Low-level-Debug turned on - each packet sent and received is printed to the
% console
% batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge.
% [WRITABLE]
% batteryValue (numeric): Current battery charge. Depending on batteryMode, the reading
% is either in percentage or voltage. [READ-ONLY]
% isConnected (bool): True if virtual brick-object is connected to physical one. [READ-ONLY]
properties
% batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge. [WRITABLE]
% See also BATTERYVALUE
batteryMode;
% debug (numeric in {0,1,2}): Debug mode. [WRITABLE]
% * 0: Debug turned off
% * 1: (High-level-) Debug turned on for EV3-object - enables feedback in the
% console about what firmware-commands have been called when using a method
% * 2: Low-level-Debug turned on - each packet sent and received is printed to the
% console
debug;
end
properties (Dependent) % Parameters to be read directly from physical brick
%batteryValue - [Read-only] Current battery charge
% Depending on batteryMode, the reading is either in percentage or voltage.
% See also EV3.BATTERYMODE
% batteryValue (numeric): Current battery charge. Depending on batteryMode, the reading
% is either in percentage or voltage. [READ-ONLY]
batteryValue;
end
properties (SetAccess = 'private') % Read-only properties that are set internally
%isConnected - [Read-only] Virtual brick connected to physical one?
properties (SetAccess = private) % Read-only properties that are set internally
% isConnected (bool): True if virtual brick-object is connected to physical one. [READ-ONLY]
% See also EV3.CONNECT, EV3.DISCONNECT
isConnected = false;
%motorA - [Read-only]
% motorA (Motor): Motor-object interfacing port A
% See also MOTOR
motorA;
%motorB - [Read-only]
% motorB (Motor): Motor-object interfacing port B
% See also MOTOR
motorB;
%motorC - [Read-only]
% motorC (Motor): Motor-object interfacing port C
% See also MOTOR
motorC;
%motorD - [Read-only]
% motorD (Motor): Motor-object interfacing port D
% See also MOTOR
motorD;
%sensor1 - [Read-only]
% sensor1 (Sensor): Sensor-object interfacing port 1
% See also SENSOR
sensor1;
%sensor2 - [Read-only]
% sensor2 (Sensor): Sensor-object interfacing port 2
% See also SENSOR
sensor2;
%sensor3 - [Read-only]
% sensor3 (Sensor): Sensor-object interfacing port 3
% See also SENSOR
sensor3;
%sensor4 - [Read-only]
% sensor4 (Sensor): Sensor-object interfacing port 4
% See also SENSOR
sensor4;
end
properties (Access = 'private')
%commInterface - Interface to communication layer
properties (Access = private)
% commInterface (CommunicationInterface): Interface to communication layer
% All commands sent to the Brick are created and written through this object. Each
% Motor- and Sensor-object has a reference to it.
%
commInterface = 0;
end
properties (Hidden, Access = 'private') % Hidden properties for internal use only
init = true; % Indicates 'init-phase' (Set to 1 as long as constructor is running)
properties (Hidden, Access = private) % Hidden properties for internal use only
% init (bool): Indicates init-phase (i.e. constructor is running).
init = true;
end
methods % Standard methods
%% Constructor
function ev3 = EV3(varargin)
%EV3 Sets properties of EV3-object and creates Motor- and Sensor-objects with default
% Sets properties of EV3-object and creates Motor- and Sensor-objects with default
% parameters.
%
% Arguments
% * varargin: see EV3::setProperties(ev3, varargin)
% varargin: see setProperties(ev3, varargin)
%
% See also SETPROPERTIES
ev3.setProperties(varargin{:});
......@@ -104,7 +125,7 @@ classdef EV3 < MaskedHandle
end
function delete(ev3)
%delete Disconnects from physical brick and deletes this instance
% Disconnects from physical brick and deletes this instance
if ev3.isConnected
ev3.disconnect();
......@@ -113,14 +134,15 @@ classdef EV3 < MaskedHandle
%% Connection
function connect(ev3, varargin)
%connect Connects EV3-object and its Motors and Sensors to physical brick.
% Connects EV3-object and its Motors and Sensors to physical brick.
%
% Arguments
% * 'bt'/'usb': Connection type
% * 'serPort', '/dev/rfcommx': Path to serial port (if 'bt'), where x = 0...9
% * 'beep', bool: EV3 beeps if connection has been established.
% Arguments:
% connectionType (string in {'bt', 'usb'}): Connection type
% serPort (string {'/dev/rfcomm1', '/dev/rfcomm2', ...}): Path to serial port
% (if 'bt')
% beep (bool): If true, EV3 beeps if connection has been established
%
% Examples
% Examples:
% b = EV3(); b.connect('bt', 'serPort', '/dev/rfcomm0');
% b = EV3(); b.connect('usb', 'beep', 'on', );
%
......@@ -189,14 +211,16 @@ classdef EV3 < MaskedHandle
end
function disconnect(ev3)
%disconnect Disconnects EV3-object and its Motors and Sensors from physical brick.
% Disconnects EV3-object and its Motors and Sensors from physical brick.
%
% Example
% Notes:
% * Gets called automatically when EV3-object is destroyed.
%
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% % do stuff
% b.disconnect();
%
% Reset motors and sensors before disconnecting
ev3.resetPhysicalBrick();
......@@ -224,7 +248,7 @@ classdef EV3 < MaskedHandle
%% Device functions
function stopAllMotors(ev3)
%stopAllMotors Sends a stop-command to all motor-ports
% Sends a stop-command to all motor-ports
if ~ev3.isConnected
stopAllMotors(['EV3::beep: Brick-Object not connected physical brick. ',...
......@@ -236,12 +260,12 @@ classdef EV3 < MaskedHandle
%% Sound functions
function beep(ev3)
%beep Plays a 'beep' tone on brick.
% Plays a 'beep'-tone on brick.
%
% Notes
% Notes:
% * This equals playTone(10, 1000, 100) (Wraps the same opCode in comm-layer)
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.beep();
......@@ -260,14 +284,14 @@ classdef EV3 < MaskedHandle
end
function playTone(ev3, volume, frequency, duration)
%playTone Plays tone on brick.
% Plays tone on brick.
%
% Arguments
% * volume (0...100)
% * frequency (250...10000)
% * duration (>0, in milliseconds)
% Arguments:
% volume (numeric in [0, 100])
% frequency (numeric in [250, 10000])
% duration (numeric >0): in milliseconds
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.playTone(50, 5000, 1000); % Plays tone with 50% volume and 5000Hz for 1
......@@ -287,9 +311,9 @@ classdef EV3 < MaskedHandle
end
function stopTone(ev3)
%stopTone Stops tone currently played.
% Stops tone currently played
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.playTone(10,100,100000000); % Accidentally given wrong tone duration.
......@@ -309,10 +333,10 @@ classdef EV3 < MaskedHandle
end
function status = tonePlayed(ev3)
%tonePlayed Tests if tone is currently played.
% Tests if tone is currently played.
%
% Output
% * status: True for a tone being played
% Returns:
% status (bool): True if a tone is being played
%
% Example
% b = EV3();
......@@ -365,20 +389,19 @@ classdef EV3 < MaskedHandle
end
function setProperties(ev3, varargin)
%setProperties Set multiple EV3 properties at once using MATLAB's inputParser.
% Set multiple EV3 properties at once using MATLAB's inputParser.
%
% Arguments
% * 'debug', 0/1/'on'/'off'/'true'/'false'/2
% * 'batteryMode', 'Voltage'/'Percentage': Mode in which batteryValue will be read.
% Arguments:
% debug (numeric in {0,1,2}): see EV3.debug
% batteryMode (string in {'Voltage'/'Percentage'}): see EV3.batteryMode
%
% Example
% Example:
% b = EV3();
% b.connect('bt', 'serPort', '/dev/rfcomm0');
% b.setProperties('debug', 'on', 'batteryMode', 'Voltage');
% % Instead of: b.debug = 'on'; b.batteryMode = 'Voltage';
%
% See also EV3.DEBUG, EV3.BATTERYMODE
%
p = inputParser();
......@@ -431,38 +454,9 @@ classdef EV3 < MaskedHandle
end
warning('on', 'all');
end
% function display(ev3)
% warning('off','all');
% %builtin('disp', ev3);
%
%
% props = properties(ev3); % Save list with property names as strings
% fprintf(' <a href="matlab:helpPopup EV3">EV3</a> with properties:\n\n');
% for i = 1:length(props)
% p = props{i};
%
% if isa(ev3.(p), 'handle') && ev3.(p).isvalid % Valid handle?
% if isa(ev3.(p), 'Brick') % Communication interface?
% fprintf('\t%15s: Brick-object (Interface for comm-layer)\n');
% else % Motor or Sensor object?
% fprintf('\t%15s: %s-object for port %s\n', p, class(ev3.(p)), ...
% port2str(class(ev3.(p)), ev3.(p).port));
% end
% elseif isnumeric(ev3.(p))
% fprintf('\t%15s: %d\n', p, ev3.(p));
% elseif ischar(ev3.(p))
% fprintf('\t%15s: %s\n', p, ev3.(p));
% else
% warning('EV3::display: Unsuspected parameter type.'); % Not really useful
% end
% end
%
% warning('on','all');
%
% end
end
methods (Access = 'private') % Private brick functions that are wrapped by dependent params
methods (Access = private) % Private brick functions that are wrapped by dependent params
function bat = getBattery(ev3)
if ~ev3.isConnected
error(['EV3::getBattery: EV3-Object not connected to physical EV3. You have ',...
......
......@@ -167,10 +167,13 @@ classdef Motor < MaskedHandle & dynamicprops
methods % Standard methods
%% Constructor
function motor = Motor(varargin)
%Motor Sets properties of Motor-object and indicates end of init-phase when it's done
% Sets properties of Motor-object and indicates end of init-phase when it's done.
%
% Notes:
% * input-arguments will directly be handed to Motor.setProperties
%
% Arguments:
% * varargin: see setProperties(motor, varargin)
% varargin: see setProperties(motor, varargin)
%
motor.setProperties(varargin{:});
......@@ -348,6 +351,7 @@ classdef Motor < MaskedHandle & dynamicprops
function syncedStart(motor, syncMotor, varargin)
% Starts this motor synchronized with another
%
% This motor acts as a 'master', meaning that the synchronized control is done via
% this one. When syncedStart is called, the master sets some of the slave's
% (syncMotor) properties to keep it consistent with the physical brick. So, for
......@@ -379,8 +383,9 @@ classdef Motor < MaskedHandle & dynamicprops
% Example:
% b = EV3(); b.connect('usb');
% m = b.motorA;
% slave = b.motorB;
% m.power = 50;
% m.syncedStart(b.motorB);
% m.syncedStart(slave);
% % Do stuff
% m.syncedStop();
%
......@@ -476,10 +481,8 @@ classdef Motor < MaskedHandle & dynamicprops
function syncedStop(motor)
% Stops both motors previously started with syncedStart.
% Obviously, if motors have not been started synchronized, this throws an error.
%
% See also MOTOR.SYNCEDSTART
%
if ~motor.isSynced
error('Motor::syncedStop: Motor has not been started synchronized with another.');
......@@ -540,9 +543,8 @@ classdef Motor < MaskedHandle & dynamicprops
% the motor has stopped, this time using motor.isRunning() (this only works as
% long as not both OutputTest and OutputReady are buggy).
% * (OLD)Workaround: Poll isRunning (which itself return (speed>0)) until it is false
% -> No need to check if motor is connected as speed correctly
% returns 0 if it's not
%
% (No need to check if motor is connected as speed correctly returns 0 if
% it's not)
if ~motor.connectedToBrick
error('Motor::waitFor: Motor-Object not connected to comm handle.');
......@@ -584,8 +586,7 @@ classdef Motor < MaskedHandle & dynamicprops
end
function internalReset(motor)
% Resets internal tacho count
% Use this if motor behaves weird (i.e. not starting at all, or not correctly
% Resets internal tacho count. Use this if motor behaves weird (i.e. not starting at all, or not correctly
% running to limitValue)
%
% The internal tacho count is used for positioning the motor. When the
......@@ -595,7 +596,6 @@ classdef Motor < MaskedHandle & dynamicprops
% brakemode is 'Coast', this function is called automatically.
%
% See also MOTOR.RESETTACHOCOUNT
%
if ~motor.connectedToBrick
error(['Motor::internalReset: Motor-Object not connected to brick handle.',...
......@@ -796,15 +796,15 @@ classdef Motor < MaskedHandle & dynamicprops
% Sets multiple Motor properties at once using MATLAB's inputParser.
%
% Arguments:
% debug (bool)
% smoothStart (numeric in [0, limitValue])
% smoothStop (numeric in [0, limitValue])
% speedRegulation (bool)
% brakeMode ('Coast'|'Brake')
% limitMode ('Time'|'Tacho')
% limitValue (numeric > 0)
% power (numeric in [-100,100])
% batteryMode ('Voltage'|'Percentage')
% debug (bool) [OPTIONAL]
% smoothStart (numeric in [0, limitValue]) [OPTIONAL]
% smoothStop (numeric in [0, limitValue]) [OPTIONAL]
% speedRegulation (bool) [OPTIONAL]
% brakeMode ('Coast'|'Brake') [OPTIONAL]
% limitMode ('Time'|'Tacho') [OPTIONAL]
% limitValue (numeric > 0) [OPTIONAL]
% power (numeric in [-100,100]) [OPTIONAL]
% batteryMode ('Voltage'|'Percentage') [OPTIONAL]
%
% Example:
% b = EV3();
......
......@@ -9,6 +9,7 @@ classdef Sensor < MaskedHandle
% instances for each sensor port, and you can work with them via the EV3-object.
% * The Sensor-class represents sensor ports, not individual sensors!
%
%
% Attributes:
% mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default,
% mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected
......@@ -34,8 +35,9 @@ classdef Sensor < MaskedHandle
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
% value (numeric): Value read from hysical sensor. What the value represents depends on
% sensor.mode.
% sensor.mode. [READ-ONLY]
% type (DeviceType): Type of physical sensor connected to the port. Possible types are: [READ-ONLY]
%
% * DeviceType.NXTTouch
% * DeviceType.NXTLight
% * DeviceType.NXTSound
......@@ -54,71 +56,106 @@ classdef Sensor < MaskedHandle
% * DeviceType.Error
properties % Standard properties to be set by user
%mode - [Writable] Sensor mode in which the value will be read (DeviceMode.[...])
% By default, mode is set to DeviceMode.Default.Undefined. The allowed mode (and the
% default mode) for a Sensor-object depends on its type.
% Touch-Sensor: DeviceMode.Touch.Pushed (Default)
% DeviceMode.Touch.Bumps
% Ultrasonic-Sensor: DeviceMode.UltraSonic.DistCM (Default)
% DeviceMode.UltraSonic.DistIn
% DeviceMode.UltraSonic.Listen
% Color-Sensor: DeviceMode.Color.Reflect (Default)
% DeviceMode.Color.Ambient
% DeviceMode.Color.Col
% Gyro-Sensor: DeviceMode.Gyro.Angular (Default)
% DeviceMode.Gyro.Rate
% mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default,
% mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected
% to the port *and* the physical Brick is connected to the EV3-object, the allowed
% mode and the default mode for a Sensor-object are the following (depending on the
% sensor type): [WRITABLE]
%
% * Touch-Sensor:
% * DeviceMode.Touch.Pushed [Default]
% * DeviceMode.Touch.Bumps
% * Ultrasonic-Sensor:
% * DeviceMode.UltraSonic.DistCM [Default]
% * DeviceMode.UltraSonic.DistIn
% * DeviceMode.UltraSonic.Listen
% * Color-Sensor:
% * DeviceMode.Color.Reflect [Default]
% * DeviceMode.Color.Ambient
% * DeviceMode.Color.Col
% * Gyro-Sensor:
% * DeviceMode.Gyro.Angular [Default]
% * DeviceMode.Gyro.Rate
%
% See also SENSOR.VALUE, SENSOR.TYPE
mode;
%debug - [Writable] Debug turned on or off (0/1/'on'/'off'/'true'/'false')
% In debug mode, everytime a command is passed to the sublayer ('communication layer'),
% there is feedback in the console about what command has been called, etc.
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
debug;
end
properties (Dependent) % Parameters to be read directly from physical brick
%value - [Read-only] Value read from sensor
% What the value represents depends on sensor.mode.
% value (numeric): Value read from hysical sensor. What the value represents depends on
% sensor.mode. [READ-ONLY]
% See also SENSOR.MODE
value;
%type - [Read-only] Type of physical sensor connected to port
% Entering "DeviceType." + Tab will show you a list of possible types. If virtual brick
% is not connected to physical one, type will be DeviceType.Unknown by default.
% type (DeviceType): Type of physical sensor connected to the port. Possible types are: [READ-ONLY]
% * DeviceType.NXTTouch
% * DeviceType.NXTLight
% * DeviceType.NXTSound
% * DeviceType.NXTColor
% * DeviceType.NXTUltraSonic
% * DeviceType.NXTTemperature
% * DeviceType.LargeMotor
% * DeviceType.MediumMotor
% * DeviceType.Touch
% * DeviceType.Color
% * DeviceType.UltraSonic
% * DeviceType.Gyro
% * DeviceType.InfraRed
% * DeviceType.Unknown
% * DeviceType.None
% * DeviceType.Error
type;
end
properties (Hidden, Access = private) % Hidden properties for internal use only
commInterface = 0; % Communication interface
% commInterface (CommunicationInterface): Commands are created and sent via the
% communication interface class.
commInterface;
%port - [Read-only] Sensor port ('1'/'2'/'3'/'4')
% port (string): Sensor port.
% This is only the string representation of the sensor port to work with.
% Internally, SensorPort-enums are used.
port;
%% Miscallenous flags
% init (bool): Indicates init-phase (i.e. constructor is running).
init = true;
connectedToBrick = false; % Does (virtual) sensor-object have a valid brick-handle?
init = true; % Indicates 'init-phase' (True as long as constructor is running)
% connectedToBrick (bool): True if virtual brick is connected to physical brick.
connectedToBrick = false;
end
properties (Hidden, Dependent, Access = private)
physicalSensorConnected; % Physical sensor connected to this port?
%physicalSensorConnected (bool): True if physical sensor is connected to this port
physicalSensorConnected;
end
methods % Standard methods
%% Constructor
function sensor = Sensor(varargin)
% Sets properties of Sensor-object and indicates end of init-phase when it's done
%
% Notes:
% * input-arguments will directly be handed to Motor.setProperties
%
% Arguments:
% varargin: see setProperties(sensor, varargin)
%
sensor.setProperties(varargin{1:end});
sensor.init = false;
end
%% Brick functions
function reset(sensor)
%reset Resets value on sensor
% Resets value on sensor
%
% Note: This clears ALL the sensors right now, no other Op-Code available... :(
% Notes:
% * This clears ALL the sensors right now, no other Op-Code available... :(
if ~sensor.connectedToBrick
error('Sensor::reset: Sensor-Object not connected to comm handle.');
elseif ~sensor.physicalSensorConnected
......@@ -185,11 +222,11 @@ classdef Sensor < MaskedHandle
end
function setProperties(sensor, varargin)
%setProperties Sets multiple Sensor properties at once using MATLAB's inputParser.
% Sets multiple Sensor properties at once using MATLAB's inputParser.
%
% Arguments:
% * 'debug', 0/1/'on'/'off'/'true'/'false'
% * 'mode', DeviceMode.[...]
% debug (bool) [OPTIONAL]
% mode (DeviceMode.{Type}) [OPTIONAL]
%
% Example:
% b = EV3();
......@@ -198,7 +235,6 @@ classdef Sensor < MaskedHandle
% % Instead of: b.sensor1.debug = 'on';
% % b.sensor1.mode = DeviceMode.Color.Ambient;
%
p = inputParser();
% Set default values
......@@ -232,12 +268,6 @@ classdef Sensor < MaskedHandle
function value = get.value(sensor)
value = 0;
defaultMode = -1;
% if ~isModeValid(sensor.mode, sensor.type)
% warning('Sensor::get.value: Cannot read sensor values in current mode.');
% return;
% elseif strcmp(class(sensor.mode), 'DeviceMode.Default')
% defaultMode = 0;
% end
if sensor.connectedToBrick
value = sensor.getValue(defaultMode);
......
......@@ -8,7 +8,9 @@ if [ ! -f $LMUTIL -o ! -f $MATLAB ]; then
exit 1
fi
LANG='en_US.UTF-8'
DATUM=$( date '+%d-%b-%Y' -d '14 days' )
LANG='de_DE.UTF-8'
cd /tmp
cat >lizenzen.m <<EOF
......
......@@ -116,6 +116,26 @@ for SWP in /mnt/localfs/*/mindstorms.swp; do
swapon "$SWP"
done
# Remove work directory if not mounted
if ! mountpoint -q /home/mindstorms/work; then
echo "Removing work directory as no available mountpoint found."
rm -rf /home/mindstorms/work
fi
# Try to find mindstorms.startup directory (also on boot medium) which should include hook.sh
echo "Looking for mindstorms.startup directory (also on boot medium) which should include hook.sh ..."
for DIR in /cdrom/mindstorms.startup /mnt/localfs/*/mindstorms.startup; do
[ -d "$DIR" ] || continue
echo "Found mindstorms.startup.dir at ${DIR}. Searching for hook.sh ..."
if [ ! -f "$DIR/hook.sh" ]; then
echo "File not found!" && continue
fi
# Execute hook as mindstorms user
su - mindstorms $DIR/hook.sh && break
done
# Try to unmount all unused partitions
echo "Unmounting all unused partitions ..."
for PART in /mnt/localfs/*; do
......@@ -123,12 +143,6 @@ for PART in /mnt/localfs/*; do
umount "$PART" 2>/dev/null
done
# Remove work directory if not mounted
if ! mountpoint -q /home/mindstorms/work; then
echo "Removing work directory as no available mountpoint found."
rm -rf /home/mindstorms/work
fi
# HACK: re-enable gnome's automount functionality.
echo "Re-enabling gnome's automount functionality ..."
su - mindstorms -c "dbus-launch --exit-with-session gsettings set org.gnome.desktop.media-handling automount 'true'"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment