#/bin/bash # http://www.telephreak.org/papers/vpa/ # This is a simple shell script to create normal/security device # structures for normal VPSes, and extra support for Asterisk. if [ "$1" == "" ] then echo echo "You must supply the path of the VPS you want to install the" echo "devices in! Also, make sure to remove ALL old devices from" echo "the VPS. That is, 'cd /vservers/yourvpsname/dev && rm -rf *'" echo echo "To use, type:" echo "$0 [VPS path] [--asterisk]" echo echo "Example: To install WITHOUT Asterisk devices, use:" echo "$0 /vservers/yourvpsname" echo echo "Example : To install WITH Asterisk devices, use:" echo "$0 /vservers/yourvpsname --asterisk" exit fi mknod $1/dev/full c 1 7 mknod $1/dev/null c 1 3 mknod $1/dev/ptmx c 5 2 mknod $1/dev/random c 1 8 mknod $1/dev/urandom c 1 9 mknod $1/dev/tty c 5 0 mknod $1/dev/zero c 1 5 mkdir $1/dev/pts chmod a+rw $1/dev/full $1/dev/null $1/dev/ptmx $1/dev/tty $1/dev/zero mkdir -p $1/dev/vc N=0; \ while [ $N -lt 65 ]; do \ mknod $1/dev/vc/$N c 4 $N; \ N=$[$N+1]; \ done chmod go-rwx $1/dev/vc/* if [ "$2" == "" ] then echo "Okay, all done! (Note: Asterisk devices were NOT created!)" exit fi # The next section is for Asterisk only! mkdir -p $1/dev/zap mknod $1/dev/zap/ctl c 196 0 mknod $1/dev/zap/timer c 196 253 mknod $1/dev/zap/channel c 196 254 mknod $1/dev/zap/pseudo c 196 255 N=1; \ while [ $N -lt 250 ]; do \ mknod $1/dev/zap/$N c 196 $N; \ N=$[$N+1]; \ done echo "Okay, all done! (Note: Asterisk devices were successfully installed!)"