blob: 3eec06e5a8d01a2f3595fef1568380159ab0608d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Functions for creating a new repository
# Create a new repository
function new_repository() {
local repository_name="$1"; shift
if [[ -d "${PATH_REPOSITORIES}/${repository_name}" ]]; then
echo "The repository already exists."
else
# create the repository directory
mkdir "${PATH_REPOSITORIES}/${repository_name}"
# create the pkg dir and the database
mkdir "${PATH_REPOSITORIES}/${repository_name}/pkg"
repo-add "${PATH_REPOSITORIES}/${repository_name}/pkg/${repository_name}.db.tar.xz"
# create a folder for meta packages if required
if [[ -z "${arg_new_repo}" ]]; then
mkdir "${PATH_REPOSITORIES}/${repository_name}/src"
echo "placeholder file" > "${PATH_REPOSITORIES}/${repository_name}/src/.placeholder"
fi
# create the config file
touch "${PATH_REPOSITORIES}/${repository_name}/.config"
echo "# Configuration file for the repository" >> "${PATH_REPOSITORIES}/${repository_name}/.config"
echo
echo "LOCAL_REPOSITORY_NAME=\"${repository_name}\"" >> "${PATH_REPOSITORIES}/${repository_name}/.config"
echo "LOCAL_REMOTE_PACKAGE_DIR=\"insert url here\"" >> "${PATH_REPOSITORIES}/${repository_name}/.config"
echo "LOCAL_DB_FILE=\"pkg/${repository_name}.db.tar.xz\"" >> "${PATH_REPOSITORIES}/${repository_name}/.config"
echo "LOCAL_REMOTE_REPO_ADDRESS=\"insert url here\"" >> "${PATH_REPOSITORIES}/${repository_name}/.config"
# EOF
# edit the config file
vim "${PATH_REPOSITORIES}/${repository_name}/.config"
# create the gitignore file
vim "${PATH_REPOSITORIES}/${repository_name}/.gitignore"
fi
}
# Initialize the new repository
function new_repository_init() {
local repository_name="$1"; shift
bash "${PATH_REPOTOOLS}/repotools" -G "${repository_name}" > "${PATH_REPOSITORIES}/${repository_name}/pacman-entry.txt"
local previous_wd="$(pwd)"
cd "${PATH_REPOSITORIES}/${repository_name}"
git init
git add .
git add .config
git add .gitignore
git commit -m "Initial config"
git remote add origin "${LOCAL_REMOTE_REPO_ADDRESS}"
git push --set-upstream origin master
cd "${previous_wd}"
}
|