You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@emmett1
The 'portsync' is replaced with an older version after the upgraded
before the upgrade, see:
#!/bin/sh## scratchpkg## Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com)## 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 3 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 <https://www.gnu.org/licenses/>.#cmp_copy() {
# usage:# cmp_copy <source dir> <target dir>#
reponame=${2##*/}echo"Updating repository $(basename $reponame)"forpin$1/*;do
[ -d$p ] ||continue
pname=${p##*/}if [ !-d$2/$pname ];then
mkdir -p $2/$pnameforfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continuecase$fin*/update) continue;;
esac
fname=${f##*/}echo" New: $reponame/$pname/$fname"
cp $f$2/$pname/$fnamedoneelseforfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continuecase$fin*/update) continue;;
esac
fname=${f##*/}
cmp -s $f$2/$pname/$fname|| {
echo" Edit: $reponame/$pname/$fname"
cp $f$2/$pname/$fname
}
donefidoneforpin$2/*;do
[ -d$p ] ||continue
pname=${p##*/}forfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continue
fname=${f##*/}if [ !-f$1/$pname/$fname ];thenecho" Removed: $reponame/$pname/$fname"
rm $2/$pname/$fnamefidoneif [ !-d$1/$pname ];then
rmdir $2/$pnamefidoneecho"Finished successfully"
}
github_sync() {
# usage:# github_sync <github url> <target dir>#
dir=$2
repo=${dir##*/}
url=$(echo $1| cut -d / -f -5)
branch=$(echo $1| cut -d / -f 7)
tarball=/tmp/$repoecho"Fetching from $1"
curl --silent -LJ -o $tarball.tar.xz $url/tarball/$branch|| {
echo"Failed fetching repo from $1"exit 1
}
tar -tf $tarball.tar.xz >/dev/null 2>&1|| {
echo"Tarball from $1 corrupted"exit 1
}
portname=$(tar -tf $tarball.tar.xz 2>/dev/null | head -n1 | cut -d / -f1)
tar -xf $tarball.tar.xz -C /tmp
if [ !"$portname" ] || [ -d"$repo" ];thenecho"Failed sync $repo repo"exit 1
fi
cmp_copy /tmp/$portname/$repo$dir
rm -f $tarball.tar.xz
rm -fr /tmp/$portname
}
httpup_sync() {
# usage:# httpup_sync <url> <target dir>#command -v httpup >/dev/null 2>&1|| {
echo"httpup not found."exit 1
}
httpup sync $1$2|| {
echo"Failed sync from $1"exit 1
}
}
REPO_FILE=/etc/scratchpkg.repo
if [ !-e"$REPO_FILE" ];thenecho"Repo file not found! ($REPO_FILE)"exit 1
fiif [ "$(id -u)"!= 0 ];thenecho"This operation need root access."exit 1
fi
grep -Ev '^(#|$)'"$REPO_FILE"| awk '{print $1,$2}'|whileread -r repodir repourl;doif [ "$repodir" ] && [ "$repourl" ];thencase$repourlin*github.com*) github_sync $repourl$repodir;;
*) httpup_sync $repourl$repodir;;
esacfidoneexit 0
upgrade
scratch sync
scratch upgrade scratchpkg
after the upgrade
#!/bin/sh## scratchpkg## Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com)## 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 3 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 <https://www.gnu.org/licenses/>.#cmp_copy() {
# usage:# cmp_copy <source dir> <target dir>#
reponame=${2##*/}forpin$1/*;do
[ -d$p ] ||continue
pname=${p##*/}if [ !-d$2/$pname ];then
mkdir -p $2/$pnameforfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continuecase$fin*/update) continue;;
esac
fname=${f##*/}echo" New: $reponame/$pname/$fname"
cp $f$2/$pname/$fnamedoneelseforfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continuecase$fin*/update) continue;;
esac
fname=${f##*/}
cmp -s $f$2/$pname/$fname|| {
echo" Edit: $reponame/$pname/$fname"
cp $f$2/$pname/$fname
}
donefidoneforpin$2/*;do
[ -d$p ] ||continue
pname=${p##*/}forfin$p/*$p/.pkgfiles $p/.checksums;do
[ -f$f ] ||continue
fname=${f##*/}if [ !-f$1/$pname/$fname ];thenecho" Removed: $reponame/$pname/$fname"
rm $2/$pname/$fnamefidoneif [ !-d$1/$pname ];then
rmdir $2/$pnamefidone
}
github_sync() {
# usage:# github_sync <github url> <target dir>#echo"Updating repo: $2"
dir=$2
repo=${dir##*/}
url=$(echo $1| cut -d / -f -5)
branch=$(echo $1| cut -d / -f 7)
tmprepo=/tmp/tmprepo
echo" fetching $1"
rm -fr $tmprepo
git clone -q -b $branch$url$tmprepoif [ $?!= 0 ] || [ !-d$tmprepo/$repo ];thenecho" failed sync repo"return 1
fi
cmp_copy $tmprepo/$repo$dir
rm -fr $tmprepoecho" repo update completed"
}
REPO_FILE=/etc/scratchpkg.repo
if [ !-e"$REPO_FILE" ];thenecho"Repo file not found: $REPO_FILE"exit 1
fiif [ "$(id -u)"!= 0 ];thenecho"This operation need root access."exit 1
fi
grep -Ev '^(#|$)'"$REPO_FILE"| awk '{print $1,$2}'|whileread -r repodir repourl;doif [ "$repodir" ] && [ "$repourl" ];then
github_sync $repourl$repodirfidoneexit 0
The text was updated successfully, but these errors were encountered:
Its correct. Above is the old one, still using httpup, and the below is new one, using git completely. Using https is slow far from git, thats why i'm ditching httpup for git completely.
@emmett1
The 'portsync' is replaced with an older version after the upgraded
The text was updated successfully, but these errors were encountered: