
다음을 포함하는 Makefile을 편집하려고 합니다.
...
install -d $(DESTDIR)/usr/lib/myApp
install -d $(DESTDIR)/usr/lib/myApp/scripts
install -t $(DESTDIR)/usr/lib/myApp/scripts \
src/scripts/ap.sh \
src/scripts/connect.sh \
src/scripts/devices.sh \
src/scripts/create_ap \
src/scripts/scan.sh
...
읽고 나서이 Q&A, 이 모든 것을 다음으로 대체할 수 있다는 생각이 들었습니다.
install -D src/scripts/* $(DESTDIR)/usr/lib/myApp/scripts
그러나 위의 내용은 나에게 오류를 제공합니다.
설치: 대상 '/var/lib/jenkins/data/workspace/network-service_build-test@2/build/debian/myApp-service-network/usr/lib/myApp/scripts/network'는 디렉터리가 아닙니다.
-D
여기서 플래그 사용을 오해하고 있습니까? 내 파일을 지정된 경로로 이동하고 필요에 따라 폴더를 만들어야 한다고 생각합니다.
답변1
나는 당신이 필요하다고 믿습니다
install -t "$(DESTDIR)/usr/lib/myApp/scripts/network" -D src/scripts/*
$(DESTDIR)/usr/lib/myApp/scripts/network
이렇게 하면 중간 디렉터리를 포함하여 파일이 생성되고 복사됩니다 src/scripts/*
.
테스트(추가 세부정보 열기):
$ touch file-{1,2,3,4}
$ install -v -t test/dir -D file-[1-4]
install: creating directory 'test'
install: creating directory 'test/dir'
'file-1' -> 'test/dir/file-1'
'file-2' -> 'test/dir/file-2'
'file-3' -> 'test/dir/file-3'
'file-4' -> 'test/dir/file-4'
이는 install
coreutils 8.25의 GNU에서는 작동하지만 coreutils 8.4에서는 작동하지 않습니다. 이전 coreutils 구현의 경우 다음 두 단계를 진행하세요.
install -d "$(DESTDIR)/usr/lib/myApp/scripts/network"
install -t "$(DESTDIR)/usr/lib/myApp/scripts/network" src/scripts/*
...또는 그런 것.