解决cygwin安装包apt-cyg 在win10下无权限的问题

apt-cyg是cygwin的安装包管理工具,有效解决了cygwin官方setup操作繁琐的缺陷。

win10下安装cygwin操作

wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin

apt-cyg安装完成后,继续尝试安装vim,提醒无权限。

apt-cyg install vim
Installing vim
/usr/bin/apt-cyg:行361: desc: Permission denied
Unable to locate package vim

 

问题定位及解决:

观察361行,可以发现是无文件写入权限,进一步追踪脚本可以定位到cache目录,因此修改cache目录位置到家目录即可解决权限问题。

1、在$HOME下建立cache文件夹

2、备份/bin/apt-cyg文件

3、vi /bin/apt-cyg 定位到find-workspace,修改cache的位置到$HOME/cache下

function find-workspace {
  # default working directory and mirror

  # work wherever setup worked last, if possible
  cache=$(awk '
  BEGIN {
    RS = "\n\\<"
    FS = "\n\t"
  }
  $1 == "last-cache" {
    print $2
  }
  ' /etc/setup/setup.rc)

  mirror=$(awk '
  /last-mirror/ {
    getline
    print $1
  }
  ' /etc/setup/setup.rc)
  mirrordir=$(sed '
  s / %2f g
  s : %3a g
  ' <<< "$mirror")

# 此行为新增,解决cache下无写入权限的问题
cache="/home/dpc/cache"
echo $cache
  mkdir -p "$cache/$mirrordir/$arch"
  cd "$cache/$mirrordir/$arch"
  if [ -e setup.ini ]
  then
    return 0
  else
    get-setup
    return 1
  fi
}

 

转载于:https://my.oschina.net/ois/blog/1538370

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值