#!/bin/sh
#sulinstrapt betiği ile sulinos chroot oluşturabilirsiniz veya diskinize kurulum yapabilirsiniz

if [ "$1" == "" ] || [ "$1" == "-*" ]
then
	echo "Usage: sulinstrapt [directory]"
	exit 0
fi
sulin="$1"
if [ $UID -ne 0 ]
then
	echo "You must be root!"
	exit 1
fi
if [ -d "$sulin" ]
then
  echo "$sulin already exist"
fi
if [ -f "$sulin" ]
then
  echo "$sulin is a file. You must delete or move."
  exit 1
fi
inary ar sulin https://master.dl.sourceforge.net/project/sulinos/SulinRepository/inary-index.xml -y -D$sulin
inary ur -y -D$sulin
inary it baselayout --ignore-dep --ignore-safety --ignore-configure -y -D$sulin 
inary it -c system.base -y --ignore-configure -D$sulin
if echo $2 | grep "^-" &>/dev/null ; then
	echo $2 | grep "b" && inary it -c system.boot toybox btrfs-progs linux -y --ignore-configure -D$sulin
	echo $2 | grep "x" && inary it -c x11 -y --ignore-configure -D$sulin
	echo $2 | grep "d" && inary it -c system.devel -y --ignore-configure -D$sulin
	echo $2 | grep "n" && inary it NetworkManager -y --ignore-configure -D$sulin
	echo $2 | grep "a" && inary it nano wget vim strace ntfsprogs tree dialog pfork scom htop -y --ignore-configure -D$sulin
fi
for i in /dev /sys /proc /run
do
	mkdir -p $sulin/$i &>/dev/null
	mount --bind $i $sulin/$i
done
chroot $sulin inary cp baselayout
chroot $sulin inary cp
