diff options
author | Silvino Silva <silvino@bk.ru> | 2016-10-15 01:59:41 +0100 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2016-10-15 01:59:41 +0100 |
commit | 4006c1d2a5c82f9136f82b035e4083b487b01b5b (patch) | |
tree | 6b2f3c01cddee4c8307ff2ce279168c8952f6d11 /tools/scripts | |
parent | 371d163d903373eea57cd6761223a579c18ed536 (diff) | |
parent | a2e804ad93ef562c299dfad49eb890c8d7d24010 (diff) | |
download | doc-4006c1d2a5c82f9136f82b035e4083b487b01b5b.tar.gz |
release 0.2.5
Diffstat (limited to 'tools/scripts')
-rw-r--r-- | tools/scripts/config-install.sh | 4 | ||||
-rw-r--r-- | tools/scripts/install-postgres.sh | 16 | ||||
-rw-r--r-- | tools/scripts/setup-gitolite.sh | 43 | ||||
-rw-r--r-- | tools/scripts/setup-nginx.sh (renamed from tools/scripts/install-nginx.sh) | 0 | ||||
-rw-r--r-- | tools/scripts/setup-openssh.sh | 43 | ||||
-rw-r--r-- | tools/scripts/setup-php.sh (renamed from tools/scripts/install-php.sh) | 0 | ||||
-rw-r--r-- | tools/scripts/setup-postgresql.sh | 87 | ||||
-rw-r--r-- | tools/scripts/system-iptables.sh | 6 | ||||
-rw-r--r-- | tools/scripts/system-qemu.sh | 65 |
9 files changed, 230 insertions, 34 deletions
diff --git a/tools/scripts/config-install.sh b/tools/scripts/config-install.sh deleted file mode 100644 index 061081f..0000000 --- a/tools/scripts/config-install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -CONF_DIR="$(dirname `dirname $0`)/conf" -echo "CONF_DIR=$CONF_DIR\n" diff --git a/tools/scripts/install-postgres.sh b/tools/scripts/install-postgres.sh deleted file mode 100644 index 06666e0..0000000 --- a/tools/scripts/install-postgres.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -. `dirname $0`/config-install.sh - -prt-get depinst postgresql - -cp -R $CONF_DIR/etc/rc.d/postgresql /etc/rc.d/ - -mkdir /srv/pgsql/ -touch /var/log/postgresql -chown postgres:postgres /srv/pgsql /var/log/postgresql - -sudo -u postgres initdb -D /srv/pgsql/data - -cp $CONF_DIR/srv/pgsql/data/pg_hba.conf /srv/pgsql/data/ -chown postgres:postgres /srv/pgsql/data/pg_hba.conf diff --git a/tools/scripts/setup-gitolite.sh b/tools/scripts/setup-gitolite.sh new file mode 100644 index 0000000..c42db14 --- /dev/null +++ b/tools/scripts/setup-gitolite.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# First we define the function +ConfirmOrExit () +{ + while true + do + echo -n "Please confirm (y or n) :" + read CONFIRM + case $CONFIRM in + y|Y|YES|yes|Yes) break ;; + n|N|no|NO|No) + echo "Aborting - you entered $CONFIRM" + exit + ;; + *) echo "Please enter only y or n" + esac + done + echo "You entered $CONFIRM. Continuing ..." +} + + +# Absolute path to this script, e.g. /home/user/bin/foo.sh +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +SCRIPTPATH=$(dirname "$SCRIPT") + +DIR=$(dirname "$SCRIPTPATH"); +DIR_CONF=$DIR"/conf" + +echo "SCRIPT=$SCRIPT"; +echo "SCRIPTPATH=$SCRIPTPATH"; +echo "DIR=$DIR"; +echo "DIR_CONF=$DIR_CONF"; +ConfirmOrExit + + prt-get depinst gitolite + + mkdir -p /srv/gitolite + useradd -U -d /srv/gitolite gitolite + chown gitolite:gitolite /srv/gitolite + +exit 0; diff --git a/tools/scripts/install-nginx.sh b/tools/scripts/setup-nginx.sh index decacc1..decacc1 100644 --- a/tools/scripts/install-nginx.sh +++ b/tools/scripts/setup-nginx.sh diff --git a/tools/scripts/setup-openssh.sh b/tools/scripts/setup-openssh.sh new file mode 100644 index 0000000..14afe8b --- /dev/null +++ b/tools/scripts/setup-openssh.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# First we define the function +ConfirmOrExit () +{ + while true + do + echo -n "Please confirm (y or n) :" + read CONFIRM + case $CONFIRM in + y|Y|YES|yes|Yes) break ;; + n|N|no|NO|No) + echo "Aborting - you entered $CONFIRM" + exit + ;; + *) echo "Please enter only y or n" + esac + done + echo "You entered $CONFIRM. Continuing ..." +} + + +# Absolute path to this script, e.g. /home/user/bin/foo.sh +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +SCRIPTPATH=$(dirname "$SCRIPT") + +DIR=$(dirname "$SCRIPTPATH"); +DIR_CONF=$DIR"/conf" + +echo "SCRIPT=$SCRIPT"; +echo "SCRIPTPATH=$SCRIPTPATH"; +echo "DIR=$DIR"; +echo "DIR_CONF=$DIR_CONF"; +ConfirmOrExit + + + #installer overwrite system init script + cp -R $DIR_CONF/etc/ssh/sshd_config /etc/ssh/sshd_config + + sh /etc/rc.d/sshd start + +exit 0; diff --git a/tools/scripts/install-php.sh b/tools/scripts/setup-php.sh index 4c28173..4c28173 100644 --- a/tools/scripts/install-php.sh +++ b/tools/scripts/setup-php.sh diff --git a/tools/scripts/setup-postgresql.sh b/tools/scripts/setup-postgresql.sh new file mode 100644 index 0000000..4e1ee3a --- /dev/null +++ b/tools/scripts/setup-postgresql.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +# First we define the function +ConfirmOrExit () +{ + while true + do + echo -n "Please confirm (y or n) :" + read CONFIRM + case $CONFIRM in + y|Y|YES|yes|Yes) break ;; + n|N|no|NO|No) + echo "Aborting - you entered $CONFIRM" + exit + ;; + *) echo "Please enter only y or n" + esac + done + echo "You entered $CONFIRM. Continuing ..." +} + + +# Absolute path to this script, e.g. /home/user/bin/foo.sh +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +SCRIPTPATH=$(dirname "$SCRIPT") + +DIR=$(dirname "$SCRIPTPATH"); +DIR_CONF=$DIR"/conf" + +echo "SCRIPT=$SCRIPT"; +echo "SCRIPTPATH=$SCRIPTPATH"; +echo "DIR=$DIR"; +echo "DIR_CONF=$DIR_CONF"; +ConfirmOrExit + +IS_INSTALL=$(prt-get isinst postgresql); +echo $IS_INSTALL; +if [ "$IS_INSTALL" = "package postgresql is installed" ] +then + echo "updating postgresql" + OLD_VERSION=$(prt-get current postgresql); + echo $OLD_VERSION; + + sudo -u postgres pg_dumpall > /srv/pgsql/dump-$OLD_VERSION.sql + + sh /etc/rc.d/postgresql stop + + #extra backup, in case ... + tar --xattrs -zcpf /srv/pgsql/data-$OLD_VERSION.tar.gz \ + --directory=/srv/pgsql/data . + + rm -R /srv/pgsql/data + + prt-get update postgresql + + NEW_VERSION=$(prt-get current postgresql); + echo $NEW_VERSION; + + sudo -u postgres initdb -D /srv/pgsql/data + + rejmerge + #installer overwrite system init script + cp -R $DIR_CONF/etc/rc.d/postgresql /etc/rc.d/ + + sh /etc/rc.d/postgresql start + sleep 5 + + sudo -u postgres psql -d postgres -f /srv/pgsql/dump-$OLD_VERSION.sql + +else + echo "install postgresql and dependencies" + prt-get depinst postgresql + + cp -R $DIR_CONF/etc/rc.d/postgresql /etc/rc.d/ + + mkdir /srv/pgsql/ + touch /var/log/postgresql + chown postgres:postgres /srv/pgsql /var/log/postgresql + + sudo -u postgres initdb -D /srv/pgsql/data + + cp $DIR_CONF/srv/pgsql/data/pg_hba.conf /srv/pgsql/data/ + chown postgres:postgres /srv/pgsql/data/pg_hba.conf +fi + +exit 0; diff --git a/tools/scripts/system-iptables.sh b/tools/scripts/system-iptables.sh index 4ec3b79..429efde 100644 --- a/tools/scripts/system-iptables.sh +++ b/tools/scripts/system-iptables.sh @@ -339,9 +339,9 @@ $IPT -A OUTPUT -o ${PUB_IF} -p tcp --sport 1024:65535 --dport 1024: -m state -- # $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 2100 -j ACCEPT # $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 9990 -j ACCEPT # -# echo "Allow wesnoth" -# $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 15000 -m state --state NEW -j ACCEPT -# $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 14998 -m state --state NEW -j ACCEPT + echo "Allow wesnoth" + $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 15000 -m state --state NEW -j ACCEPT + $IPT -A OUTPUT -o ${PUB_IF} -p tcp --dport 14998 -m state --state NEW -j ACCEPT ##### END your rules ############ # Less log of known traffic diff --git a/tools/scripts/system-qemu.sh b/tools/scripts/system-qemu.sh index 8c68e70..489af5e 100644 --- a/tools/scripts/system-qemu.sh +++ b/tools/scripts/system-qemu.sh @@ -1,15 +1,58 @@ #!/bin/sh -ISO=~/crux-3.2.iso -IMG=~/crux-img.qcow2 -TAP=$1 +# First we define the function +ConfirmOrExit () +{ + while true + do + echo -n "Please confirm (y or n) :" + read CONFIRM + case $CONFIRM in + y|Y|YES|yes|Yes) break ;; + n|N|no|NO|No) + echo "Aborting - you entered $CONFIRM" + exit + ;; + *) echo "Please enter only y or n" + esac + done + echo "You entered $CONFIRM. Continuing ..." +} -echo "TAP: $TAP" +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +SCRIPTPATH=$(dirname "$SCRIPT") -qemu-system-x86_64 \ - -enable-kvm \ - -m 1024 \ - -boot d \ - -cdrom ${ISO} \ - -hda ${IMG} \ - -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no +DIR=$(dirname "$SCRIPTPATH"); +DIR_LOCAL="$(dirname $(dirname ${DIR}))/local"; + +MEM=$1 +TAP=$2 +ISO_FILE="${DIR_LOCAL}/$3" +IMG="${DIR_LOCAL}/$4" + +echo "MEM (512): $MEM" +echo "TAP (tap1): $TAP" +echo "ISO_FILE (crux-3.2.iso): $ISO_FILE" +echo "IMG (crux-img.qcow2): $IMG" +ConfirmOrExit + +if [ "$ISO_FILE" = "$DIR_LOCAL/" ] +then + qemu-system-x86_64 \ + -enable-kvm \ + -m $MEM \ + -boot c \ + -hda ${IMG} \ + -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no +else + qemu-system-x86_64 \ + -enable-kvm \ + -m $MEM \ + -boot d \ + -cdrom ${ISO_FILE} \ + -hda ${IMG} \ + -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no +fi + +exit 0; |