linux

Crosscompile OpenWRT

<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/scripts/compile_openwrt_ar9132.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Compile for x86
sudo apt-get install -y --force-yes subversion libncurses5-dev libghc6-zlib-dev flex build-essential
cd /tmp
svn checkout svn://svn.openwrt.org/openwrt/trunk
make menuconfig

Links
http://wiki.openwrt.org/doc/howto/build
http://wiki.openwrt.org/doc/devel/crosscompile
http://wiki.openwrt.org/doc/howto/buildroot.exigence
http://www.ffnn.nl/pages/articles/linux/cgi-scripting-tips-for-bash-or-sh.php

Brother MFC 7320

Install printer
<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/hardware/install.brother-mfc-7320.printer.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Install scanner
<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/hardware/install.brother-mfc-7320.scanner.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

wlyc - Yamaha Receiver Webcontrol

GitHub repository
https://github.com/panticz/wlyc
Demo
http://dl.panticz.de/wlyc/wlyc3900.html

<?php
$URL="https://raw.githubusercontent.com/panticz/wlyc/master/wlyc";
echo $URL;
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
#echo htmlspecialchars(curl_exec($c));
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Links
http://your.recier.ip/YamahaRemoteControl/UnitDesc.xml

Autostart script from USB device with Udev

Stage 1: Create Udev rule
<?php
$URL="http://dl.panticz.de/udev/autorun/70-persistent-usb_autorun.rules";
echo "sudo wget $URL -O /etc/udev/rules.d/70-persistent-usb_autorun.rules";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Stage 2: Create autorun wrapper
<?php
$URL="http://dl.panticz.de/udev/autorun/usb_autorun.sh";
echo "sudo wget $URL -O /usr/sbin/usb_autorun.sh";
echo "\n";
echo "sudo chmod a+x /usr/sbin/usb_autorun.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Stage 3: Create autorun.sh script on your USB device (example)
<?php
$URL="http://dl.panticz.de/udev/autorun/autorun.sh";
echo "cd /media/YOUR_USB_DEVICE";
echo "\n";
echo "wget $URL -O ./autorun.sh";
echo "\n";
echo "chmod a+x ./autorun.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

smartmontools (smartctl)

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.smartmontools.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Enable SMART on device
sudo smartctl -s on /dev/sdb

Show device SMART Health status
sudo smartctl -H /dev/sda

Show device selftest log
smartctl -l selftest /dev/sdb

Get info from usb data
sudo smartctl -d sat -a /dev/sdb

Test
smartctl -t short /dev/sdb
smartctl -t offline /dev/sdb

Calculate total writen GB from a SSD
echo "Total GB written: $(echo "scale=3; $(sudo /usr/sbin/smartctl -A /dev/sda | grep "Total_LBAs_Written" | awk '{print $10}') * 512 / $((1024*1024*1024))" | bc)"

Links
http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_USB-Devices

IPCop: Check / Update DDNS

<?php
$URL="http://dl.panticz.de/endian/checkddns";
echo "wget $URL -O /etc/cron.d/checkddns";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

<?php
$URL="http://dl.panticz.de/endian/checkddns.sh";
echo "wget $URL -O /sbin/checkddns.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>
chmod u+x /sbin/checkddns.sh
/etc/init.d/fcron restart

Toshiba Tegra AC100

# https://github.com/nthchild/ubuntu-ac100

HowTo
https://wiki.ubuntu.com/ARM/TEGRA/AC100

install nvflash (broken, download and install manually)
http://developer.download.nvidia.com/assets/mobile/files/tegra-linux-12.alpha.1.0.tar.gz
wget https://phablet-paz00.googlecode.com/files/nvflash_20110628-2_all.deb -O /tmp/nvflash_20110628-2_all.deb
sudo dpkg -i /tmp/nvflash_20110628-2_all.deb

get bootrom
# wget http://cdimage.ubuntu.com/lubuntu/releases/quantal/release/lubuntu-12.10-preinstalled-desktop-armhf+ac100.bootimg -O /tmp/ac100.bootimg
# wget http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-preinstalled-desktop-armhf+ac100.bootimg -O /tmp/ac100.bootimg
wget http://cdimage.ubuntu.com/lubuntu/daily-preinstalled/pending/trusty-preinstalled-desktop-armhf+ac100.bootimg -O /tmp/ac100.bootimg

flash bootrom
# Connect the USB cable between your AC100 and the host PC
# Press CTRL and ESC keys and power on your AC100
sudo nvflash --bl /usr/lib/nvflash/fastboot.bin --download 6 /tmp/ac100.bootimg
# poweroff
# poweron

download image
sudo mount /dev/sdb1 /mnt

# wget http://cdimage.ubuntu.com/lubuntu/releases/quantal/release/lubuntu-12.10-preinstalled-desktop-armhf+ac100.tar.gz -P /mnt/
# wget http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-preinstalled-desktop-armhf+ac100.tar.gz -P /mnt/
wget http://cdimage.ubuntu.com/lubuntu/daily-preinstalled/pending/trusty-preinstalled-desktop-armhf+ac100.tar.gz -O /tmp/trusty-preinstalled-desktop-armhf+ac100.tar.gz

sudo umount /mnt

# OPTIONAL configuration
<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/hardware/ac100.postinstall.sh";
echo "wget $URL -O - | sudo bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Ubuntu images for AC100
http://cdimage.ubuntu.com/releases/11.10/release/
http://cdimage.ubuntu.com/releases/12.04/beta-2/
http://cdimage.ubuntu.com/daily-preinstalled/current/

Links
http://cdimage.ubuntu.com/lubuntu/daily-preinstalled/current/
http://ac100.grandou.net/hw_accelerated_video_playback - Ubuntu 12.10 / 12.04 Nvidia graphic driver for Toshiba AC100
http://wiki.informatik.hu-berlin.de/nomads/index.php/Erfahrungsbericht_Toshiba_AC100#Nvidia_Grafiktreiber_f.C3.BCr_Tegra_2
http://ac100.grandou.net/
http://ac100.grandou.net/nvflash#debian_ubuntu_package - NvFlash
http://ac100.grandou.net/ubuntu_deubuntuization
http://developer.nvidia.com/content/linux-tegra-release-12-alpha-1-released
http://ac100.grandou.net/apps

Accelated Video
wget http://launchpadlibrarian.net/118260107/linux-image-3.1.10-6-ac100_3.1.10-6.9_armhf.deb
wget http://flie.no-ip.org:7080/ac100/deb/nvidia-tegra_16.1.0-0ubuntu3~fly2_armhf.deb
sudo dpkg -i linux-image-3.1.10-6-ac100_3.1.10-6.9_armhf.deb nvidia-tegra_16.1.0-0ubuntu3~fly2_armhf.deb

http://ac100.grandou.net/hw_accelerated_video_playback
nvgstplayer -i "file://$1" --svs="nvxvimagesink" --sas="nv_omx_audiosink"

Java Linux ARM v6/v7 VFP
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

# axis
http://ports.ubuntu.com/pool/multiverse/a/axe/axe_6.1.2-16.2_armhf.deb
http://ports.ubuntu.com/ubuntu-ports/pool/universe/t/tk8.6/tk8.6-lib_8.6.0-1ubuntu1_armhf.deb

# kali
http://cdimage.kali.org/kali-latest/armhf/

Lubuntu / LXDM enable autologin
/etc/lightdm/lightdm.conf.d/10-autologin.conf
[SeatDefaults]
autologin-user=USERNAME
autologin-user-timeout=0
user-session=Lubuntu
greeter-session=lightdm-gtk-greeter

# old
sudo echo "deb http://people.debian.org/~jak/ac100/ unreleased main non-free" > /etc/apt/sources.list.d/people.debian.org.jak.ac100.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AC2A5FFE00823EC2
sudo apt-get update
sudo apt-get -y --force-yes install xserver-xorg-video-tegra

wget https://launchpad.net/~canonical-arm-dev/+archive/ppa/+build/2610299/+files/nvidia-tegra_12-0ubuntu1~alpha1monson6_armel.deb -O /tmp/nvidia-tegra_12-0ubuntu1~alpha1monson6_armel.deb
sudo dpkg -i /tmp/nvidia-tegra_12-0ubuntu1~alpha1monson6_armel.deb

Ubuntu: Install Nero Linux

Nero Download
http://www.nero.com/enu/downloads-linux4-trial.php

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.nero.sh";
echo "wget $URL -O - | bash -";
echo "

";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
$result = curl_exec($ch);
curl_close($ch);
htmlspecialchars($result);

echo "

";
?>
Extract Nero DOS bootimage
mkdir /tmp/nero
dpkg -x /tmp/nerolinux-x86_64.deb /tmp/nero
ls -l /tmp/nero/usr/share/nero/DosBootImage.ima