view Mercurial/CreathgRepos.sh @ 2:c8c80b5286b1

add:Mercurial re.sh 新版本自动创建仓库脚本
author Pluto <meokcin@gmail.com>
date Tue, 03 Sep 2024 17:01:40 +0800
parents 44d6d3cb28a0
children
line wrap: on
line source

#!/bin/bash

echo "Please enter the repository name (not in Chinese):"
read repo_name

repo_path="/var/hg/$repo_name"
mkdir -p "$repo_path"

if [ ! -d "$repo_path" ]; then
    echo "Directory creation failed, please check permissions or disk space."
    exit 1
fi

hg init "$repo_path"

sudo chown -R www-data:www-data "$repo_path"


sudo chmod -R 755 "$repo_path"

echo "Please enter the description :"
read description
echo "Please enter the contact :"
read contact

hgrc_content="[web]
description = $description
contact = $contact"

hgrc_path="$repo_path/.hg/hgrc"
echo "$hgrc_content" | sudo tee "$hgrc_path" > /dev/null

echo "New repositoryinitialized successfully in $repo_path"
echo "The hgrc file has been updated."
备案号:苏ICP备2024087954号-2 | 渝公网安备50010402001513