Check-in [5a5a932e2b]
Not logged in
Overview
Comment:Add Bash scripts for installing the client on POSIX compliant systems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a5a932e2b910879b580c8de48328d8a40f8b766
User & Date: mistachkin on 2017-12-20 00:51:08
Other Links: manifest | tags
Context
2017-12-21
08:10
Minor tweak to POSIX install Bash script. Revise (and make consistent) argument order for GPG version detection. check-in: a4f23fa746 user: mistachkin tags: trunk
2017-12-20
00:51
Add Bash scripts for installing the client on POSIX compliant systems. check-in: 5a5a932e2b user: mistachkin tags: trunk
2017-12-19
23:53
Attempt to disable home directory usage for GPG detection. Bump client version to 1.0.5. check-in: 337bd1593a user: mistachkin tags: trunk
Changes

Added tools/pkgr_an_d_get.sh version [c3d91f2ca4].



































































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/bash

if [ ! -x "$(command -v tclsh)" ]; then
  echo "The program 'tclsh' is apparently not installed."
  echo "Please use 'apt-get install tcl8.6' (Linux)."
  exit 1
fi

echo "exit [catch {package require tls}]" | tclsh

if [ $? -ne 0 ]; then
  echo the "The 'tls' package for Tcl is not installed."
  echo "Please use 'apt-get install tcl-tls' (Linux)."
  exit 1
fi

if [ ! -x "$(command -v wget)" ] && [ ! -x "$(command -v curl)" ]; then
  echo "The programs 'wget' and/or 'curl' are apparently not installed."
  echo "Please use 'apt-get install wget' (Linux) or 'brew install wget' (Mac)."
  exit 1
fi

if [ -x "$(command -v gpg2)" ]; then
  PKGR_GPG_VER_OK=$(echo "puts [regexp -- {^gpg \(GnuPG\) 2\.[0123]\.} [exec gpg2 --version --homedir {}]]" | tclsh)
elif [ -x "$(command -v gpg)" ]; then
  PKGR_GPG_VER_OK=$(echo "puts [regexp -- {^gpg \(GnuPG\) 2\.[0123]\.} [exec gpg --version --homedir {}]]" | tclsh)
else
  echo "The program 'gpg2' (a.k.a. 'gpg') is apparently not installed."
  echo "Please use 'apt-get install gnupg2' (Linux) or 'brew install gnupg' (Mac)."
  exit 1
fi

if [ "$PKGR_GPG_VER_OK" != "1" ]; then
  echo "The program 'gpg2' (a.k.a. 'gpg') is returning an unsupported version."
  echo "Please use 'apt-get install gnupg2' (Linux) or 'brew install gnupg' (Mac)."
  exit 1
fi

if [ ! -x "$(command -v date)" ]; then
  echo "The program 'date' is apparently not installed."
  exit 1
fi

PKGR_TMP_ID=$(date +%s)

if [ -z "${PKGR_TMP_ID}" ]; then
  echo "Could not create a unique temporary identifier."
  exit 1
fi

PKGR_TMP_ROOT=pkgr_tmproot_${PKGR_TMP_ID}

mkdir -p "${PKGR_TMP_ROOT}/pkgdtmp" || exit 1
mkdir -p "${PKGR_TMP_ROOT}/download" || exit 1
pushd "${PKGR_TMP_ROOT}/download" || exit 1

PKGR_CLIENT_URI=https://urn.to/r/pkg_client_full
PKGR_TMP_FILE=pkgrd_tmp_file.zip
PKGR_GET_OK=0

if [ -x "$(command -v wget)" ]; then
  for wgetArg in "" "--no-check-certificate"
  do
    wget -4 $wgetArg "--output-document=${PKGR_TMP_FILE}" "${PKGR_CLIENT_URI}"
    if [ $? -eq 0 ] && [ -f "${PKGR_TMP_FILE}" ]; then
      PKGR_GET_OK=1
      break
    fi
  done
else
  for curlArg in "" "--insecure"
  do
    curl -4 $curlArg --location "${PKGR_CLIENT_URI}" > "${PKGR_TMP_FILE}"
    if [ $? -eq 0 ] && [ -f "${PKGR_TMP_FILE}" ]; then
      PKGR_GET_OK=1
      break
    fi
  done
fi

if [ $PKGR_GET_OK -eq 0 ] || [ ! -f "${PKGR_TMP_FILE}" ]; then
  echo "Could not download the package client toolset archive."
  exit 1
fi

unzip -o "${PKGR_TMP_FILE}" || exit 1

popd || exit 1
pushd "${PKGR_TMP_ROOT}" || exit 1

export PKGR_TEMP=pkgdtmp
export PKGR_SETUP_TEMP=pkgdtmp
export PKGD_TEMP=pkgdtmp

echo "Running package client toolset setup as current user..."
tclsh "download/pkgr_an_d/client/1.0/neutral/pkgr_setup.eagle"

popd || exit 1

Added tools/pkgr_an_d_install.sh version [a4c9c84bf3].































































































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/bash

if [ ! -x "$(command -v tclsh)" ]; then
  echo "The program 'tclsh' is apparently not installed."
  echo "Please use 'apt-get install tcl8.6' (Linux)."
  exit 1
fi

echo "exit [catch {package require tls}]" | tclsh

if [ $? -ne 0 ]; then
  echo the "The 'tls' package for Tcl is not installed."
  echo "Please use 'apt-get install tcl-tls' (Linux)."
  exit 1
fi

if [ ! -x "$(command -v wget)" ] && [ ! -x "$(command -v curl)" ]; then
  echo "The programs 'wget' and/or 'curl' are apparently not installed."
  echo "Please use 'apt-get install wget' (Linux) or 'brew install wget' (Mac)."
  exit 1
fi

if [ -x "$(command -v gpg2)" ]; then
  PKGR_GPG_VER_OK=$(echo "puts [regexp -- {^gpg \(GnuPG\) 2\.[0123]\.} [exec gpg2 --homedir {} --version]]" | tclsh)
elif [ -x "$(command -v gpg)" ]; then
  PKGR_GPG_VER_OK=$(echo "puts [regexp -- {^gpg \(GnuPG\) 2\.[0123]\.} [exec gpg --homedir {} --version]]" | tclsh)
else
  echo "The program 'gpg2' (a.k.a. 'gpg') is apparently not installed."
  echo "Please use 'apt-get install gnupg2' (Linux) or 'brew install gnupg' (Mac)."
  exit 1
fi

if [ "$PKGR_GPG_VER_OK" != "1" ]; then
  echo "The program 'gpg2' (a.k.a. 'gpg') is returning an unsupported version."
  echo "Please use 'apt-get install gnupg2' (Linux) or 'brew install gnupg' (Mac)."
  exit 1
fi

if [ ! -x "$(command -v date)" ]; then
  echo "The program 'date' is apparently not installed."
  exit 1
fi

if [ ! -x "$(command -v sudo)" ]; then
  echo "The program 'sudo' is apparently not installed."
  exit 1
fi

if [ ! -x "$(command -v logname)" ]; then
  echo "The program 'logname' is apparently not installed."
  exit 1
fi

PKGR_LOGIN_USER=$SUDO_USER

if [ -z "${PKGR_LOGIN_USER}" ]; then
  PKGR_LOGIN_USER=$(logname)
fi

if [ -z "${PKGR_LOGIN_USER}" ]; then
  echo "Could not determine the original login name."
  exit 1
fi

PKGR_ROOT_DIR=$(echo "puts [file dirname [set tcl_library]]" | tclsh)

if [ -z "${PKGR_ROOT_DIR}" ]; then
  echo "Could not determine parent directory of Tcl library directory."
  exit 1
fi

if [ ! -w "${PKGR_ROOT_DIR}" ]; then
  echo "Parent directory of Tcl library directory is not writable."
  exit 1
fi

PKGR_TMP_ID=$(date +%s)

if [ -z "${PKGR_TMP_ID}" ]; then
  echo "Could not create a unique temporary identifier."
  exit 1
fi

PKGR_INSTALL_DIR=${PKGR_ROOT_DIR}/pkgd
PKGR_TMP_DIR=~/pkgdtmp

mkdir -p "${PKGR_INSTALL_DIR}" || exit 1
sudo -u "${PKGR_LOGIN_USER}" mkdir -p "${PKGR_TMP_DIR}" || exit 1

PKGR_CLIENT_URI=https://urn.to/r/pkg_client_full
PKGR_TMP_FILE=${PKGR_TMP_DIR}/pkgrd_tmp_${PKGR_TMP_ID}_file.zip
PKGR_GET_OK=0

if [ -x "$(command -v wget)" ]; then
  for wgetArg in "" "--no-check-certificate"
  do
    wget -4 $wgetArg "--output-document=${PKGR_TMP_FILE}" "${PKGR_CLIENT_URI}"
    if [ $? -eq 0 ] && [ -f "${PKGR_TMP_FILE}" ]; then
      PKGR_GET_OK=1
      break
    fi
  done
else
  for curlArg in "" "--insecure"
  do
    curl -4 $curlArg --location "${PKGR_CLIENT_URI}" > "${PKGR_TMP_FILE}"
    if [ $? -eq 0 ] && [ -f "${PKGR_TMP_FILE}" ]; then
      PKGR_GET_OK=1
      break
    fi
  done
fi

if [ $PKGR_GET_OK -eq 0 ] || [ ! -f "${PKGR_TMP_FILE}" ]; then
  echo "Could not download the package client toolset archive."
  exit 1
fi

unzip -o "${PKGR_TMP_FILE}" -d "${PKGR_INSTALL_DIR}" || exit 1

export PKGR_TEMP=${PKGR_TMP_DIR}
export PKGR_SETUP_TEMP=${PKGR_TMP_DIR}
export PKGD_TEMP=${PKGR_TMP_DIR}

echo "Running package client toolset setup as user '${PKGR_LOGIN_USER}'..."
sudo -u "${PKGR_LOGIN_USER}" "PKGR_TEMP=$PKGR_TEMP" "PKGR_SETUP_TEMP=$PKGR_SETUP_TEMP" "PKGD_TEMP=PKGD_TEMP" tclsh "${PKGR_INSTALL_DIR}/pkgr_an_d/client/1.0/neutral/pkgr_setup.eagle"