#!/bin/bash
cd /home/os/loongnix-server/8.4
pwd
for dir in `ls /home/os/loongnix-server/8.4`
do
	echo "$dir -------"
	case $dir in
		"BaseOS")
			cd $dir/loongarch64/release
			pwd
			/usr/bin/createrepo_c -g /home/os/loongnix-server/8.4/aux-tools/comps/$dir/$dir-comps.loongarch64.xml --update .
			cd -
			;;
		"AppStream"|"PowerTools")
			cd $dir/loongarch64/release
			pwd
			/usr/bin/createrepo_c -g /home/os/loongnix-server/8.4/aux-tools/comps/$dir/$dir-comps.loongarch64.xml --update .
			modifyrepo_c --mdtype=modules /home/os/loongnix-server/8.4/aux-tools/modules/$dir/${dir}_modules.yaml repodata/
			cd -
			;;
		"epel")
			cd $dir/loongarch64/release/Everything
			pwd
			/usr/bin/createrepo_c -g /home/os/loongnix-server/8.4/aux-tools/comps/$dir/$dir-comps.loongarch64.xml --update .
			cd -
			cd $dir/loongarch64/release/Modular
			pwd
			/usr/bin/createrepo_c -g /home/os/loongnix-server/8.4/aux-tools/comps/$dir/$dir-comps.loongarch64.xml --update .
			cd -
			;;
		"HighAvailability"|"LoongnixPlus"|"extras"|"messaging"|"testing"|"nfv")
			cd $dir/loongarch64/release
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			;;
		"infra")
			cd $dir/loongarch64/buildtools-common/release
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/gitforge-pagure/release/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/infra-common/release/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			;;
		"virt")
			cd $dir/loongarch64/advanced-virtualization/release
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/kata-containers/release/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/ovirt-44/release/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			;;
		"cloud")
			cd $dir/loongarch64/release/openstack-ussuri/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/release/openstack-victoria/
			pwd
			/usr/bin/createrepo_c --update .
			cd -
			cd $dir/loongarch64/release/kubernetes
			/usr/bin/createrepo_c --update .
			cd -
			;;
		"storage")
			for repo_dir in `ls $dir/loongarch64/release/`
			do
				cd $dir/loongarch64/release/$repo_dir
				pwd
				/usr/bin/createrepo_c --update .
				cd -
			done
			;;
		"aux-tools"|"isos")
			continue
			;;
		*)
			echo $dir
			;;
	esac

done

