#!/bin/bash

umask 022

if [[ $# -ne 3 ]]; then
	echo "Usage: $0 <theme dir> <theme name> <theme description>"
	exit 1
fi

theme_dir=`printf %s "$2" | sed s/' '/-/`
theme_dir=`printf %s "$2" | sed s/[^A-Za-z0-9_-]/_/g`
theme_full_path=$1/$theme_dir

mkdir $theme_full_path

echo -e "[Icon Theme]\nName=$2\nComment=$3" > $theme_full_path/index.theme

cp -ri cursors/ $theme_full_path

chmod -R a+r $theme_full_path
chmod a+x $theme_full_path/cursors