summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2014-09-08 18:43:43 (GMT)
committer Jaromil <jaromil@dyne.org>2014-09-08 18:43:43 (GMT)
commit9978156ee4cadf1e8ed399337eaaa8924ee2ce97 (patch)
tree0432ee75957c1e6327b010bbf0c32981c6769e8a
parent1b1fc63bf42e8fc2a981e06df851c74022a16d77 (diff)
Moved configuration files to conf/
First helper script for ssh daemon: z-ssh Fixed usage of cat << EOF in Zsh scripts (TMPPREFIX) Added tmux (experimental)
-rw-r--r--build/network/conf.zsh10
-rw-r--r--build/system/Sources4
-rw-r--r--build/system/conf.zsh14
-rw-r--r--conf/README.txt2
-rw-r--r--conf/etc/grmlrc (renamed from build/system/etc/grmlrc)0
-rw-r--r--conf/etc/skel/grml.conf (renamed from build/system/etc/skel/grml.conf)0
-rw-r--r--conf/etc/skel/profile (renamed from build/system/etc/skel/profile)0
-rw-r--r--conf/etc/skel/vimrc (renamed from build/system/etc/skel/vimrc)0
-rw-r--r--conf/etc/skel/xdg/mc/ini (renamed from build/system/etc/skel/xdg/mc/ini)0
-rw-r--r--conf/etc/skel/zshrc (renamed from build/system/etc/skel/zshrc)0
-rw-r--r--conf/etc/ssh/ssh_config (renamed from build/network/etc/ssh/ssh_config)0
-rw-r--r--conf/etc/ssh/sshd_config (renamed from build/network/etc/ssh/sshd_config)0
-rwxr-xr-xconf/etc/zlogin (renamed from build/system/etc/zlogin)2
-rwxr-xr-xconf/helpers/z-ssh119
-rw-r--r--pack/conf.zsh21
-rw-r--r--pack/dojos/0.9.1/system.tree1
16 files changed, 147 insertions, 26 deletions
diff --git a/build/network/conf.zsh b/build/network/conf.zsh
index 732dda2..0505e47 100644
--- a/build/network/conf.zsh
+++ b/build/network/conf.zsh
@@ -61,13 +61,17 @@ zinstall rsync
# make git
notice "Building git"
GIT_FLAGS=(prefix=${APKPATH}/files/system NO_INSTALL_HARDLINKS=1 NO_NSEC=1 NO_ICONV=1)
-GIT_FLAGS+=(CURLDIR=$PREFIX OPENSSLDIR=$PREFIX)
+GIT_FLAGS+=(CURLDIR=$PREFIX) # OPENSSLDIR=$PREFIX)
GIT_FLAGS+=(NO_PERL=1 NO_PYTHON=1)
{ test -r git.done } || {
pushd git
autoconf
-LIBS="$LIBS -lz -ldl -lssl -lcurl -lcrypto" \
- zconfigure default "--without-iconv --with-openssl=$PREFIX --with-curl=$PREFIX"
+
+# -lssl
+LIBS="$LIBS -lz -ldl -lcurl -lcrypto" \
+ zconfigure default "--without-iconv --with-curl=$PREFIX"
+# --with-openssl=$PREFIX
+
{ test $? = 0 } && {
LIBS="$LIBS" make git ${GIT_FLAGS}
pushd templates
diff --git a/build/system/Sources b/build/system/Sources
index d10b545..3376818 100644
--- a/build/system/Sources
+++ b/build/system/Sources
@@ -3,13 +3,13 @@
zlib -1.2.5 .tar.gz http://www.gnu.org
ncurses -5.9 .tar.gz
slang -2.2.4 .tar.bz2 http://www.jedsoft.org/slang
-zsh -5.0.5 .tar.bz2 http://www.zsh.org
+zsh -5.0.2 .tar.bz2 http://www.zsh.org
# zsh -4.3.15 .tar.bz2 http://www.zsh.org
sed -4.2.1 .tar.bz2 http://www.gnu.org
gawk -4.0.0 .tar.bz2 http://www.gnu.org
grep -2.9 .tar.gz http://www.gnu.org
diffutils -3.2 .tar.gz http://www.gnu.org
-file -5.19 .tar.gz
+file -5.11 .tar.gz
less -451 .tar.gz
most -5.0.0a .tar.bz2 http://www.jedsoft.org/slang
htop -1.0 .tar.gz
diff --git a/build/system/conf.zsh b/build/system/conf.zsh
index 2518034..8140258 100644
--- a/build/system/conf.zsh
+++ b/build/system/conf.zsh
@@ -107,6 +107,13 @@ compile wipe default
act "Wipe installed."
}
+## tmux
+compile tmux default "--enable-static"
+#pushd tmux
+#zmake
+zinstall tmux
+
+
return
@@ -116,13 +123,6 @@ return
## libevent
compile libevent default
zinstall libevent
-
-## tmux
-compile tmux default "--enable-static"
-#pushd tmux
-#zmake
-zinstall tmux
-
# ## shellinabox
# { test ! -r $pkg[shellinabox].done } && {
# cp $pkg[shellinabox].configure.ac $pkg[shellinabox]/configure.ac
diff --git a/conf/README.txt b/conf/README.txt
new file mode 100644
index 0000000..b8ba3bb
--- /dev/null
+++ b/conf/README.txt
@@ -0,0 +1,2 @@
+Here are the manual configurations
+
diff --git a/build/system/etc/grmlrc b/conf/etc/grmlrc
index 575a497..575a497 100644
--- a/build/system/etc/grmlrc
+++ b/conf/etc/grmlrc
diff --git a/build/system/etc/skel/grml.conf b/conf/etc/skel/grml.conf
index b532688..b532688 100644
--- a/build/system/etc/skel/grml.conf
+++ b/conf/etc/skel/grml.conf
diff --git a/build/system/etc/skel/profile b/conf/etc/skel/profile
index bcbf7b8..bcbf7b8 100644
--- a/build/system/etc/skel/profile
+++ b/conf/etc/skel/profile
diff --git a/build/system/etc/skel/vimrc b/conf/etc/skel/vimrc
index 15375a1..15375a1 100644
--- a/build/system/etc/skel/vimrc
+++ b/conf/etc/skel/vimrc
diff --git a/build/system/etc/skel/xdg/mc/ini b/conf/etc/skel/xdg/mc/ini
index 0c085a8..0c085a8 100644
--- a/build/system/etc/skel/xdg/mc/ini
+++ b/conf/etc/skel/xdg/mc/ini
diff --git a/build/system/etc/skel/zshrc b/conf/etc/skel/zshrc
index 4d60360..4d60360 100644
--- a/build/system/etc/skel/zshrc
+++ b/conf/etc/skel/zshrc
diff --git a/build/network/etc/ssh/ssh_config b/conf/etc/ssh/ssh_config
index 1893674..1893674 100644
--- a/build/network/etc/ssh/ssh_config
+++ b/conf/etc/ssh/ssh_config
diff --git a/build/network/etc/ssh/sshd_config b/conf/etc/ssh/sshd_config
index 87dcf0e..87dcf0e 100644
--- a/build/network/etc/ssh/sshd_config
+++ b/conf/etc/ssh/sshd_config
diff --git a/build/system/etc/zlogin b/conf/etc/zlogin
index ee0dd47..9dd68e9 100755
--- a/build/system/etc/zlogin
+++ b/conf/etc/zlogin
@@ -8,7 +8,7 @@ export HOME=/data/data/org.dyne.zshaolin/files
# included from our ~/.zshrc (which also gets rewritten here)
export SYS=$HOME/system
-export PATH=$SYS/bin:$SYS/sbin:$SYS/busybox/bin:$SYS/busybox/sbin:/system/xbin:$PATH
+export PATH=$SYS/bin:$SYS/sbin:$SYS/busybox/bin:$SYS/busybox/sbin:$SYS/helpers:/system/xbin:$PATH
export SHELL="$SYS/bin/zsh"
export TMPDIR=$HOME/tmp
export TMPPREFIX=$TMPDIR
diff --git a/conf/helpers/z-ssh b/conf/helpers/z-ssh
new file mode 100755
index 0000000..72697af
--- /dev/null
+++ b/conf/helpers/z-ssh
@@ -0,0 +1,119 @@
+#!env zsh
+
+# Copyright (C) 2014 Denis Roio <jaromil@dyne.org>
+#
+# This source code is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This source code is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# Please refer to the GNU Public License for more details.
+#
+# You should have received a copy of the GNU Public License along with
+# this source code; if not, write to:
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+FILES=/data/data/org.dyne.zshaolin/files
+SYS=$FILES/system
+VAR=$FILES/.ssh
+dsa="$VAR/ssh_host_dsa_key"
+rsa="$VAR/ssh_host_rsa_key"
+client="$VAR/ssh_client_rsa_key"
+httpport="2221"
+port="2222"
+
+IP=`ifconfig | awk '/127.0.0.1/ { next } /inet addr/ { print $2 }'`
+IP=${IP[(ws@:@)2]}
+ID=`id -un`
+
+pid=`ps | awk '/awk/ {next} /'"$ID"'.*sshd/ {print $1}'`
+httppid=`ps | awk '/awk/ {next} /'"$ID"'.*httpd.*'"$httpport"'/ {print $1}'`
+
+# check permissions first and at every run
+mkdir -p $VAR
+chmod -R go-rwx $VAR
+
+print "ZShaolin's SSH script invoked."
+
+[[ $1 = off ]] || [[ $1 = stop ]] || [[ $1 = "kill" ]] && {
+ [[ "$pid" = "" ]] && {
+ print "Our SSH daemon is not running"
+ return 0 }
+ print "Stopping SSHD (pid $pid)"; kill $pid
+ [[ "$httppid" = "" ]] || {
+ print "Stopping HTTPD (pid $httppid)"; kill $httppid }
+ return 0
+}
+
+[[ $1 = secure ]] && {
+ [[ $httppid = "" ]] && {
+ print "Our HTTP daemon is not running"
+ return 0 }
+ print "Securing the key and stop serving it over HTTP"
+ print
+ print "Stopping HTTPD (pid $httppid)"; kill $httppid
+ return 0
+}
+
+connectinfo() {
+ cat <<EOF
+Login permitted as $ID on $IP:$port
+
+SSH access key file to use: $client
+this needs to be copied to the client device to be used.
+
+At your terminal convenience, download and run in few steps:
+
+ curl http://$IP:$httpport/ssh-to-z.sh ; sh ssh-to-z.sh
+
+It logins for you and creates a zshaolin.key for later use
+
+To stop SSHD type: z-ssh off
+
+To stop httpd serving the key: z-ssh secure
+EOF
+}
+
+# if we are here is because we want to start SSHD
+# then first check if its already running
+[[ "$pid" = "" ]] || {
+ print "SSHD is already running (pid $pid)"
+ connectinfo
+ return 0
+}
+
+{ test -r $dsa } || { ssh-keygen -t dsa -f $dsa -P ''}
+{ test -r $rsa } || { ssh-keygen -t rsa -f $rsa -P ''}
+
+{ test -r $client } || { ssh-keygen -t rsa -f $client -P ''}
+
+{ test -r $FILES/tmp } || { mkdir $FILES/tmp }
+
+{ test -r $VAR } || {
+ mkdir -p $VAR
+ ln -s $SYS/etc/zlogin $FILES/.ssh/environment }
+
+{ test -r $FILES/.ssh/authorized_keys } || {
+ cp ${client}.pub $FILES/.ssh/authorized_keys }
+
+key=`cat $client`
+mkdir -p $FILES/tmp/z-ssh
+cat << EOF > ${FILES}/tmp/z-ssh/ssh-to-z.sh
+#!/bin/sh
+echo "Logging into ZShaolin running on Android via SSH"
+echo "$key" > zshaolin.key
+chmod 600 zshaolin.key
+ssh -i zshaolin.key -p ${port} ${ID}@${IP}
+EOF
+
+$SYS/bin/sshd -p 2222
+[[ $? = 0 ]] && {
+ httpd -p $httpport -h $FILES/tmp/z-ssh/
+ print "SSH daemon running and accepting connections"
+ connectinfo
+ return 0
+}
+
diff --git a/pack/conf.zsh b/pack/conf.zsh
index 95ae408..9da8d7f 100644
--- a/pack/conf.zsh
+++ b/pack/conf.zsh
@@ -16,18 +16,13 @@ export STRIP=${TOOLCHAIN}/bin/${TARGET}-strip
streamline_zshaolin() {
act "including core scripts in dojo"
- # list of core configurations
- rm -f zshaolin.etc
- cat <<EOF > zshaolin.etc
-./var/pid
-./var/log
-./etc/grmlrc
-./etc/zlogin
-./etc/skel
-EOF
- # do the copy
- rsync -dar --files-from=zshaolin.etc $ZHOME/system floor/
- # zcompile the big stuff
+ mkdir -p floor/var/pid
+ mkdir -p floor/var/log
+
+ # now etc and the helper scripts (new since 0.9.1)
+ rsync -ar $ZHOME/conf/etc floor/
+ rsync -ar $ZHOME/conf/helpers floor/
+ # eventually zcompile some helpers, still too small to need that
zcompile floor/etc/grmlrc
rm -f zshaolin.etc
@@ -159,8 +154,8 @@ act "module: $module"
clean_floor # clean first and every time a new pack is done
# create the dojo
- streamline_zshaolin # scripts
streamline dojos/$module # binaries
+ streamline_zshaolin # confs and scripts
strip_floor # strips all in floor
pack_dojo # pack and copy into assets
return 0
diff --git a/pack/dojos/0.9.1/system.tree b/pack/dojos/0.9.1/system.tree
index 56a6ac8..557bc7a 100644
--- a/pack/dojos/0.9.1/system.tree
+++ b/pack/dojos/0.9.1/system.tree
@@ -21,6 +21,7 @@
./bin/mandoc
./bin/demandoc
./bin/file
+./bin/tmux
./libexec
./libexec/awk
./libexec/awk/grcat