view Mercurial/CreathgRepos.sh @ 1:44d6d3cb28a0

fix:CreathgRepos.sh Delete Chinese and use English
author Pluto <meokcin@gmail.com>
date Tue, 03 Sep 2024 16:38:26 +0800
parents edd512324c03
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