Sisyphus repositório
Última atualização: 18 setembro 2020 | SRPMs: 17685 | Visitas: 19249100
en ru br
ALT Linux repositórios
S:0.3-alt2

Group :: Sistema/Configurações/Rede
RPM: installer-feature-repo-add

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

installer-feature-repo-add-0.3/000075500000000000000000000000001230533023300164635ustar00rootroot00000000000000installer-feature-repo-add-0.3/Makefile000064400000000000000000000004121230533023300201200ustar00rootroot00000000000000install2_dir=$(datadir)/install2

install:
install -d $(install2_dir)
[ -d initinstall.d ] && cp -a initinstall.d $(install2_dir) ||:
[ -d preinstall.d ] && cp -a preinstall.d $(install2_dir) ||:
[ -d postinstall.d ] && cp -a postinstall.d $(install2_dir) ||:
installer-feature-repo-add-0.3/postinstall.d/000075500000000000000000000000001230533023300212615ustar00rootroot00000000000000installer-feature-repo-add-0.3/postinstall.d/90-pkg.sh000075500000000000000000000050441230533023300226320ustar00rootroot00000000000000#!/bin/sh -efu

a= . install2-init-functions

cdrom_dir="/media/ALTLinux"

# setup apt sources
sources_list()
{
local url="$1";shift;
local comps="$1";shift;

mkdir -p -- "$destdir/etc/apt/sources.list.d"
printf 'rpm %s ALTLinux %s\n' "$url" "${comps% }" > "$destdir/etc/apt/sources.list.d/sources.installer.list"
}

sources_cdrom()
{
DEVICE=${DEVICE:-}
CDROMDEV=${CDROMDEV:-}
# only real optical media gets added; see also #29704
case "$CDROMDEV" in
/dev/sr*|/dev/cdrom*|/dev/dvd*)
# skip if nonexistent somehow
sysdev="/sys/block/$(basename "$CDROMDEV")"
[ -d "$sysdev" ] || return 0

# skip if removable (attached via USB)
case "$(readlink "$sysdev")" in
*usb*)
return 0;;
esac
;;
*)
pushd /dev
CDROMDEV="UUID=$(blkid -o value -s UUID $DEVICE$CDROMDEV)"
popd
esac


# configure APT source if we've got here after all
printf '%s\t%s\t%s\t%s\t%s\n' "$CDROMDEV" "$cdrom_dir" "udf,iso9660" "ro,noauto,user,utf8,nofail,comment=x-gvfs-show" "0 0" >> "$destdir/etc/fstab"
mkdir -p -- "$destdir/$cdrom_dir"

# configure apt for installation media
run_chroot mount "$cdrom_dir"
run_chroot apt-cdrom --cdrom "$cdrom_dir" --no-mount -o dir::etc=/etc/apt/sources.list.d add ||:
run_chroot umount "$cdrom_dir"
}

# Options for curl
release_file="$(mktemp --quiet --tmpdir release.XXXXX)"
curl_opt_cmn="--connect-timeout 2 \
--max-time 2 \
--output $release_file \
--silent \
--write-out %{http_code}"
curl_opt_ftp="$curl_opt_cmn --ftp-pasv"
curl_opt_http="$curl_opt_cmn"

get_comps()
{
local url=$1
local ret=-1
local curl_opt=
local is_http=$(expr match "$url" '\(http\)')
local is_ftp=$(expr match "$url" '\(ftp\)')

[ -z "$url" ] && return $ret
[ -z "$release_file" ] && return $ret
[ -x "/usr/bin/curl" ] || return $ret

if [ -n "$is_ftp}" ]; then
curl_opt="$curl_opt_ftp"
elif [ -n "$is_http" ]; then
curl_opt="$curl_opt_http"
else
return $ret
fi

ret_code="$(curl $curl_opt --url "$url")"

if [ -n "$is_ftp" ]; then
[ $ret_code -eq 226 ] && ret=0
elif [ -n "$is_http" ]; then
[ $ret_code -eq 200 ] && ret=0
fi

return $ret
}

case "$METHOD" in
cdrom|disk)
sources_cdrom
;;
http|ftp)
comps="base"
if get_comps "$image_url/ALTLinux/base/release" ; then
comps="$(cat "$release_file" | sed -n -e '/\/release\./p' | sed -e 's/.*\.//' | tr '\n' ' ')"
fi
sources_list "$image_url" "$comps"
;;
nfs|cifs)
#skip removable devices
;;
esac
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009