.profile.roku.dev and etc

This commit is contained in:
2023-01-25 14:00:18 +00:00
parent 875b05dfdb
commit 4ff39435b9
4 changed files with 168 additions and 30 deletions

View File

@@ -70,36 +70,6 @@ jcat()
cat $(jfile $1) cat $(jfile $1)
} }
###############################################################################
#
# Misc
#
rokuget()
{
[ -z "$1" ] && echo "usage: rokuget <url>" && return 0
if [ -z "$ROKU_CORP_PASSWORD" ]; then
local USER_PASSWORD="--ask-password"
else
local USER_PASSWORD="--password=$ROKU_CORP_PASSWORD"
fi
wget --no-check-certificate --user=vkhachatryan $USER_PASSWORD $1
}
install_auth_token()
{
[ ! -f "$1" ] && echo "usage: install_auth_toke <auth token file>" && return 0
[ -z "$ROKU_DEVICE_IP" ] && echo "ROKU_DEVICE_IP must be defined" && return 0
curl --data-binary @$1 http://$ROKU_DEVICE_IP:8060/token/install
}
sideload()
{
[ ! -f "$1" ] && echo "usage: sideload <file>" && return 0
[ -z "$ROKU_DEVICE_IP" ] && echo "ROKU_DEVICE_IP must be defined" && return 0
curl --anyauth --user "rokudev:aaaa" -F "mysubmit=Install_Netflix" -F "archive=@$1" http://$ROKU_DEVICE_IP/plugin_install
}
############################################################################### ###############################################################################
# #
# Other helpers # Other helpers

131
.profile.roku.dev Normal file
View File

@@ -0,0 +1,131 @@
#!/bin/sh
# I have my automake
export ACLOCAL_PATH=/usr/share/aclocal
export ROKU_NFS_ROOT=$HOME/roku/nfs
export ROKU_NFS_IP=192.168.0.64
export EXPORTROOT=${ROKU_NFS_ROOT}
###############################################################################
#
# Work with device.
#
export DEVPASSWORD=aaaa
install_auth_token()
{
[ ! -f "$1" ] && echo "usage: install_auth_toke <auth token file> \n ROKU_DEV_TARGET=${ROKU_DEV_TARGET}" && return 0
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
curl --data-binary @$1 http://${ROKU_DEV_TARGET}:8060/token/install
}
sideload()
{
[ ! -f "$1" ] && echo "usage: sideload <file> \n ${ROKU_DEV_TARGET}=${ROKU_DEV_TARGET}" && return 0
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
curl --anyauth --user "rokudev:${DEVPASSWORD}" -F "mysubmit=Install_Netflix" -F "archive=@$1" http://${ROKU_DEV_TARGET}/plugin_install
}
__netcat()
{
netcat -t $ROKU_DEV_TARGET 23
}
__set_server_ip()
{
SERVER_IP=$(ip route get "${ROKU_DEV_TARGET}" | sed -n "s/.* src \([\.0-9]*\) .*/\1/p")
}
device_cmd()
{
echo "$1; exit" | __netcat
}
rokuflash()
{
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
__set_server_ip
device_cmd ". /nvram/san; export SERVER_IP=$SERVER_IP; rokuflash $1"
}
rokureboot()
{
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
device_cmd "reboot"
}
rokutelnet()
{
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
telnet "$ROKU_DEV_TARGET" $1
}
update_san()
{
[ -z "$ROKU_DEV_TARGET" ] && echo "ROKU_DEV_TARGET must be defined" && return 0
}
###############################################################################
#
# Logging
#
LOGDIR="${HOME}/roku/logs"
dcapture()
{
nc minicom "$@" -C $LOGDIR/.log.$(date +%Y-%m-%d--%H-%M-%S)
}
dfile()
{
local Nth="-1"
if [ $# -gt 0 ]; then
Nth="$1"
fi
echo $(ls -tr -1 ${LOGDIR}/minicom.log.* | tail ${Nth} | head -1)
}
dless()
{
less $(lfile "$@")
}
dcat()
{
cat $(lfile "$@")
}
dgrep()
{
lcat | grep -a --color "$@"
}
dtail()
{
if [ $# -gt 0 ]; then
tail -f $(lfile) | grep "$@"
else
tail -f $(lfile)
fi
}
###############################################################################
#
# Misc
#
rokuget()
{
[ -z "$1" ] && echo "usage: rokuget <url>" && return 0
if [ -z "$ROKU_CORP_PASSWORD" ]; then
local USER_PASSWORD="--ask-password"
else
local USER_PASSWORD="--password=$ROKU_CORP_PASSWORD"
fi
wget --no-check-certificate --user=vkhachatryan $USER_PASSWORD $1
}

5
.profile.roku.jira Normal file
View File

@@ -0,0 +1,5 @@
export GOROOT=/opt/go
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export JIRA_AUTH_TYPE=bearer
export JIRA_API_TOKEN=NDgxMDQ4OTEyMzc4OsbbS3Et1TCVFNPAVrKIONLY99NM

32
install.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
#
# Make sure that .profile loads all .profile.* files.
#
[ ! -f ${HOME}/.profile ] && touch ${HOME}/.profile
grep "# Load .profile.* files." ${HOME}/.profile
if [ $? != 0 ]; then
cat >> ${HOME}/.profile << EOF
# Load .profile.* files.
for profile in \${HOME}/.profile.*; do
[ -f \${profile} ] && source \${profile}
done
EOF
fi
#
# Make sure that .profile file is loaded from bashrc.
#
grep .profile ${HOME}/.bashrc
if [ $? != 0 ]; then
printf "# Load .profile in case its an ssh(non interactive) shell.\n"
printf "[ -f ~/.profile ] && source ~/.profile\n" >> ${HOME}/.bashrc
fi
#
# Create symlinks to all .profile.* files.
#
find $(pwd) -maxdepth 1 -name .profile.\* -type f -exec ln -i -s \{\} ${HOME} \;