]> jfr.im git - z_archive/vpsm.git/commitdiff
Starting files blabla
authorJohn Runyon <redacted>
Thu, 20 Jun 2013 04:11:39 +0000 (23:11 -0500)
committerJohn Runyon <redacted>
Thu, 20 Jun 2013 04:11:39 +0000 (23:11 -0500)
.gitignore [new file with mode: 0644]
install.sh [new file with mode: 0644]
vpsm/class.node.php [new file with mode: 0644]
vpsm/common.php [new file with mode: 0644]
vpsm/config.php.example [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..4f4773f
--- /dev/null
@@ -0,0 +1 @@
+config.php
diff --git a/install.sh b/install.sh
new file mode 100644 (file)
index 0000000..3dde04a
--- /dev/null
@@ -0,0 +1,37 @@
+TGZ_URL="" # default link and stuff
+PUBKEY_URL=""
+
+set -e
+
+if ! grep "vpsm" /etc/passwd >/dev/null 2>&1; then
+       adduser -M -d /opt/vpsm/ -c "VPSM user" -s /opt/vpsm/shell vpsm
+       mkdir /opt/vpsm
+else
+       rm -rf /opt/vpsm
+       mkdir /opt/vpsm
+fi
+
+cd /opt/vpsm
+
+if [ "$TGZ_URL" ]; then
+       wget -O vpsm.tgz "$TGZ_URL"
+else
+       read -e -p "Save the node distribution as /opt/vpsm/vpsm.tgz and press enter..." somevar
+fi
+tar -xpzf vpsm.tgz
+rm vpsm.tgz
+
+mkdir /opt/vpsm/.ssh
+if [ -z "$PUBKEY_URL" ]; then
+       read -e -p "Type URL to VPSM's public key (or just press enter to not fetch): " PUBKEY_URL
+fi
+if [ "$PUBKEY_URL" ]; then
+       wget -O - "$PUBKEY_URL" >>/opt/vpsm/.ssh/authorized_keys
+fi
+
+# Last step: chown/chmod
+chown -R vpsm: /opt/vpsm
+chmod 711 /opt/vpsm/
+chmod 755 /opt/vpsm/shell
+chmod 700 /opt/vpsm/.ssh/
+chmod 600 /opt/vpsm/.ssh/authorized_keys
diff --git a/vpsm/class.node.php b/vpsm/class.node.php
new file mode 100644 (file)
index 0000000..8403b28
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+define('ROOTPATH', dirname(__FILE__).'/');
+
+require_once(ROOTPATH.'common.php');
+
+abstract class Node {
+       abstract public function createct();
+       public function getnode($id) {
+               
+       }
+}
diff --git a/vpsm/common.php b/vpsm/common.php
new file mode 100644 (file)
index 0000000..5cac432
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+if (!defined('ROOTPATH'))
+       die("Invalid access");
+
+if (!isset($config) || !is_array($config))
+       $config = array();
+
+require_once('config.php');
diff --git a/vpsm/config.php.example b/vpsm/config.php.example
new file mode 100644 (file)
index 0000000..29fa465
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+if (!defined('ROOTPATH'))
+       die("Invalid access");
+
+/* Database settings */
+$config['db']['hostname'] = 'localhost';
+$config['db']['username'] = 'vpsm';
+$config['db']['password'] = 'somepass';
+$config['db']['database'] = 'vpsm';
+$config['db']['prefix']   = 'vpsm_';