Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
desktop
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
6
Merge Requests
6
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chakra
Packages
desktop
Commits
39504b86
Commit
39504b86
authored
Sep 05, 2010
by
Manuel Tortosa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New sync-complete.sh for avoid uploading removed files
parent
11a7c519
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
0 deletions
+181
-0
check-files.sh
check-files.sh
+114
-0
sync-complete.sh
sync-complete.sh
+67
-0
No files found.
check-files.sh
0 → 100755
View file @
39504b86
#!/bin/bash
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
# setup
#
_script_name
=
"Check files"
_build_arch
=
"
$_arch
"
_cur_repo
=
`
pwd
|
awk
-F
'/'
'{print $NF}'
`
_needed_functions
=
"config_handling helpers messages"
# load functions
for
subroutine
in
${
_needed_functions
}
do
source
_buildscripts/functions/
${
subroutine
}
done
#
# startup
#
title
"
${
_script_name
}
-
$_cur_repo
"
check_configs
load_configs
check_rsync
check_accounts
question
()
{
local
mesg
=
$1
;
shift
echo
-e
-n
"
\0
33[1;32m::
\0
33[1;0m
\0
33[1;0m
${
mesg
}
\0
33[1;0m"
}
sync_down
()
{
title2
"syncing down"
export
RSYNC_PASSWORD
=
`
echo
$_rsync_pass
`
rsync
-avh
--progress
$_rsync_user
@
$_rsync_server
::
$_rsync_dir
/
*
_repo/remote/
}
remove_packages
()
{
# remove the package(s) from _repo/remote
title2
"removing the packages(s) from _repo/remote"
pushd
_repo/remote &>/dev/null
rm
-rf
$remove_list
popd
&>/dev/null
}
sync_down
export
RSYNC_PASSWORD
=
`
echo
$_rsync_pass
`
# Get the file list in the server
repo_files
=
`
rsync
-avh
--list-only
$_rsync_user
@
$_rsync_server
::
$_rsync_dir
/
*
|
cut
-d
":"
-f
3 |
cut
-d
" "
-f
2
`
# Get the file list in _repo/remote
local_files
=
`
ls
-a
_repo/remote/
*
|
cut
-d
"/"
-f
3
`
remove_list
=
""
for
parse_file
in
$local_files
do
file_exist
=
"false"
for
compare_file
in
$repo_files
do
if
[
"
$parse_file
"
=
"
$compare_file
"
]
;
then
file_exist
=
"true"
fi
done
if
[
"
$file_exist
"
=
"false"
]
;
then
remove_list
=
"
$remove_list
$parse_file
"
fi
done
if
[
"
$remove_list
"
!=
""
]
;
then
title2
"The following packages in _repo/remote don't exist in the sever:"
newline
echo
"
$remove_list
"
newline
question
"Do you want to remove the package(s)? (y/n)"
while
true
;
do
read
yn
case
$yn
in
y
*
|
Y
*
)
newline
;
remove_packages
;
break
;;
[
nN]
*
)
newline
;
title
"The files will be keeped..."
;
newline
;
break
;;
*
)
echo
"Enter yes or no"
;;
esac
done
fi
title
"All done"
newline
sync-complete.sh
View file @
39504b86
...
...
@@ -26,14 +26,81 @@ do
source
_buildscripts/functions/
${
subroutine
}
done
question
()
{
local
mesg
=
$1
;
shift
echo
-e
-n
"
\0
33[1;32m::
\0
33[1;0m
\0
33[1;0m
${
mesg
}
\0
33[1;0m"
}
#
# main
#
remove_packages
()
{
# remove the package(s) from _repo/remote
title2
"removing the packages(s) from _repo/remote"
pushd
_repo/remote &>/dev/null
rm
-rf
$remove_list
popd
&>/dev/null
}
check_files
()
{
export
RSYNC_PASSWORD
=
`
echo
$_rsync_pass
`
# Get the file list in the server
repo_files
=
`
rsync
-avh
--list-only
$_rsync_user
@
$_rsync_server
::
$_rsync_dir
/
*
|
cut
-d
":"
-f
3 |
cut
-d
" "
-f
2
`
# Get the file list in _repo/remote
local_files
=
`
ls
-a
_repo/remote/
*
|
cut
-d
"/"
-f
3
`
remove_list
=
""
for
parse_file
in
$local_files
do
file_exist
=
"false"
for
compare_file
in
$repo_files
do
if
[
"
$parse_file
"
=
"
$compare_file
"
]
;
then
file_exist
=
"true"
fi
done
if
[
"
$file_exist
"
=
"false"
]
;
then
remove_list
=
"
$remove_list
$parse_file
"
fi
done
if
[
"
$remove_list
"
!=
""
]
;
then
title2
"The following packages in _repo/remote don't exist in the sever:"
newline
echo
"
$remove_list
"
newline
question
"Do you want to remove the package(s)? (y/n)"
while
true
;
do
read
yn
case
$yn
in
y
*
|
Y
*
)
newline
;
remove_packages
;
break
;;
[
nN]
*
)
newline
;
title
"The files will be keeped..."
;
newline
;
break
;;
*
)
echo
"Enter yes or no"
;;
esac
done
fi
}
sync_complete
()
{
title2
"syncing down"
export
RSYNC_PASSWORD
=
`
echo
$_rsync_pass
`
rsync
-avh
--progress
$_rsync_user
@
$_rsync_server
::
$_rsync_dir
/
*
_repo/remote/
title2
"Searching removed files"
check_files
# move new packages from $ROOT/repos/$REPO/build into thr repo dir
title2
"adding new packages"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment