-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.sh
119 lines (95 loc) · 3.19 KB
/
common.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
check_config() {
# path to translations
if [[ ! -d ${KDEREPO_PATH} ]]; then
echo "KDEREPO_PATH variable in your configuration file does not point to a directory."
echo "If needed create the dir by: mkdir \"${KDEREPO_PATH}\""
exit 1
fi
# POSIEVE settings
if [[ ! -x ${POSIEVE} ]]; then
echo "Variable of POSIEVE binary is not executable or does not exist."
exit 1
fi
# lang settings
if [[ -z ${KDE_LANG} ]]; then
echo "Variable KDE_LANG is empty in your configuration file."
exit 1
fi
}
create_initial_repo() {
pushd ${KDEREPO_PATH} > /dev/null || exit 1
REPODIRS=(
"branches"
"branches/stable"
"branches/stable/l10n-kf5"
"trunk"
"trunk/l10n-support"
"trunk/l10n-kf5"
"trunk/l10n-kf6"
)
echo "Validating the repository structure at \"${KDEREPO_PATH}\""
if [[ ! -d .svn ]]; then
svn co --depth=empty svn://anonsvn.kde.org/home/kde . || exit 1
fi
for repo in ${REPODIRS[@]}; do
if [[ ! -d "${repo}" ]]; then
svn up --depth=empty ${repo} || exit 1
fi
done
# create the lokalize file for summit
cat <<-EOF > summit.lokalize
[General]
AltDir=./trunk/l10n-support/${KDE_LANG}/summit/messages
BranchDir=./trunk/l10n-support/${KDE_LANG}/summit/messages
LangCode=${KDE_LANG}
PoBaseDir=./trunk/l10n-support/${KDE_LANG}/summit/messages
PotBaseDir=./trunk/l10n-support/templates/summit/messages
ProjectID=kde-messages
TargetLangCode=${KDE_LANG}
EOF
# create the lokalize file for summit documentation
cat <<-EOF > documentation-summit.lokalize
[General]
AltDir=./trunk/l10n-support/${KDE_LANG}/summit/docmessages
BranchDir=./trunk/l10n-support/${KDE_LANG}/summit/docmessages
LangCode=${KDE_LANG}
PoBaseDir=./trunk/l10n-support/${KDE_LANG}/summit/docmessages
PotBaseDir=./trunk/l10n-support/templates/summit/docmessages
ProjectID=kde-docmessages
TargetLangCode=${KDE_LANG}
EOF
popd > /dev/null
}
update_repos() {
pushd ${KDEREPO_PATH} > /dev/null || exit 1
echo "Updating the repositories to latest versions"
svn up branches/stable/l10n-kf5/{scripts,templates,${KDE_LANG}} || exit 1
svn up trunk/l10n-support/{pology,scripts,templates,${KDE_LANG}} || exit 1
svn up trunk/l10n-kf5/{scripts,templates,${KDE_LANG}} || exit 1
svn up trunk/l10n-kf6/{scripts,templates,${KDE_LANG}} || exit 1
popd > /dev/null
}
# Check where we put the config file
[[ -z ${XDG_CONFIG_HOME} ]] && XDG_CONF="${HOME}/.config/" || XDG_CONF="${XDG_CONFIG_HOME}"
if [[ ! -e "${XDG_CONF}/kde-l10n-scripts.conf" ]]; then
# config does not exist create initial file and exit as user needs to set it up.
echo "There is no configuration around, generating new one."
cat <<-EOF > ${XDG_CONF}/kde-l10n-scripts.conf
# Path to translations.
KDEREPO_PATH="/your/path/to/the/translations/repository/"
# Posieve path, by default we use system binary
POSIEVE=\`which posieve\`
# Translation team (cs, de, ru, ...)
KDE_LANG=""
EOF
echo "Please set up required variables in:"
echo " \"${XDG_CONF}/kde-l10n-scripts.conf\""
echo "For migration to writable setup remember to enter the KDEREPO_PATH folder"
echo "and move the svn checkout to svn+ssh base:"
echo " svn relocate svn+ssh://[email protected]/home/kde"
exit 0
fi
. "${XDG_CONF}/kde-l10n-scripts.conf"
check_config
create_initial_repo
update_repos