Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
DAVFS_MP= ${HOME}/.yadisk-davfs | ||
DISK_FOLDER= ${HOME}/YandexDisk | ||
|
||
default: | ||
echo "No default make target, see README" | ||
|
||
root-setup: | ||
# check davfs2 | ||
@which mount.davfs > /dev/null || (echo " *** Need davfs support, try installing davfs2 package" && exit 1) | ||
# perl 5.10 | ||
@perl -M5.10.0 -e1 > /dev/null || (echo " *** Need perl 5.10 or higher" && exit 1) | ||
# unison | ||
@which unison > /dev/null || (echo " *** Need unison, try installing unison package" && exit 1) | ||
# XXX perl modules | ||
@echo "The system has davfs2, perl 5.10 and unison, good." | ||
|
||
@test `id -u` -eq 0 || (echo " *** Need to run 'make root-setup' as root with sudo" && exit 1) | ||
# @echo "https://webdav.yandex.ru ${DAVFS_MP} davfs noauto,user 0 0" >> /etc/fstab | ||
@echo "Added fstab entry." | ||
|
||
@echo "You need to enable davfs mounting for normal users. Press Enter" && read DUMMY | ||
@which dpkg-reconfigure > /dev/null && dpkg-reconfigure davfs2 | ||
|
||
@usermod -a -G davfs2 ${SUDO_USER} | ||
@echo "Added ${SUDO_USER} to davfs2 group." | ||
|
||
@echo "Now run 'make setup' to finish non-root configuration." | ||
|
||
# README: 0, 1, 3, 4, 6? | ||
|
||
setup: | ||
# README: 2, 2.5, 4.5, 4.6, 5, 5.5 | ||
@test ${YANDEX_LOGIN} || (echo " *** Need YANDEX_LOGIN variable" && exit 1) | ||
@test ${YANDEX_PASSWORD} || (echo " *** Need YANDEX_PASSWORD variable" && exit 1) | ||
|
||
@mkdir -p ${HOME}/.davfs2 | ||
@echo "${DAVFS_MP} ${YANDEX_LOGIN} ${YANDEX_PASSWORD}" >> ${HOME}/.davfs2/secrets | ||
@chown ${USER}:${USER} ${HOME}/.davfs2/secrets | ||
@chmod 600 ${HOME}/.davfs2/secrets | ||
@echo "Added davfs credentials." | ||
|
||
@mkdir -p ${DISK_FOLDER}/Documents | ||
@echo "Created ${DISK_FOLDER}." | ||
|
||
@echo "[auth]" >> ${HOME}/.yadiskrc | ||
@chmod 600 ${HOME}/.yadiskrc | ||
@echo "login=${YANDEX_LOGIN}" >> ${HOME}/.yadiskrc | ||
@echo "password=${YANDEX_PASSWORD}" >> ${HOME}/.yadiskrc | ||
@echo "[paths]" >> ${HOME}/.yadiskrc | ||
@echo "webdav=${DAVFS_MP}" >> ${HOME}/.yadiskrc | ||
@echo "folder=${DISK_FOLDER}" >> ${HOME}/.yadiskrc | ||
@echo "Created ${HOME}/.yadiskrc with your config." | ||
|
||
@echo "Now, you may run yadisk-sync.pl." |