aboutsummaryrefslogtreecommitdiff
path: root/project/setup/sendto-install.sh
blob: abbdf72ebb27f97b21bd196379df124699e838fe (plain) (blame)
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
#!/usr/bin/env bash

    #####################################################################
    ##                    _______ _______ _______                      ##
    ##                   |  ___  |____   |  ___  |                     ##
    ##                   | |   |_|    / /| |   |_|                     ##
    ##                   | |_____    / / | |_____                      ##
    ##                   |_____  |  / /  |_____  |                     ##
    ##                    _    | | / /    _    | |                     ##
    ##                   | |___| |/ /____| |___| |                     ##
    ##                   |_______|_______|_______|                     ##
    ##                                                                 ##
    ##                        Wiimms SZS Tools                         ##
    ##                      http://szs.wiimm.de/                       ##
    ##                                                                 ##
    #####################################################################
    ##                                                                 ##
    ##   This file is part of the SZS project.                         ##
    ##   Visit http://szs.wiimm.de/ for project details and sources.   ##
    ##                                                                 ##
    ##   Copyright (c) 2011-2019 by Dirk Clemens <wiimm@wiimm.de>      ##
    ##                                                                 ##
    #####################################################################

#------------------------------------------------------------------------------
# simple cygwin check

if [[ $1 != --cygwin ]]
then
    echo "Option --cygwin not set => exit" >&2
    exit 1
fi

#------------------------------------------------------------------------------
# pre definitions

WIN_INSTALL_PATH="Wiimm/SZS"

#------------------------------------------------------------------------------
echo "* setup"

export PATH=".:$PATH"
mkdir -p /tmp

#---------------

SENDTO_SRC=./windows-sendto
if [[ ! -d $SENDTO_SRC ]]
then
    SENDTO_SRC="$WIN_INSTALL_PATH/windows-sendto"
    if [[ ! -d $SENDTO_SRC ]]
    then
	echo "Can't find SendTo source => abort" >&2
	exit 1
    fi
fi

#---------------

key="/user/Software/Microsoft/Windows/CurrentVersion/Explorer/Shell Folders/SendTo"
if ! WIN_SENDTO_PATH="$(regtool get "$key")" || [[ $WIN_SENDTO_PATH = "" ]]
then
    echo "Can't determine Windows program path => abort" >&2
    exit 1
fi
CYGWIN_SENDTO_PATH="${WIN_SENDTO_PATH//\\//}"


#------------------------------------------------------------------------------
echo "* install SendTo scripts"
echo "   - SendTo source: $SENDTO_SRC"
echo "   - SendTo folder: $WIN_SENDTO_PATH"
echo "   -            ->: $CYGWIN_SENDTO_PATH"

cp -p "$SENDTO_SRC"/* "$CYGWIN_SENDTO_PATH/"

#------------------------------------------------------------------------------

exit 0