diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/_cac_curl_api_v1 | 10 | ||||
-rwxr-xr-x | bin/_cac_exec | 8 | ||||
-rwxr-xr-x | bin/_cac_get_api_v1 | 3 | ||||
-rwxr-xr-x | bin/_cac_post_api_v1 | 3 | ||||
-rwxr-xr-x | bin/cac-cloudpro-build | 5 | ||||
-rwxr-xr-x | bin/cac-cloudpro-delete | 3 | ||||
-rwxr-xr-x | bin/cac-cloudpro-resources | 3 | ||||
-rwxr-xr-x | bin/cac-console | 3 | ||||
-rwxr-xr-x | bin/cac-get-server-by | 17 | ||||
-rwxr-xr-x | bin/cac-listservers | 12 | ||||
-rwxr-xr-x | bin/cac-listtasks | 3 | ||||
-rwxr-xr-x | bin/cac-listtemplates | 4 | ||||
-rwxr-xr-x | bin/cac-powerop | 3 | ||||
-rwxr-xr-x | bin/cac-rdns | 3 | ||||
-rwxr-xr-x | bin/cac-renameserver | 3 | ||||
-rwxr-xr-x | bin/cac-runmode | 3 | ||||
-rwxr-xr-x | bin/cac-ssh | 17 | ||||
-rwxr-xr-x | bin/cacnixos-networking | 28 | ||||
-rwxr-xr-x | bin/infest-CentOS-7-64bit | 150 | ||||
-rwxr-xr-x | bin/infest-cac | 21 |
20 files changed, 0 insertions, 302 deletions
diff --git a/bin/_cac_curl_api_v1 b/bin/_cac_curl_api_v1 deleted file mode 100755 index 65acebd9a..000000000 --- a/bin/_cac_curl_api_v1 +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -set -euf - -exec _cac_exec curl -fsS "$1" "https://panel.cloudatcost.com/api/v1/$2.php" $( - shift 2 - set -- "$@" login="$cac_login" key="$cac_key" - for arg; do - echo -d $(printf '%s' "$arg" | urlencode) - done -) diff --git a/bin/_cac_exec b/bin/_cac_exec deleted file mode 100755 index c932454e2..000000000 --- a/bin/_cac_exec +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -set -euf - -if test -z "${cac_via-}"; then - exec "$@" -else - exec ssh -q "$cac_via" -t "$@" -fi diff --git a/bin/_cac_get_api_v1 b/bin/_cac_get_api_v1 deleted file mode 100755 index 67aac8560..000000000 --- a/bin/_cac_get_api_v1 +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_curl_api_v1 -G "$@" diff --git a/bin/_cac_post_api_v1 b/bin/_cac_post_api_v1 deleted file mode 100755 index b946ed9fa..000000000 --- a/bin/_cac_post_api_v1 +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_curl_api_v1 -XPOST "$@" diff --git a/bin/cac-cloudpro-build b/bin/cac-cloudpro-build deleted file mode 100755 index 782fa0d72..000000000 --- a/bin/cac-cloudpro-build +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -set -euf - -# default os=26 is CentOS-7-64bit -exec _cac_post_api_v1 cloudpro/build cpu="$1" ram="$2" storage="$3" os="${4-26}" diff --git a/bin/cac-cloudpro-delete b/bin/cac-cloudpro-delete deleted file mode 100755 index ee1dbbc7e..000000000 --- a/bin/cac-cloudpro-delete +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 cloudpro/delete sid="$1" diff --git a/bin/cac-cloudpro-resources b/bin/cac-cloudpro-resources deleted file mode 100755 index 9ec5872e7..000000000 --- a/bin/cac-cloudpro-resources +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_get_api_v1 cloudpro/resources diff --git a/bin/cac-console b/bin/cac-console deleted file mode 100755 index ed1cbd5ff..000000000 --- a/bin/cac-console +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 console sid="$1" diff --git a/bin/cac-get-server-by b/bin/cac-get-server-by deleted file mode 100755 index b6d6b4ba3..000000000 --- a/bin/cac-get-server-by +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh -set -euf - -cac-listservers \ - | jq \ - --arg k "$1" \ - --arg v "$2" \ - ' - map(select(.[$k]==$v)) | - if (. | length) == 0 then - null - elif (. | length) == 1 then - .[0] - else - . - end - ' diff --git a/bin/cac-listservers b/bin/cac-listservers deleted file mode 100755 index 1e815d2af..000000000 --- a/bin/cac-listservers +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -set -euf - -listservers=$(_cac_get_api_v1 listservers) -status=$(echo "$listservers" | jq -r .status) - -if [ "$status" = ok ]; then - echo "$listservers" | jq -r .data -else - echo "$0: bad listservers status: $status" >&2 - exit 1 -fi diff --git a/bin/cac-listtasks b/bin/cac-listtasks deleted file mode 100755 index 14be3948a..000000000 --- a/bin/cac-listtasks +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_get_api_v1 listtasks diff --git a/bin/cac-listtemplates b/bin/cac-listtemplates deleted file mode 100755 index c4414e019..000000000 --- a/bin/cac-listtemplates +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -set -euf - -exec _cac_get_api_v1 listtemplates diff --git a/bin/cac-powerop b/bin/cac-powerop deleted file mode 100755 index c897835f0..000000000 --- a/bin/cac-powerop +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 powerop sid="$1" action="$2" diff --git a/bin/cac-rdns b/bin/cac-rdns deleted file mode 100755 index c2d9ecdab..000000000 --- a/bin/cac-rdns +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 rdns sid="$1" hostname="$2" diff --git a/bin/cac-renameserver b/bin/cac-renameserver deleted file mode 100755 index f0eff9b3d..000000000 --- a/bin/cac-renameserver +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 renameserver sid="$1" name="$2" diff --git a/bin/cac-runmode b/bin/cac-runmode deleted file mode 100755 index 200b9fb79..000000000 --- a/bin/cac-runmode +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -euf -exec _cac_post_api_v1 rdns sid="$1" mode="$2" diff --git a/bin/cac-ssh b/bin/cac-ssh deleted file mode 100755 index a0ec5dcf3..000000000 --- a/bin/cac-ssh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh -set -euf - -server=$1 -shift - -address=$(echo $server | jq -r .ip) -target=root@$address - -SSHPASS=$(echo $server | jq -r .rootpass) -export SSHPASS - -exec sshpass -e ssh \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - "$target" \ - "$@" diff --git a/bin/cacnixos-networking b/bin/cacnixos-networking deleted file mode 100755 index 4b246ebf1..000000000 --- a/bin/cacnixos-networking +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh -# cacnixos-networking : cac-server x hostname -> nixos-module -# TODO use label for hostname -set -euf - -server=$1 -hostname=$2 - -address=$(echo $server | jq -r .ip) -gateway=$(echo $server | jq -r .gateway) -nameserver=8.8.8.8 -netmask=$(echo $server | jq -r .netmask) -prefix=$(netmask-to-prefix $netmask) - -printf '{...}:\n' -printf '{\n' -printf ' networking.hostName = "%s";\n' $hostname -printf ' networking.interfaces.enp2s1.ip4 = [\n' -printf ' {\n' -printf ' address = "%s";\n' $address -printf ' prefixLength = %d;\n' $prefix -printf ' }\n' -printf ' ];\n' -printf ' networking.defaultGateway = "%s";\n' $gateway -printf ' networking.nameservers = [\n' -printf ' "%s"\n' $nameserver -printf ' ];\n' -printf '}\n' diff --git a/bin/infest-CentOS-7-64bit b/bin/infest-CentOS-7-64bit deleted file mode 100755 index a8afea14b..000000000 --- a/bin/infest-CentOS-7-64bit +++ /dev/null @@ -1,150 +0,0 @@ -#! /bin/sh -set -euf - -server=$1 -hostname=$2 - -address=$(echo $server | jq -r .ip) -RSYNC_RSH='sshpass -e ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' -SSHPASS=$(echo $server | jq -r .rootpass) -export SSHPASS -export RSYNC_RSH - -main="modules/$hostname/default.nix" -target="root@$address" - -cacnixos-networking "$server" $hostname \ - > modules/$hostname/networking.nix - -echo '( - set -xeuf - type bzip2 || yum install -y bzip2 - type rsync || yum install -y rsync -)' \ - | sshpass -e ssh \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - "root@$address" \ - /bin/sh - -make-rsync-filter "$main" \ - | rsync -f '. -' -zvrlptD --delete-excluded ./ "$target":/etc/nixos/ - -# -# -# -echo '( - set -xeuf - groupadd -g 30000 nixbld || : - for i in `seq 1 10`; do - useradd -c "foolsgarden Nix build user $i" \ - -d /var/empty \ - -s /sbin/nologin \ - -g 30000 \ - -G 30000 \ - -l -u $(expr 30000 + $i) \ - nixbld$i || : - rm -f /var/spool/mail/nixbld$i - done - - #curl https://nixos.org/nix/install | sh - nix_tar=$nix_basename.tar.bz2 - if ! echo $nix_sha256 $nix_tar | sha256sum -c; then - curl -O -C - $nix_url || : - if ! echo $nix_sha256 $nix_tar | sha256sum -c; then - curl -O $nix_url || : - if ! echo $nix_sha256 $nix_tar | sha256sum -c; then - echo $0: cannot download $nix_url >&2 - exit 5 - fi - fi - fi - - if ! test -d $nix_basename; then - tar jxf $nix_basename.tar.bz2 - fi - - nix_find=$nix_basename.find.txt - if ! echo $nix_find_sha1sum $nix_find | sha1sum -c; then - find $nix_basename | sort > $nix_find - if ! echo $nix_find_sha1sum $nix_find | sha1sum -c; then - echo $0: cannot unpack $nix_basename.tar.bz2 >&2 - # TODO we could retry - exit 6 - fi - fi - - mkdir -p bin - PATH=$HOME/bin:$PATH - export PATH - - # generate fake sudo because - # sudo: sorry, you must have a tty to run sudo - { - echo "#! /bin/sh" - echo "exec env \"\$@\"" - } > bin/sudo - chmod +x bin/sudo - - ./$nix_basename/install - - . /root/.nix-profile/etc/profile.d/nix.sh - - nixpkgs_expr="import <nixpkgs> { system = builtins.currentSystem; }" - nixpkgs_path=$( - find /nix/store -mindepth 1 -maxdepth 1 -name *-nixpkgs-* -type d - ) - - for i in nixos-generate-config nixos-install; do - nix-env \ - --arg config "{ nix.package = ($nixpkgs_expr).nix; }" \ - --arg pkgs "$nixpkgs_expr" \ - --arg modulesPath "throw \"no modulesPath\"" \ - -f $nixpkgs_path/nixpkgs/nixos/modules/installer/tools/tools.nix \ - -iA config.system.build.$i - done - - # TODO following fail when aborted in-between - if ! test -d /int; then - mkdir -p /int - mount --bind /int /mnt - fi - if ! test -d /mnt/boot; then - mkdir -p /mnt/boot - mount /dev/sda1 /mnt/boot - fi - - mkdir -p /mnt/etc/nixos - rsync -zvrlptD --delete-excluded /etc/nixos/ /mnt/etc/nixos/ - - mkdir -m 0444 -p /mnt/var/empty - - ln -s $main /mnt/etc/nixos/configuration.nix - nixos-install \ - -I secrets=/etc/nixos/secrets - - find / \ - 1> /root/pre-rsync-find.out \ - 2> /root/pre-rsync-find.err - - rsync -va --force /int/ / - - # find / -type f -mtime +1 -exec rm -v {} \; 2>&1 > rm.log - # ^ too aggressive, kills journal which is bad - # shutdown -r now - # nix-channel --add https://nixos.org/channels/nixos-unstable nixos - # nix-channel --remove nixpkgs - # nix-channel --update - -)' \ - | sshpass -e ssh \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - "root@$address" \ - -T /usr/bin/env \ - nix_url="$nix_url" \ - nix_basename="$(basename $nix_url .tar.bz2)" \ - nix_sha256="$nix_sha256" \ - nix_find_sha1sum="$nix_find_sha1sum" \ - main="$main" \ - /bin/sh diff --git a/bin/infest-cac b/bin/infest-cac deleted file mode 100755 index d7d7bb96c..000000000 --- a/bin/infest-cac +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh -set -euf - -server=$(cac-get-server-by servername "$1") -hostname=$2 - -serverstatus=$(echo $server | jq -r .status) -case $serverstatus in - 'Powered On') : ;; - *) - echo $0: bad server status: $serverstatus >&2 - exit 2 -esac - -template=$(echo $server | jq -r .template) -case $template in - 'CentOS-7-64bit') infest-"$template" "$server" "$hostname";; - *) - echo $0: bad template: $template >&2 - exit 3 -esac |