Create disksuite mirrored root disks

prtvtoc /dev/rdsk/c6t5000CCA043ACB5D1d0s0 | fmthard -s – /dev/rdsk/c5t5000CCA043A5876Dd0s0

metadb -a -f -c 3 c6t5000CCA043ACB5D1d0s7
metadb -a -f -c 3 c5t5000CCA043A5876Dd0s7

metainit -f d10 1 1 c0t5000CCA043ACC154d0s0
metainit -f d20 1 1 c0t5000CCA043A3D118d0s0
metainit d0 -m d10

metainit -f d11 1 1 c0t5000CCA043ACC154d0s1
metainit -f d21 1 1 c0t5000CCA043A3D118d0s1
metainit d1 -m d11

metainit -f d13 1 1 c0t5000CCA043ACC154d0s3
metainit -f d23 1 1 c0t5000CCA043A3D118d0s3
metainit d3 -m d13

metainit -f d15 1 1 c0t5000CCA043ACC154d0s5
metainit -f d25 1 1 c0t5000CCA043A3D118d0s5
metainit d5 -m d15

metainit -f d16 1 1 c0t5000CCA043ACC154d0s6
metainit -f d26 1 1 c0t5000CCA043A3D118d0s6
metainit d6 -m d16

metaroot d0

vi /etc/vfstab (add all metadevices)

init 6
metattach d0 d20
metattach d1 d21
metattach d2 d22
metattach d5 d25
metattach d6 d26

Autogenerate “PopArt”

This one downloads images from google and applies imagemagick filters to them to convert them in pseudo-PopArt-ish images

#!/bin/bash
set -x

red="#B0232A"
green="#009543"
blue="#003B6F"
yellow="#EADB1B"
resolution=1280

D=/cygdrive/c/Users/Roberto_Dircio/Desktop/popart
mkdir -p $D
cd $D
#rm -fR $D/*

function getimages {
QUERY=`shuf -n 1 /scripts/POPART/wallpaper-subjects.txt| sed 's/ /%20/g'`
for page in 1 2 3 4;do
#for page in 1;do
        i=$(((${page}-1)*21))
        curl -m 2 -A "Mozilla/3.0 (compatible; AvantGo 3.2)" "http://images.google.com/images?as_q=${QUERY}&safe=off&start=${i}&as_st=y&tbm=isch&tbs=isz:m,ic:white,iar:s" 2>/dev/null |sed -e 's/>/>\n/g' | awk '{s=substr($0,index($0,"imgurl="),index($0,"&"));print substr(s,1,index(s,"&")-1)}' | grep imgurl|sed 's/imgurl=//g'| egrep -v 'starkeith|gstatic|sca${red}monkeys|tripod|flickr'|sed 's/2520/20/g' | while read url;do
(
                F=`echo $url | awk -F'\/' '{ print $NF }'`
                t=`echo "${F}"| tr -d "[:punct:]"|sed "s/;//g;s/:/_/g;s/\*//g;s/ó/o/g;s/í/i/g;s/ú/u/g;s/á/a/g;s/é/e/g;s/ñ/n/g;s/\&/And/g;s/-/_/g;s/%//g;s/ /_/g;s/(//g;s/)//g;s/\[//g;s/\]//g;s/'//g;s/,/_/g" | tr -s '_'|tr '[:upper:]' '[:lower:]' |sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/g;s/Mp3/mp3/g'| sed 's/mp3//g;s/U0026quot//g;s/U0026amp//g;s/U0026amp//g;s/_amp_//g'| sed 's/\\\//g'`
                A=`echo $t | egrep -i 'jpg|jpeg' | wc -l`
                B=`echo $t | grep -i "png" | wc -l`
                C=`echo $t | grep -i "gif" | wc -l`
                D=`echo $t | grep -i "svg" | wc -l`
                if [ $A -gt 0 ];then
                        t=`echo $t | sed 's/jpg//g'`
                        t="${t}.jpg"
                fi
                if [ $B -gt 0 ];then
                                t=`echo $t | sed 's/png//g'`
                                t="${t}.png"
                fi
                if [ $C -gt 0 ];then
                                t=`echo $t | sed 's/${ext}//g'`
                                t="${t}.${ext}"
                fi
                if [ $D -gt 0 ];then
                                t=`echo $t | sed 's/svg//g'`
                                t="${t}.svg"
                fi
                if [ ! -f $t ];then
                        wget -O $t --timeout=10 $url
                        ES="$?"
                        if [ $ES -lt 1 ];then
                                transform "$t"
                        else
                                rm $t
                        fi
                else
                        echo "[!] ---------------------- file exists , not re-processing : $t"
                fi
) &
        done
done
}

function transform {
set -x
f="$@"
A=$(($RANDOM%50))
B=$(($RANDOM%50))
C=$(($RANDOM%50))
D=$(($RANDOM%50))

convert -colorspace Gray -resize ${resolution} -page -$A-$B "$f" -background white -flatten -contrast-stretch 40% -fuzz 50% -colorspace RGB -fill "${blue}" -opaque black "${f}_a"
convert -colorspace Gray -resize ${resolution} -page +$C+$D "$f" -background white -flatten -contrast-stretch 40% -fuzz 50% -colorspace RGB -fill "${red}" -opaque black "${f}_b"
convert -colorspace Gray -resize ${resolution} -page -$D-$B "$f" -background white -flatten -contrast-stretch 40% -fuzz 50% -colorspace RGB -fill "${green}" -opaque black "${f}_c"
convert -colorspace Gray -resize ${resolution} -page +$A+$C "$f" -background white -flatten -contrast-stretch 40% -fuzz 50% -colorspace RGB -fill "${yellow}" -opaque black "${f}_d"

convert "$f" -colorspace Gray -resize ${resolution} -contrast-stretch 10% \( "${f}_a" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite ${f}_e
convert "$f" -colorspace Gray -resize ${resolution} -contrast-stretch 10% \( "${f}_b" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite ${f}_f
convert "$f" -colorspace Gray -resize ${resolution} -contrast-stretch 10% \( "${f}_c" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite ${f}_g
convert "$f" -colorspace Gray -resize ${resolution} -contrast-stretch 10% \( "${f}_d" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite ${f}_h

convert "${f}" -colorspace Gray -resize ${resolution} -negate -fuzz 10% -colorspace RGB -fill "${blue}" -opaque black \( "${f}_d" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite "${f}_i"
convert "${f}" -colorspace Gray -resize ${resolution} -negate -fuzz 10% -colorspace RGB -fill "${red}" -opaque black \( "${f}_c" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite "${f}_j"
convert "${f}" -colorspace Gray -resize ${resolution} -negate -fuzz 10% -colorspace RGB -fill "${green}" -opaque black \( "${f}_b" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite "${f}_k"
convert "${f}" -colorspace Gray -resize ${resolution} -negate -fuzz 10% -colorspace RGB -fill "${yellow}" -opaque black \( "${f}_a" -alpha set -channel A -fx '0.8' \) -compose Overlay -composite "${f}_l"

convert \( "${f}" -resize ${resolution} -page -$A-$B -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) "${f}_i" -compose Linear_Light -composite ${f}_m
convert \( "${f}" -resize ${resolution} -page +$A+$C -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) "${f}_j" -compose Linear_Light -composite ${f}_n
convert \( "${f}" -resize ${resolution} -page +$C+$D -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) "${f}_k" -compose Linear_Light -composite ${f}_o
convert \( "${f}" -resize ${resolution} -page -$D-$B -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) "${f}_l" -compose Linear_Light -composite ${f}_p

convert "${f}_l" -negate  \( "${f}" -resize ${resolution} -page +$A+$C  -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) -compose Linear_Light -composite ${f}_q

convert "${f}_j" -negate  \( "${f}" -resize ${resolution} -page +$A+$C  -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) -compose Linear_Light -composite ${f}_r
convert "${f}_k" -negate  \( "${f}" -resize ${resolution} -page +$A+$C  -flatten -contrast-stretch 20% -alpha set -channel A -fx '0.8' \) -compose Linear_Light -composite ${f}_s

ext=`echo ${f} | awk -F. '{ print $NF }'`
N=`echo $t | sed 's/svg//g;s/png//g;s/${ext}//g;s/jpg//g;s/\.//g'`
for letter in a b c d e f g h i j k l m n o p q r s;do
        mv "${f}_${letter}" "${N}_${letter}.${ext}"
        convert "${N}_${letter}.${ext}" -ordered-dither h6x6o -channel RGBA -blur 0x1 "${N}_${letter}.${ext}"
done

convert "${f}" -resize ${resolution} "${f}"

O=`echo "a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;" | sed -r 's/(.[^;]*;)/ \1 /g' | tr " " "\n" | shuf | tr -d "\n"|sed 's/;/ /g'`

b="-bordercolor white -border 50x50"

x=1
s="convert ( ${f} "
for l in $O;do
        x=$(($x + 1))
        m=$(($x%4))
        if [ $m -eq 1 ];then
                s=$s" ( ${N}_${l}.${ext} "
        fi
        if [ $m -eq 0 ];then
                s=$s" ${N}_${l}.${ext} $b +append ) "
        fi
        if [ $m -gt 1 ];then
                s=$s" ${N}_${l}.${ext} "
        fi
done
s=$s" -background white -append Z_results/appended_${N}.${ext}"
$s

}

getimages

Prepare a zfs pool to boot from it

My jumpstart install uncompresses the flar but leaves the server without bootblock or zfs bootpool, to fix this i install the bootblock and set the zpool’s bootfs property

# zpool status
  pool: rpool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        rpool         ONLINE       0     0     0
          mirror-0    ONLINE       0     0     0
            c0t0d0s0  ONLINE       0     0     0
            c0t1d0s0  ONLINE       0     0     0

# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t0d0s0
# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t1d0s0

# zpool set bootfs=rpool/ROOT/sol10u11sparc rpool

Then just… reboot

 

 

Reborn

This time, kraftek.com is running in a webserver inside an appletv 🙂appletv_hero

During its lifetime it has run in various x86 and x86_64 slackware linux boxes+laptops, a couple of ubuntu laptops, a rikomagic ARM cpu device running picuntu linux, and now, an appletv running a jailbroken iOS. Next, i’d like it to run in a dd-wrt router, which i already own…. 🙂